|
@@ -1,25 +1,16 @@
|
|
|
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.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-
|
|
|
-import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
|
|
|
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.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 io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
/**
|
|
|
* 角色权限服务
|
|
@@ -49,28 +40,4 @@ public class RolePrivilegeCloudServiceProvider extends ControllerSupport
|
|
|
@Autowired
|
|
|
PrivilegeGroupRepo privilegeGroupRepo;
|
|
|
|
|
|
- @ApiOperation(value = "查询所有角色", notes = "")
|
|
|
- @PostMapping("getAllRoles")
|
|
|
- @Override
|
|
|
- public List<RoleBean> getAllRoles(@RequestParam Boolean withSuperAdmin) {
|
|
|
- List<cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity> roleList = roleRepo.findAll();
|
|
|
- List<RoleBean> roleBeanList = Lists.newArrayList();
|
|
|
-
|
|
|
- for (cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity cur : roleList) {
|
|
|
-
|
|
|
- if ((!withSuperAdmin) && cur.getCode().equals(RoleMeta.SUPER_ADMIN.name())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- RoleBean bean = new RoleBean();
|
|
|
- bean.setRoleId(cur.getId());
|
|
|
- bean.setRoleName(cur.getName());
|
|
|
- bean.setRoleCode(cur.getCode());
|
|
|
-
|
|
|
- roleBeanList.add(bean);
|
|
|
- }
|
|
|
-
|
|
|
- return roleBeanList;
|
|
|
- }
|
|
|
-
|
|
|
}
|