|
@@ -16,8 +16,9 @@ import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.commons.web.security.bean.Role;
|
|
|
import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.PrivilegeCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.RolePrivilegeCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.PrivilegeInfo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.RoleBean;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetPrivilegesReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetPrivilegesResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
|
|
@@ -37,10 +38,10 @@ import io.swagger.annotations.ApiOperation;
|
|
|
* @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
*/
|
|
|
@RestController
|
|
|
-@RequestMapping("${$rmp}" + "privilege")
|
|
|
-public class PrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
+@RequestMapping("${$rmp}" + "rolePrivilege")
|
|
|
+public class RolePrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
implements
|
|
|
- PrivilegeCloudService {
|
|
|
+ RolePrivilegeCloudService {
|
|
|
|
|
|
private static final long serialVersionUID = -4360164791713797878L;
|
|
|
|
|
@@ -73,7 +74,7 @@ public class PrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
List<Long> roleIdList = Lists.newArrayList();
|
|
|
for (Role cur : roleList) {
|
|
|
String roleCode = cur.getRoleCode();
|
|
|
- cn.com.qmth.examcloud.core.basic.dao.entity.Role role = roleRepo.findBycode(roleCode);
|
|
|
+ cn.com.qmth.examcloud.core.basic.dao.entity.Role role = roleRepo.findByCode(roleCode);
|
|
|
if (null == role) {
|
|
|
throw new StatusException("B-002002", "role code is wrong. roleCode=" + roleCode);
|
|
|
}
|
|
@@ -125,4 +126,22 @@ public class PrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "查询所有角色", notes = "")
|
|
|
+ @PostMapping("getAllRoles")
|
|
|
+ @Override
|
|
|
+ public List<RoleBean> getAllRoles() {
|
|
|
+ List<cn.com.qmth.examcloud.core.basic.dao.entity.Role> roleList = roleRepo.findAll();
|
|
|
+ List<RoleBean> roleBeanList = Lists.newArrayList();
|
|
|
+ for (cn.com.qmth.examcloud.core.basic.dao.entity.Role cur : roleList) {
|
|
|
+ RoleBean bean = new RoleBean();
|
|
|
+ bean.setRoleId(cur.getId());
|
|
|
+ bean.setRoleName(cur.getName());
|
|
|
+ bean.setRoleCode(cur.getCode());
|
|
|
+
|
|
|
+ roleBeanList.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ return roleBeanList;
|
|
|
+ }
|
|
|
+
|
|
|
}
|