|
@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
@@ -106,7 +107,7 @@ public class PrivilegeController extends ControllerSupport {
|
|
if (null == parentPrivilege) {
|
|
if (null == parentPrivilege) {
|
|
throw new StatusException("B-020002", "父权限不存在");
|
|
throw new StatusException("B-020002", "父权限不存在");
|
|
}
|
|
}
|
|
- if (parentPrivilege.getGroupId().equals(privilege.getGroupId())) {
|
|
|
|
|
|
+ if (!parentPrivilege.getGroupId().equals(privilege.getGroupId())) {
|
|
throw new StatusException("B-020003", "权限组错误");
|
|
throw new StatusException("B-020003", "权限组错误");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -150,6 +151,11 @@ public class PrivilegeController extends ControllerSupport {
|
|
if (null == privilege) {
|
|
if (null == privilege) {
|
|
throw new StatusException("B-020004", "权限不存在");
|
|
throw new StatusException("B-020004", "权限不存在");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ List<Privilege> children = privilegeRepo.findAllByParentId(privilege.getId());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(children)) {
|
|
|
|
+ throw new StatusException("B-020005", "存在子权限");
|
|
|
|
+ }
|
|
privilegeRepo.delete(id);
|
|
privilegeRepo.delete(id);
|
|
}
|
|
}
|
|
|
|
|