|
@@ -5,17 +5,22 @@ import java.util.List;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.web.helpers.tree.EleTreeNode;
|
|
|
+import cn.com.qmth.examcloud.commons.web.helpers.tree.TreeUtil;
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.PrivilegeGroupBean;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.AppRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.App;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.Privilege;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeGroup;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
@@ -36,6 +41,9 @@ public class PrivilegeController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
PrivilegeGroupRepo privilegeGroupRepo;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ PrivilegeRepo privilegeRepo;
|
|
|
+
|
|
|
@Autowired
|
|
|
OrgRepo orgRepo;
|
|
|
|
|
@@ -63,4 +71,15 @@ public class PrivilegeController extends ControllerSupport {
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询权限树")
|
|
|
+ @GetMapping("getPrivilegeTree/{groupId}")
|
|
|
+ public EleTreeNode getPrivilegeTree(@PathVariable Long groupId) {
|
|
|
+ PrivilegeGroup group = privilegeGroupRepo.findOne(groupId);
|
|
|
+ List<Privilege> privilegeList = privilegeRepo.findAllByGroupId(groupId);
|
|
|
+ EleTreeNode rootNode = new EleTreeNode(-1L, group.getName());
|
|
|
+ TreeUtil.convert2OneEleTreeNode(rootNode, privilegeList);
|
|
|
+
|
|
|
+ return rootNode;
|
|
|
+ }
|
|
|
}
|