|
@@ -1,23 +1,32 @@
|
|
|
package cn.com.qmth.examcloud.core.basic.api.provider;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
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.RolePrivilegeCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.RoleBean;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.DeleteRoleReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetPrivilegeListReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.SaveRoleReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.DeleteRoleResp;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetPrivilegeListResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.SaveRoleResp;
|
|
|
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.RolePrivilegeRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.RolePrivilegeService;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.RoleInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -56,6 +65,7 @@ public class RolePrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
RolePrivilegeService rolePrivilegeService;
|
|
|
|
|
|
@ApiOperation(value = "添加角色")
|
|
|
+ @PostMapping("saveRole")
|
|
|
@Override
|
|
|
public SaveRoleResp saveRole(@RequestBody SaveRoleReq req) {
|
|
|
RoleInfo info = new RoleInfo();
|
|
@@ -76,6 +86,7 @@ public class RolePrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "删除角色")
|
|
|
+ @PostMapping("deleteRole")
|
|
|
@Override
|
|
|
public DeleteRoleResp deleteRole(@RequestBody DeleteRoleReq req) {
|
|
|
RoleInfo info = new RoleInfo();
|
|
@@ -96,4 +107,26 @@ public class RolePrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "查询权限集合")
|
|
|
+ @PostMapping("getPrivilegeList")
|
|
|
+ @Override
|
|
|
+ public GetPrivilegeListResp getPrivilegeList(@RequestBody GetPrivilegeListReq req) {
|
|
|
+
|
|
|
+ Long roleId = req.getRoleId();
|
|
|
+
|
|
|
+ List<RolePrivilegeRelationEntity> relationList = rolePrivilegeRelationRepo
|
|
|
+ .findAllByRoleId(roleId);
|
|
|
+
|
|
|
+ List<String> privilegeCodeList = Lists.newArrayList();
|
|
|
+ for (RolePrivilegeRelationEntity cur : relationList) {
|
|
|
+
|
|
|
+ PrivilegeEntity privilegeEntity = privilegeRepo.findOne(cur.getPrivilegeId());
|
|
|
+ privilegeCodeList.add(privilegeEntity.getCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ GetPrivilegeListResp resp = new GetPrivilegeListResp();
|
|
|
+ resp.setPrivilegeCodeList(privilegeCodeList);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
}
|