|
@@ -0,0 +1,66 @@
|
|
|
+package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
|
+
|
|
|
+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.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+
|
|
|
+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.entity.App;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeGroup;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 权限
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @date 2018年6月12日
|
|
|
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("${app.api.root}/privilege")
|
|
|
+public class PrivilegeController extends ControllerSupport {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ AppRepo appRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PrivilegeGroupRepo privilegeGroupRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ OrgRepo orgRepo;
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询权限组")
|
|
|
+ @GetMapping("getPrivilegeGroupList")
|
|
|
+ public List<PrivilegeGroupBean> getPrivilegeGroupList() {
|
|
|
+ Sort sort = new Sort(Sort.Direction.ASC, "id");
|
|
|
+ List<PrivilegeGroup> list = privilegeGroupRepo.findAll(sort);
|
|
|
+
|
|
|
+ List<PrivilegeGroupBean> ret = Lists.newArrayList();
|
|
|
+
|
|
|
+ for (PrivilegeGroup cur : list) {
|
|
|
+ PrivilegeGroupBean bean = new PrivilegeGroupBean();
|
|
|
+ bean.setId(cur.getId());
|
|
|
+ bean.setAppId(cur.getAppId());
|
|
|
+ App app = appRepo.findOne(cur.getAppId());
|
|
|
+ if (null != app) {
|
|
|
+ bean.setAppName(app.getName());
|
|
|
+ }
|
|
|
+ bean.setCode(cur.getCode());
|
|
|
+ bean.setName(cur.getName());
|
|
|
+
|
|
|
+ ret.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+}
|