| | |
| | | import com.ruoyi.admin.service.UserRoleService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("power_account") |
| | | @ApiOperation(value = "账号分页查询列表", tags = {"后台-权限管理-账号管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | * @param id 后台账号id |
| | | * @param enable 启用/关闭 |
| | | */ |
| | | @RequiresPermissions("power_enable") |
| | | @ApiOperation(value = "启用/关闭后台账号", tags = {"后台-师傅管理-师傅列表管理"}) |
| | | @GetMapping(value = "/enable") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param id 账号id |
| | | */ |
| | | @RequiresPermissions("power_detail") |
| | | @ApiOperation(value = "账号详情", tags = {"后台-权限管理-账号管理"}) |
| | | @GetMapping(value = "/detail") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param sysUserRequest 账号信息 |
| | | */ |
| | | @RequiresPermissions("power_save") |
| | | @ApiOperation(value = "新增账号", tags = {"后台-权限管理-账号管理"}) |
| | | @PostMapping(value = "/save") |
| | | public R<String> save(@RequestBody @Validated SysUserRequest sysUserRequest) { |
| | |
| | | * |
| | | * @param sysUserRequest 账号信息 |
| | | */ |
| | | @RequiresPermissions("power_update") |
| | | @ApiOperation(value = "修改账号", tags = {"后台-权限管理-账号管理"}) |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody SysUserRequest sysUserRequest) { |
| | |
| | | } |
| | | SysUser user = sysUserService.lambdaQuery() |
| | | .eq(SysUser::getAccount, sysUserRequest.getAccount()) |
| | | .eq(SysUser::getIsDelete, 0).one(); |
| | | .eq(SysUser::getIsDelete, 0) |
| | | .ne(SysUser::getUserId, sysUserRequest.getUserId()).one(); |
| | | if (null != user) { |
| | | return R.fail("该账号已存在!"); |
| | | } |
| | |
| | | return R.fail("新密码与二次确认密码不一致,请重新输入!"); |
| | | } |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | if (!passwordEncoder.matches(newPassword, oldPassword)) { |
| | | if (!passwordEncoder.matches(oldPassword, user.getPassword())) { |
| | | return R.fail("原密码错误,请重试!"); |
| | | } |
| | | // 校验通过,加密新的明文密码 |
| | |
| | | * |
| | | * @param ids 账号id拼接 |
| | | */ |
| | | @RequiresPermissions("power_delete") |
| | | @ApiOperation(value = "批量删除账号", tags = {"后台-权限管理-账号管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |