|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+package api.controller.system;
|
|
|
2
|
+
|
|
|
3
|
+import api.controller.BaseController;
|
|
|
4
|
+import api.entity.database.system.*;
|
|
|
5
|
+import api.entity.input.PageInput;
|
|
|
6
|
+import api.model.AjaxResult;
|
|
|
7
|
+import api.service.system.*;
|
|
|
8
|
+import api.util.annotation.Anonymous;
|
|
|
9
|
+import api.util.annotation.Log;
|
|
|
10
|
+import api.util.enums.BusinessType;
|
|
|
11
|
+import api.util.helper.StringHelper;
|
|
|
12
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
13
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
14
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
15
|
+import io.swagger.annotations.Api;
|
|
|
16
|
+import io.swagger.annotations.ApiOperation;
|
|
|
17
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
18
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
19
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
20
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
21
|
+@Api(value = "公共方法表", tags = "公共方法表")
|
|
|
22
|
+@RestController
|
|
|
23
|
+@RequestMapping("/system/communal")
|
|
|
24
|
+@Anonymous
|
|
|
25
|
+public class CommunalController extends BaseController {
|
|
|
26
|
+ @Autowired
|
|
|
27
|
+ private IDeptService deptService;
|
|
|
28
|
+ @Autowired
|
|
|
29
|
+ private IUserService userService;
|
|
|
30
|
+ @Autowired
|
|
|
31
|
+ private IRoleService roleService;
|
|
|
32
|
+ @Autowired
|
|
|
33
|
+ private IPostService postService;
|
|
|
34
|
+ @Autowired
|
|
|
35
|
+ private IDictTypeService dictTypeService;
|
|
|
36
|
+ @Autowired
|
|
|
37
|
+ private IDictDataService dictDataService;
|
|
|
38
|
+
|
|
|
39
|
+ @ApiOperation("列表")
|
|
|
40
|
+ @Log(title = "查看部门列表", businessType = BusinessType.QUERY)
|
|
|
41
|
+ @GetMapping("/dept")
|
|
|
42
|
+ public AjaxResult getList(Dept input, PageInput pageInput) {
|
|
|
43
|
+ LambdaQueryWrapper<Dept> qw = new LambdaQueryWrapper<>();
|
|
|
44
|
+ qw.eq(input.getDeptId() != null && input.getDeptId() > 0, Dept::getDeptId, input.getDeptId());
|
|
|
45
|
+ qw.eq(input.getParentId() != null && input.getParentId() > 0, Dept::getParentId, input.getParentId());
|
|
|
46
|
+ qw.like(!StringHelper.isEmpty(input.getAncestors()), Dept::getAncestors, input.getAncestors());
|
|
|
47
|
+ qw.like(!StringHelper.isEmpty(input.getDeptName()), Dept::getDeptName, input.getDeptName());
|
|
|
48
|
+ qw.eq(input.getOrderNum() != null && input.getOrderNum() > 0, Dept::getOrderNum, input.getOrderNum());
|
|
|
49
|
+ qw.like(!StringHelper.isEmpty(input.getLeader()), Dept::getLeader, input.getLeader());
|
|
|
50
|
+ qw.like(!StringHelper.isEmpty(input.getPhone()), Dept::getPhone, input.getPhone());
|
|
|
51
|
+ qw.like(!StringHelper.isEmpty(input.getEmail()), Dept::getEmail, input.getEmail());
|
|
|
52
|
+ qw.like(!StringHelper.isEmpty(input.getStatus()), Dept::getStatus, input.getStatus());
|
|
|
53
|
+ qw.eq(Dept::getDelFlag, "0");
|
|
|
54
|
+ qw.like(!StringHelper.isEmpty(input.getCreateBy()), Dept::getCreateBy, input.getCreateBy());
|
|
|
55
|
+ qw.eq(input.getCreateTime() != null, Dept::getCreateTime, input.getCreateTime());
|
|
|
56
|
+ qw.like(!StringHelper.isEmpty(input.getUpdateBy()), Dept::getUpdateBy, input.getUpdateBy());
|
|
|
57
|
+ qw.eq(input.getUpdateTime() != null, Dept::getUpdateTime, input.getUpdateTime());
|
|
|
58
|
+ Page<Dept> page = GetPage(pageInput);
|
|
|
59
|
+ if (page != null) {
|
|
|
60
|
+ IPage<Dept> iPage = deptService.getListPage(page, qw);
|
|
|
61
|
+ return Success("成功", iPage.getRecords(), iPage.getTotal());
|
|
|
62
|
+ } else {
|
|
|
63
|
+ return Success("成功", deptService.getList(qw));
|
|
|
64
|
+ }
|
|
|
65
|
+ }
|
|
|
66
|
+ @ApiOperation("列表")
|
|
|
67
|
+ @Log(title = "查询用户信息表列表", businessType = BusinessType.QUERY)
|
|
|
68
|
+ @GetMapping("/user")
|
|
|
69
|
+ public AjaxResult getList(User input, PageInput pageInput) {
|
|
|
70
|
+ LambdaQueryWrapper<User> qw = new LambdaQueryWrapper<>();
|
|
|
71
|
+ qw.eq(input.getUserId() != null && input.getUserId() > 0, User::getUserId, input.getUserId());
|
|
|
72
|
+ // qw.eq(input.getDeptId() != null && input.getDeptId() > 0, User::getDeptId, input.getDeptId());
|
|
|
73
|
+ if (input.getDeptId() != null &&input.getDeptId()>0)
|
|
|
74
|
+ {
|
|
|
75
|
+ //查询下级部门所有人员
|
|
|
76
|
+ qw.and(wq->{
|
|
|
77
|
+ wq.inSql(User::getDeptId, "select dept_id from sys_dept where " +
|
|
|
78
|
+ " ancestors REGEXP CONCAT((select ancestors from sys_dept where dept_id="+input.getDeptId()+"),',',"
|
|
|
79
|
+ +input.getDeptId()+") ") ;
|
|
|
80
|
+ wq.or().like(User::getDeptId,input.getDeptId());
|
|
|
81
|
+ });
|
|
|
82
|
+ }
|
|
|
83
|
+ qw.like(!StringHelper.isEmpty(input.getUserName()), User::getUserName, input.getUserName());
|
|
|
84
|
+ qw.like(!StringHelper.isEmpty(input.getNickName()), User::getNickName, input.getNickName());
|
|
|
85
|
+ qw.eq(!StringHelper.isEmpty(input.getUserType()), User::getUserType, input.getUserType());
|
|
|
86
|
+ qw.like(!StringHelper.isEmpty(input.getEmail()), User::getEmail, input.getEmail());
|
|
|
87
|
+ qw.like(!StringHelper.isEmpty(input.getPhonenumber()), User::getPhonenumber, input.getPhonenumber());
|
|
|
88
|
+ qw.eq(!StringHelper.isEmpty(input.getSex()), User::getSex, input.getSex());
|
|
|
89
|
+ qw.eq(!StringHelper.isEmpty(input.getStatus()), User::getStatus, input.getStatus());
|
|
|
90
|
+ qw.eq(User::getDelFlag, "0");
|
|
|
91
|
+ qw.orderByDesc(User::getUserId);
|
|
|
92
|
+
|
|
|
93
|
+ Page<User> page = GetPage(pageInput);
|
|
|
94
|
+ if (page != null) {
|
|
|
95
|
+ //IPage<User> iPage = userService.getListPage(page, qw);
|
|
|
96
|
+ IPage<User> iPage = userService.selectUserDeptList(page, qw);
|
|
|
97
|
+
|
|
|
98
|
+
|
|
|
99
|
+
|
|
|
100
|
+ return Success("成功", iPage.getRecords(), iPage.getTotal());
|
|
|
101
|
+ } else {
|
|
|
102
|
+ return Success("成功", userService.selectUserDeptList(qw));
|
|
|
103
|
+ }
|
|
|
104
|
+ }
|
|
|
105
|
+ @ApiOperation("列表")
|
|
|
106
|
+ @Log(title = "查看角色列表", businessType = BusinessType.QUERY)
|
|
|
107
|
+ @GetMapping("/role")
|
|
|
108
|
+ public AjaxResult getList(Role input, PageInput pageInput) {
|
|
|
109
|
+ LambdaQueryWrapper<Role> qw = new LambdaQueryWrapper<>();
|
|
|
110
|
+ qw.eq(input.getRoleId() != null && input.getRoleId() > 0, Role::getRoleId, input.getRoleId());
|
|
|
111
|
+ qw.like(!StringHelper.isEmpty(input.getRoleName()), Role::getRoleName, input.getRoleName());
|
|
|
112
|
+ qw.like(!StringHelper.isEmpty(input.getRoleKey()), Role::getRoleKey, input.getRoleKey());
|
|
|
113
|
+ qw.eq(input.getRoleSort() != null && input.getRoleSort() > 0, Role::getRoleSort, input.getRoleSort());
|
|
|
114
|
+ qw.like(!StringHelper.isEmpty(input.getDataScope()), Role::getDataScope, input.getDataScope());
|
|
|
115
|
+ qw.eq(input.getMenuCheckStrictly() != null, Role::getMenuCheckStrictly, input.getMenuCheckStrictly());
|
|
|
116
|
+ qw.eq(input.getDeptCheckStrictly() != null, Role::getDeptCheckStrictly, input.getDeptCheckStrictly());
|
|
|
117
|
+ qw.like(!StringHelper.isEmpty(input.getStatus()), Role::getStatus, input.getStatus());
|
|
|
118
|
+ qw.eq(!StringHelper.isEmpty(input.getDelFlag()), Role::getDelFlag, input.getDelFlag());
|
|
|
119
|
+ qw.like(!StringHelper.isEmpty(input.getCreateBy()), Role::getCreateBy, input.getCreateBy());
|
|
|
120
|
+ qw.eq(input.getCreateTime() != null, Role::getCreateTime, input.getCreateTime());
|
|
|
121
|
+ qw.like(!StringHelper.isEmpty(input.getUpdateBy()), Role::getUpdateBy, input.getUpdateBy());
|
|
|
122
|
+ qw.eq(input.getUpdateTime() != null, Role::getUpdateTime, input.getUpdateTime());
|
|
|
123
|
+ qw.like(!StringHelper.isEmpty(input.getRemark()), Role::getRemark, input.getRemark());
|
|
|
124
|
+ // qw.between(input.getBeginTime() != null, Role::getCreateTime, input.getBeginTime(), input.getEndTime());
|
|
|
125
|
+ if (input.getBeginTime() != null && input.getEndTime() != null) {
|
|
|
126
|
+ qw.between(Role::getCreateTime, input.getBeginTime(), input.getEndTime());
|
|
|
127
|
+ }
|
|
|
128
|
+ qw.orderByDesc(Role::getRoleId);
|
|
|
129
|
+ Page<Role> page = GetPage(pageInput);
|
|
|
130
|
+ if (page != null) {
|
|
|
131
|
+ IPage<Role> iPage = roleService.getListPage(page, qw);
|
|
|
132
|
+ return Success("成功", iPage.getRecords(), iPage.getTotal());
|
|
|
133
|
+ } else {
|
|
|
134
|
+ return Success("成功", roleService.getList(qw));
|
|
|
135
|
+ }
|
|
|
136
|
+ }
|
|
|
137
|
+ @ApiOperation("列表")
|
|
|
138
|
+ @Log(title = "查看岗位列表",businessType = BusinessType.QUERY)
|
|
|
139
|
+ @GetMapping("/post")
|
|
|
140
|
+ public AjaxResult getList(Post input, PageInput pageInput) {
|
|
|
141
|
+ LambdaQueryWrapper<Post> qw = new LambdaQueryWrapper<>();
|
|
|
142
|
+ qw.eq(input.getPostId() != null && input.getPostId() > 0, Post::getPostId, input.getPostId());
|
|
|
143
|
+ qw.like(!StringHelper.isEmpty(input.getPostCode()), Post::getPostCode, input.getPostCode());
|
|
|
144
|
+ qw.like(!StringHelper.isEmpty(input.getPostName()), Post::getPostName, input.getPostName());
|
|
|
145
|
+ qw.eq(input.getPostSort() != null && input.getPostSort() > 0, Post::getPostSort, input.getPostSort());
|
|
|
146
|
+ qw.like(!StringHelper.isEmpty(input.getStatus()), Post::getStatus, input.getStatus());
|
|
|
147
|
+ qw.like(!StringHelper.isEmpty(input.getCreateBy()), Post::getCreateBy, input.getCreateBy());
|
|
|
148
|
+ qw.eq(input.getCreateTime() != null, Post::getCreateTime, input.getCreateTime());
|
|
|
149
|
+ qw.like(!StringHelper.isEmpty(input.getUpdateBy()), Post::getUpdateBy, input.getUpdateBy());
|
|
|
150
|
+ qw.eq(input.getUpdateTime() != null, Post::getUpdateTime, input.getUpdateTime());
|
|
|
151
|
+ qw.like(!StringHelper.isEmpty(input.getRemark()), Post::getRemark, input.getRemark());
|
|
|
152
|
+ qw.orderByDesc(Post::getPostId);
|
|
|
153
|
+ Page<Post> page = GetPage(pageInput);
|
|
|
154
|
+ if (page != null) {
|
|
|
155
|
+ IPage<Post> iPage = postService.getListPage(page, qw);
|
|
|
156
|
+ return Success("成功", iPage.getRecords(), iPage.getTotal());
|
|
|
157
|
+ } else {
|
|
|
158
|
+ return Success("成功", postService.getList(qw));
|
|
|
159
|
+ }
|
|
|
160
|
+ }
|
|
|
161
|
+ @ApiOperation("列表")
|
|
|
162
|
+ @Log(title = "查询字典类型表列表",businessType = BusinessType.QUERY)
|
|
|
163
|
+ @GetMapping("/dic")
|
|
|
164
|
+ public AjaxResult getList(DictType input, PageInput pageInput) {
|
|
|
165
|
+ LambdaQueryWrapper<DictType> qw = new LambdaQueryWrapper<>();
|
|
|
166
|
+ qw.eq(input.getDictId() != null && input.getDictId() > 0, DictType::getDictId, input.getDictId());
|
|
|
167
|
+ qw.like(!StringHelper.isEmpty(input.getDictName()), DictType::getDictName, input.getDictName());
|
|
|
168
|
+ qw.like(!StringHelper.isEmpty(input.getDictType()), DictType::getDictType, input.getDictType());
|
|
|
169
|
+ qw.like(!StringHelper.isEmpty(input.getStatus()), DictType::getStatus, input.getStatus());
|
|
|
170
|
+ qw.like(!StringHelper.isEmpty(input.getCreateBy()), DictType::getCreateBy, input.getCreateBy());
|
|
|
171
|
+ qw.eq(input.getCreateTime() != null , DictType::getCreateTime, input.getCreateTime());
|
|
|
172
|
+ qw.like(!StringHelper.isEmpty(input.getUpdateBy()), DictType::getUpdateBy, input.getUpdateBy());
|
|
|
173
|
+ qw.eq(input.getUpdateTime() != null , DictType::getUpdateTime, input.getUpdateTime());
|
|
|
174
|
+ qw.like(!StringHelper.isEmpty(input.getRemark()), DictType::getRemark, input.getRemark());
|
|
|
175
|
+ qw.orderByDesc(DictType::getDictId);
|
|
|
176
|
+ Page<DictType> page = GetPage(pageInput);
|
|
|
177
|
+ if (page != null) {
|
|
|
178
|
+ IPage<DictType> iPage = dictTypeService.getListPage(page, qw);
|
|
|
179
|
+ return Success("成功", iPage.getRecords(), iPage.getTotal());
|
|
|
180
|
+ } else {
|
|
|
181
|
+ return Success("成功", dictTypeService.getList(qw));
|
|
|
182
|
+ }
|
|
|
183
|
+ }
|
|
|
184
|
+ @ApiOperation("列表")
|
|
|
185
|
+ @Log(title = "根据dict type查询列表", businessType = BusinessType.QUERY)
|
|
|
186
|
+ @GetMapping("/dictate")
|
|
|
187
|
+ public AjaxResult getList(String dictType, PageInput pageInput) {
|
|
|
188
|
+ if (dictType== null) {
|
|
|
189
|
+ return Error("dict type不能为空");
|
|
|
190
|
+ }
|
|
|
191
|
+ LambdaQueryWrapper<DictData> qw = new LambdaQueryWrapper<>();
|
|
|
192
|
+ qw.eq(DictData::getDictType, dictType);
|
|
|
193
|
+ qw.eq(DictData::getStatus, 0);
|
|
|
194
|
+ qw.orderByDesc(DictData::getDataId);
|
|
|
195
|
+ Page<DictData> page = GetPage(pageInput);
|
|
|
196
|
+ if (page != null) {
|
|
|
197
|
+ IPage<DictData> iPage = dictDataService.getListPage(page, qw);
|
|
|
198
|
+ return Success("成功", iPage.getRecords(), iPage.getTotal());
|
|
|
199
|
+ } else {
|
|
|
200
|
+ return Success("成功", dictDataService.getList(qw));
|
|
|
201
|
+ }
|
|
|
202
|
+ }
|
|
|
203
|
+}
|