|  |  |  | 
|---|
|  |  |  | import com.ruoyi.system.query.GetSysUserList; | 
|---|
|  |  |  | import com.ruoyi.system.query.ShopUserStart; | 
|---|
|  |  |  | import com.ruoyi.system.service.*; | 
|---|
|  |  |  | import io.seata.core.context.RootContext; | 
|---|
|  |  |  | import io.seata.spring.annotation.GlobalTransactional; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 重置密码 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequiresPermissions("system:user:edit") | 
|---|
|  |  |  | @Log(title = "用户管理", businessType = BusinessType.UPDATE) | 
|---|
|  |  |  | @PutMapping("/resetPwd") | 
|---|
|  |  |  | @ApiOperation(value = "重置密码", tags = {"管理后台-系统用户管理"}) | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 状态修改 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequiresPermissions("system:user:edit") | 
|---|
|  |  |  | @Log(title = "用户管理", businessType = BusinessType.UPDATE) | 
|---|
|  |  |  | @PutMapping("/changeStatus") | 
|---|
|  |  |  | public AjaxResult changeStatus(@RequestBody SysUser user) { | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据用户编号获取授权角色 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequiresPermissions("system:user:query") | 
|---|
|  |  |  | @GetMapping("/authRole/{userId}") | 
|---|
|  |  |  | public AjaxResult authRole(@PathVariable("userId") Long userId) { | 
|---|
|  |  |  | AjaxResult ajax = AjaxResult.success(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 用户授权角色 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequiresPermissions("system:user:edit") | 
|---|
|  |  |  | @Log(title = "用户管理", businessType = BusinessType.GRANT) | 
|---|
|  |  |  | @PutMapping("/authRole") | 
|---|
|  |  |  | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取部门树列表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequiresPermissions("system:user:list") | 
|---|
|  |  |  | @GetMapping("/deptTree") | 
|---|
|  |  |  | public AjaxResult deptTree(SysDept dept) { | 
|---|
|  |  |  | return success(deptService.selectDeptTreeList(dept)); | 
|---|
|  |  |  | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | @PostMapping("/addSysUser") | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public R addSysUser(@RequestBody SysUser user){ | 
|---|
|  |  |  | public R addSysUser(@RequestBody SysUser user) { | 
|---|
|  |  |  | if(StringUtils.isEmpty(user.getUserName())){ | 
|---|
|  |  |  | user.setUserName(user.getPhonenumber()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | userService.resetPwd(user); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | @PostMapping("/getSysUserById") | 
|---|
|  |  |  | public SysUser getSysUserById(@RequestParam("userId") Long userId){ | 
|---|
|  |  |  | return userService.getById(userId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|