inleft
2022-03-02 34223b096cf6ad9d92c3702bb9529e764f523b11
commit | author | age
9bcb19 1 /*
I 2 Copyright [2020] [https://www.xiaonuo.vip]
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8   http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
17
18 1.请不要删除和修改根目录下的LICENSE文件。
19 2.请不要删除和修改Snowy源码头部的版权声明。
20 3.请保留源码和相关描述文件的项目出处,作者声明等。
21 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
22 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
23 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
24  */
25 package vip.xiaonuo.sys.modular.user.controller;
26
27 import org.springframework.validation.annotation.Validated;
28 import org.springframework.web.bind.annotation.GetMapping;
29 import org.springframework.web.bind.annotation.PostMapping;
30 import org.springframework.web.bind.annotation.RequestBody;
31 import org.springframework.web.bind.annotation.RestController;
32 import vip.xiaonuo.core.annotion.BusinessLog;
33 import vip.xiaonuo.core.annotion.DataScope;
34 import vip.xiaonuo.core.annotion.Permission;
35 import vip.xiaonuo.core.annotion.Wrapper;
36 import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
37 import vip.xiaonuo.core.pojo.response.ResponseData;
38 import vip.xiaonuo.core.pojo.response.SuccessResponseData;
39 import vip.xiaonuo.sys.modular.user.param.SysUserParam;
40 import vip.xiaonuo.sys.modular.user.service.SysUserService;
41 import vip.xiaonuo.sys.modular.user.wrapper.SysUserWrapper;
42 import javax.annotation.Resource;
43 import java.util.List;
44
45 /**
46  * 系统用户控制器
47  *
48  * @author xuyuxiang
49  * @date 2020/3/19 21:14
50  */
51 @RestController
52 public class SysUserController {
53
54     @Resource
55     private SysUserService sysUserService;
56
57     /**
58      * 查询系统用户
59      *
60      * @author xuyuxiang
61      * @date 2020/3/20 21:00
62      */
63     @Permission
64     @DataScope
65     @GetMapping("/sysUser/page")
66     @BusinessLog(title = "系统用户_查询", opType = LogAnnotionOpTypeEnum.QUERY)
67     @Wrapper(SysUserWrapper.class)
68     public ResponseData page(SysUserParam sysUserParam) {
69         return new SuccessResponseData(sysUserService.page(sysUserParam));
70     }
71
72     /**
73      * 增加系统用户
74      *
75      * @author xuyuxiang
76      * @date 2020/3/23 16:28
77      */
78     @Permission
79     @DataScope
80     @PostMapping("/sysUser/add")
81     @BusinessLog(title = "系统用户_增加", opType = LogAnnotionOpTypeEnum.ADD)
82     public ResponseData add(@RequestBody @Validated(SysUserParam.add.class) SysUserParam sysUserParam) {
83         sysUserService.add(sysUserParam);
84         return new SuccessResponseData();
85     }
86
87     /**
88      * 删除系统用户
89      *
90      * @author xuyuxiang yubaoshan
91      * @date 2020/3/23 16:28
92      */
93     @Permission
94     @DataScope
95     @PostMapping("/sysUser/delete")
96     @BusinessLog(title = "系统用户_删除", opType = LogAnnotionOpTypeEnum.DELETE)
97     public ResponseData delete(@RequestBody @Validated(SysUserParam.delete.class) List<SysUserParam> sysUserParamList) {
98         sysUserService.delete(sysUserParamList);
99         return new SuccessResponseData();
100     }
101
102     /**
103      * 编辑系统用户
104      *
105      * @author xuyuxiang
106      * @date 2020/3/23 16:28
107      */
108     @Permission
109     @DataScope
110     @PostMapping("/sysUser/edit")
111     @BusinessLog(title = "系统用户_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
112     public ResponseData edit(@RequestBody @Validated(SysUserParam.edit.class) SysUserParam sysUserParam) {
113         sysUserService.edit(sysUserParam);
114         return new SuccessResponseData();
115     }
116
117     /**
118      * 查看系统用户
119      *
120      * @author xuyuxiang
121      * @date 2020/3/23 16:28
122      */
123     @Permission
124     @GetMapping("/sysUser/detail")
125     @BusinessLog(title = "系统用户_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
126     @Wrapper(SysUserWrapper.class)
127     public ResponseData detail(@Validated(SysUserParam.detail.class) SysUserParam sysUserParam) {
128         return new SuccessResponseData(sysUserService.detail(sysUserParam));
129     }
130
131     /**
132      * 修改状态
133      *
134      * @author xuyuxiang
135      * @date 2020/5/25 14:32
136      */
137     @Permission
138     @PostMapping("/sysUser/changeStatus")
139     @BusinessLog(title = "系统用户_修改状态", opType = LogAnnotionOpTypeEnum.CHANGE_STATUS)
140     public ResponseData changeStatus(@RequestBody @Validated(SysUserParam.changeStatus.class) SysUserParam sysUserParam) {
141         sysUserService.changeStatus(sysUserParam);
142         return new SuccessResponseData();
143     }
144
145     /**
146      * 授权角色
147      *
148      * @author xuyuxiang
149      * @date 2020/3/28 16:05
150      */
151     @Permission
152     @DataScope
153     @PostMapping("/sysUser/grantRole")
154     @BusinessLog(title = "系统用户_授权角色", opType = LogAnnotionOpTypeEnum.GRANT)
155     public ResponseData grantRole(@RequestBody @Validated(SysUserParam.grantRole.class) SysUserParam sysUserParam) {
156         sysUserService.grantRole(sysUserParam);
157         return new SuccessResponseData();
158     }
159
160     /**
161      * 授权数据
162      *
163      * @author xuyuxiang
164      * @date 2020/3/28 16:05
165      */
166     @Permission
167     @DataScope
168     @PostMapping("/sysUser/grantData")
169     @BusinessLog(title = "系统用户_授权数据", opType = LogAnnotionOpTypeEnum.GRANT)
170     public ResponseData grantData(@RequestBody @Validated(SysUserParam.grantData.class) SysUserParam sysUserParam) {
171         sysUserService.grantData(sysUserParam);
172         return new SuccessResponseData();
173     }
174
175     /**
176      * 更新信息
177      *
178      * @author xuyuxiang
179      * @date 2020/4/1 14:27
180      */
181     @PostMapping("/sysUser/updateInfo")
182     @BusinessLog(title = "系统用户_更新信息", opType = LogAnnotionOpTypeEnum.UPDATE)
183     public ResponseData updateInfo(@RequestBody @Validated(SysUserParam.updateInfo.class) SysUserParam sysUserParam) {
184         sysUserService.updateInfo(sysUserParam);
185         return new SuccessResponseData();
186     }
187
188     /**
189      * 修改密码
190      *
191      * @author xuyuxiang
192      * @date 2020/4/1 14:42
193      */
194     @PostMapping("/sysUser/updatePwd")
195     @BusinessLog(title = "系统用户_修改密码", opType = LogAnnotionOpTypeEnum.UPDATE)
196     public ResponseData updatePwd(@RequestBody @Validated(SysUserParam.updatePwd.class) SysUserParam sysUserParam) {
197         sysUserService.updatePwd(sysUserParam);
198         return new SuccessResponseData();
199     }
200
201     /**
202      * 拥有角色
203      *
204      * @author xuyuxiang
205      * @date 2020/3/28 14:46
206      */
207     @Permission
208     @GetMapping("/sysUser/ownRole")
209     @BusinessLog(title = "系统用户_拥有角色", opType = LogAnnotionOpTypeEnum.DETAIL)
210     public ResponseData ownRole(@Validated(SysUserParam.detail.class) SysUserParam sysUserParam) {
211         return new SuccessResponseData(sysUserService.ownRole(sysUserParam));
212     }
213
214     /**
215      * 拥有数据
216      *
217      * @author xuyuxiang
218      * @date 2020/3/28 14:46
219      */
220     @Permission
221     @GetMapping("/sysUser/ownData")
222     @BusinessLog(title = "系统用户_拥有数据", opType = LogAnnotionOpTypeEnum.DETAIL)
223     public ResponseData ownData(@Validated(SysUserParam.detail.class) SysUserParam sysUserParam) {
224         return new SuccessResponseData(sysUserService.ownData(sysUserParam));
225     }
226
227     /**
228      * 重置密码
229      *
230      * @author xuyuxiang
231      * @date 2020/4/1 14:42
232      */
233     @Permission
234     @PostMapping("/sysUser/resetPwd")
235     @BusinessLog(title = "系统用户_重置密码", opType = LogAnnotionOpTypeEnum.UPDATE)
236     public ResponseData resetPwd(@RequestBody @Validated(SysUserParam.resetPwd.class) SysUserParam sysUserParam) {
237         sysUserService.resetPwd(sysUserParam);
238         return new SuccessResponseData();
239     }
240
241     /**
242      * 修改头像
243      *
244      * @author xuyuxiang
245      * @date 2020/6/28 15:19
246      */
247     @PostMapping("/sysUser/updateAvatar")
248     @BusinessLog(title = "系统用户_修改头像", opType = LogAnnotionOpTypeEnum.UPDATE)
249     public ResponseData updateAvatar(@RequestBody @Validated(SysUserParam.updateAvatar.class) SysUserParam sysUserParam) {
250         sysUserService.updateAvatar(sysUserParam);
251         return new SuccessResponseData();
252     }
253
254     /**
255      * 导出系统用户
256      *
257      * @author xuyuxiang
258      * @date 2020/6/30 16:07
259      */
260     @Permission
261     @GetMapping("/sysUser/export")
262     @BusinessLog(title = "系统用户_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
263     public void export(SysUserParam sysUserParam) {
264         sysUserService.export(sysUserParam);
265     }
266
267
268     /**
269      * 用户选择器
270      *
271      * @author xuyuxiang
272      * @date 2020/7/3 13:17
273      */
274     @Permission
275     @GetMapping("/sysUser/selector")
276     @BusinessLog(title = "系统用户_选择器", opType = LogAnnotionOpTypeEnum.QUERY)
277     public ResponseData selector(SysUserParam sysUserParam) {
278         return new SuccessResponseData(sysUserService.selector(sysUserParam));
279     }
280
281 }