|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 
|---|
|  |  |  | import com.ruoyi.common.core.domain.param.ChangePwdParam; | 
|---|
|  |  |  | import com.ruoyi.utils.result.Results; | 
|---|
|  |  |  | import io.swagger.annotations.*; | 
|---|
|  |  |  | import org.apache.commons.lang3.ArrayUtils; | 
|---|
|  |  |  | 
|---|
|  |  |  | * 获取用户列表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("获取用户列表") | 
|---|
|  |  |  | @PreAuthorize("@ss.hasPermi('system:user:list')") | 
|---|
|  |  |  | //    @PreAuthorize("@ss.hasPermi('system:user:list')") | 
|---|
|  |  |  | @GetMapping("/list") | 
|---|
|  |  |  | public TableDataInfo list(SysUser user) { | 
|---|
|  |  |  | startPage(); | 
|---|
|  |  |  | 
|---|
|  |  |  | public AjaxResult deptTree(SysDept dept) { | 
|---|
|  |  |  | return success(deptService.selectDeptTreeList(dept)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取部门树列表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping("/deptTree/noPerm") | 
|---|
|  |  |  | public AjaxResult deptTreeNoPerm(SysDept dept) { | 
|---|
|  |  |  | return success(deptService.selectDeptTreeList(dept)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改密码 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("修改密码") | 
|---|
|  |  |  | @PreAuthorize("@ss.hasPermi('system:user:changePwd')") | 
|---|
|  |  |  | //    @PreAuthorize("@ss.hasPermi('system:user:changePwd')") | 
|---|
|  |  |  | @PutMapping("/changePwd") | 
|---|
|  |  |  | public Results changePwd(@RequestBody ChangePwdParam changePwdParam) { | 
|---|
|  |  |  | SysUser sysUser = userService.selectUserById(changePwdParam.getUserId()); | 
|---|
|  |  |  | public Results changePwd(String newPassword) { | 
|---|
|  |  |  | String userId = SecurityUtils.getUserId(); | 
|---|
|  |  |  | SysUser sysUser = userService.selectUserById(userId); | 
|---|
|  |  |  | userService.checkUserAllowed(sysUser); | 
|---|
|  |  |  | userService.checkUserDataScope(changePwdParam.getUserId()); | 
|---|
|  |  |  | sysUser.setPassword(SecurityUtils.encryptPassword(changePwdParam.getNewPassword())); | 
|---|
|  |  |  | userService.checkUserDataScope(userId); | 
|---|
|  |  |  | sysUser.setPassword(SecurityUtils.encryptPassword(newPassword)); | 
|---|
|  |  |  | sysUser.setUpdateBy(getUsername()); | 
|---|
|  |  |  | int num = userService.resetPwd(sysUser); | 
|---|
|  |  |  | if(num == 0){ | 
|---|