Commit 700b82d2a85191d3e4201fd092b80329f42cd05a
1 parent
276e68c1f2
Exists in
master
and in
1 other branch
增加判断
Showing 1 changed file with 13 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
700b82d
... | ... | @@ -240,6 +240,19 @@ |
240 | 240 | new BusinessException("", "角色信息不存在."); |
241 | 241 | return; |
242 | 242 | } |
243 | + //如果是禁用,再判断状态是否一样 | |
244 | + if ("2".equals(enable+"")&&!enable.equals(roles.getEnable())){ | |
245 | + //如果有数据不能删除 | |
246 | + UserRoleMapsQuery userRoleMapsQuery = new UserRoleMapsQuery(); | |
247 | + userRoleMapsQuery.setRoleId(id); | |
248 | + userRoleMapsQuery.setYn(YnEnums.YES.getId()); | |
249 | + Integer count = userRoleMapsService.queryUserRoleMapsCount(userRoleMapsQuery); | |
250 | + if(count > 0) { | |
251 | + ResultUtils.buildParameterErrorResultAndWrite(response, "该角色下有用户数据,不能删除"); | |
252 | + return; | |
253 | + } | |
254 | + } | |
255 | + | |
243 | 256 | |
244 | 257 | if (!roles.getName().equals(name)) { |
245 | 258 | RolesQuery rolesQuery = new RolesQuery(); |