| | |
| | | |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| | | import com.ruoyi.utils.result.Results; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | |
| | | @ApiOperation("修改用户") |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | |
| | | public AjaxResult deptTree(SysDept dept) { |
| | | return success(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 修改密码 |
| | | */ |
| | | @ApiOperation("修改密码") |
| | | @PreAuthorize("@ss.hasPermi('system:user:changePwd')") |
| | | @PutMapping("/changePwd") |
| | | public Results changePwd(String newPassword) { |
| | | String userId = SecurityUtils.getUserId(); |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | userService.checkUserAllowed(sysUser); |
| | | userService.checkUserDataScope(userId); |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(newPassword)); |
| | | sysUser.setUpdateBy(getUsername()); |
| | | int num = userService.resetPwd(sysUser); |
| | | if(num == 0){ |
| | | return Results.error("修改密码失败!"); |
| | | }else { |
| | | return Results.succeed("修改密码成功!"); |
| | | } |
| | | } |
| | | } |