DeptUserController.php
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
namespace App\Http\Controllers\Bside\User;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\User\DeptUserLogic;
use App\Models\User\ViewDeptUser;
class DeptUserController extends BaseController
{
/**
* @name :name
* @author :liyuhang
* @method
*/
public function lists(ViewDeptUser $viewDeptUser){
$this->map['project_id'] = $this->user['project_id'];
// $lists = $viewDeptUser->lists($this->map,$this->page,$this->row,'user_id');
$result = DB::table('gl_project_user')->where($this->map)
->select(
'gl_project_dept_user.dept_id AS dept_id',
'gl_project_user.name AS name',
'gl_project_user.project_id AS project_id',
'gl_project_user.mobile AS mobile',
'gl_project_user.email AS email',
'gl_project_user.status AS status',
'gl_project_user.role_id AS role_id',
'gl_project_user.operator_id AS operator_id',
'gl_project_dept_user.is_admin AS is_admin',
'gl_project_dept.title AS title',
'gl_project_dept.pid AS pid',
'gl_project_dept.remark AS remark',
'gl_project_user.id AS user_id',
'gl_project_dept_user.id AS id',
'gl_project_role.name AS role_name'
)
->leftJoin('gl_project_dept_user', 'gl_project_user.id', '=', 'gl_project_dept_user.user_id')
->leftJoin('gl_project_dept', 'gl_project_dept_user.dept_id', '=', 'gl_project_dept.id')
->join('gl_project_role', 'gl_project_user.role_id', '=', 'gl_project_role.id')
->orderBy('id','desc')
->paginate($this->row, ['*'], 'page', $this->page);
$this->response('success',Code::SUCCESS,$result);
}
/**
* @param ViewDeptUser $viewDeptUser
* @name :(详情)info
* @author :lyh
* @method :post
* @time :2023/5/18 9:32
*/
public function info(ViewDeptUser $viewDeptUser){
$this->request->validate([
'id'=>['required']
],[
'id.required' => 'id不能为空'
]);
$info = $viewDeptUser->read($this->param);
$this->response('success',Code::SUCCESS,$info);
}
/**
* @name :(部门添加与更新用户)add
* @author :lyh
* @method :post
* @time :2023/5/17 17:36
*/
public function save(DeptUserLogic $deptUserLogic){
$this->request->validate([
'dept_id'=>['required'],
'user_id'=>['required']
],[
'dept_id.required' => '组织架构id不能为空',
'user_id.required' => '用户id不能为空',
]);
$deptUserLogic->dept_user_save();
$this->response('success');
}
/**
* @name :(设置管理员)set_admin
* @author :lyh
* @method :post
* @time :2023/5/18 10:32
*/
public function set_admin(DeptUserLogic $deptUserLogic){
$this->request->validate([
'id'=>['required'],
'is_admin'=>['required'],
],[
'id.required' => 'id不能为空',
'is_admin.required' => 'is_admin不能为空',
]);
$deptUserLogic->dept_user_edit();
$this->response('success');
}
/**
* @name :(设置用户角色)set_role
* @author :lyh
* @method :post
* @time :2023/5/19 9:32
*/
public function set_role(DeptUserLogic $deptUserLogic){
$this->request->validate([
'id'=>['required'],
'role_id'=>['required'],
],[
'id.required' => '用户id不能为空',
'role_id.required' => 'role_id不能为空',
]);
$deptUserLogic->user_edit_role();
$this->response('success');
}
}