修改用户权限
This commit is contained in:
parent
26cb8ea28d
commit
eab4f86a83
@ -139,4 +139,15 @@ public class RoleController {
|
|||||||
}
|
}
|
||||||
return roleService.addRole(request, roleAddVO);
|
return roleService.addRole(request, roleAddVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("role/user/change")
|
||||||
|
public BaseResponse roleChangeUser(HttpServletRequest request, @RequestParam Long uid, @RequestParam Long rid) {
|
||||||
|
log.info("请求接口[POST]: /role/user/change");
|
||||||
|
// 判断是否有参数错误
|
||||||
|
if (uid == null || rid == null) {
|
||||||
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
|
}
|
||||||
|
return roleService.roleChangeUser(request, uid, rid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,5 +53,7 @@ public class RoleDAO {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean roleChangeUser(Long uid, Long rid) {
|
||||||
|
return roleMapper.roleChangeUser(uid,rid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,12 @@ public interface RoleMapper {
|
|||||||
@Update("UPDATE organize_oa.oa_role SET role_name=#{roleName},display_name=#{displayName} WHERE id=#{id}")
|
@Update("UPDATE organize_oa.oa_role SET role_name=#{roleName},display_name=#{displayName} WHERE id=#{id}")
|
||||||
boolean roleEdit(RoleDO getRole);
|
boolean roleEdit(RoleDO getRole);
|
||||||
|
|
||||||
|
@Update("UPDATE organize_oa.oa_role_user SET rid = #{rid} WHERE uid = #{uid}")
|
||||||
|
boolean roleChangeUser(Long uid, Long rid);
|
||||||
|
|
||||||
@Delete("DELETE FROM organize_oa.oa_role WHERE id=#{id}")
|
@Delete("DELETE FROM organize_oa.oa_role WHERE id=#{id}")
|
||||||
boolean roleDelete(Long id);
|
boolean roleDelete(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,6 @@ public interface RoleService {
|
|||||||
BaseResponse roleDelete(HttpServletRequest request, Long id);
|
BaseResponse roleDelete(HttpServletRequest request, Long id);
|
||||||
|
|
||||||
BaseResponse addRole(HttpServletRequest request, RoleAddVo roleAddVO);
|
BaseResponse addRole(HttpServletRequest request, RoleAddVo roleAddVO);
|
||||||
|
|
||||||
|
BaseResponse roleChangeUser(HttpServletRequest request, Long uid, Long rid);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,16 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse roleChangeUser(HttpServletRequest request, Long uid, Long rid) {
|
||||||
|
if (Processing.checkUserIsAdmin(request, roleDAO.roleMapper)) {
|
||||||
|
if(!roleDAO.roleChangeUser(uid, rid)){
|
||||||
|
return ResultUtil.error(ErrorCode.DATABASE_UPDATE_ERROR);
|
||||||
|
}
|
||||||
|
return ResultUtil.success();
|
||||||
|
} else return ResultUtil.error(ErrorCode.NOT_ADMIN);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResponse roleGet(HttpServletRequest request, String id) {
|
public BaseResponse roleGet(HttpServletRequest request, String id) {
|
||||||
// 检查用户权限
|
// 检查用户权限
|
||||||
@ -132,4 +142,6 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
|
|
||||||
return ResultUtil.success();
|
return ResultUtil.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user