Commit 9bb908d97049121d94446ce4ee876a8d7dafec92
1 parent
29583e0f9f
Exists in
master
and in
1 other branch
bug fix
Showing 1 changed file with 11 additions and 10 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
9bb908d
... | ... | @@ -272,6 +272,17 @@ |
272 | 272 | return; |
273 | 273 | } |
274 | 274 | |
275 | + //如果有数据不能删除 | |
276 | + UserRoleMapsQuery userRoleMapsQuery = new UserRoleMapsQuery(); | |
277 | + userRoleMapsQuery.setRoleId(id); | |
278 | + userRoleMapsQuery.setYn(YnEnums.YES.getId()); | |
279 | + Integer count = userRoleMapsService.queryUserRoleMapsCount(userRoleMapsQuery); | |
280 | + if(count > 0) { | |
281 | + ResultUtils.buildParameterErrorResultAndWrite(response, "该角色下有用户数据,不能删除"); | |
282 | + return; | |
283 | + } | |
284 | + | |
285 | + | |
275 | 286 | Roles roles = rolesService.getRoles(id); |
276 | 287 | if (roles == null) { |
277 | 288 | ResultUtils.buildIdResultData(response); |
... | ... | @@ -282,16 +293,6 @@ |
282 | 293 | roles.setModified(new Date()); |
283 | 294 | rolesService.updateRoles(roles); |
284 | 295 | |
285 | - | |
286 | - //如果有数据不能删除 | |
287 | - UserRoleMapsQuery userRoleMapsQuery = new UserRoleMapsQuery(); | |
288 | - userRoleMapsQuery.setRoleId(id); | |
289 | - userRoleMapsQuery.setYn(YnEnums.YES.getId()); | |
290 | - Integer count = userRoleMapsService.queryUserRoleMapsCount(userRoleMapsQuery); | |
291 | - if(count > 0) { | |
292 | - ResultUtils.buildParameterErrorResultAndWrite(response, "该角色下有用户数据,不能删除"); | |
293 | - return; | |
294 | - } | |
295 | 296 | |
296 | 297 | //角色权限设置为无效 |
297 | 298 | RolePermissionMapsQuery rolePermissionMapsQuery = new RolePermissionMapsQuery(); |