|
@@ -5,10 +5,12 @@ import java.util.List;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
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.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.core.basic.api.RolePrivilegeCloudService;
|
|
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.bean.RoleBean;
|
|
@@ -48,10 +50,16 @@ public class RolePrivilegeCloudServiceProvider extends ControllerSupport
|
|
@ApiOperation(value = "查询所有角色", notes = "")
|
|
@ApiOperation(value = "查询所有角色", notes = "")
|
|
@PostMapping("getAllRoles")
|
|
@PostMapping("getAllRoles")
|
|
@Override
|
|
@Override
|
|
- public List<RoleBean> getAllRoles() {
|
|
|
|
|
|
+ public List<RoleBean> getAllRoles(@RequestParam Boolean withSuperAdmin) {
|
|
List<cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity> roleList = roleRepo.findAll();
|
|
List<cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity> roleList = roleRepo.findAll();
|
|
List<RoleBean> roleBeanList = Lists.newArrayList();
|
|
List<RoleBean> roleBeanList = Lists.newArrayList();
|
|
|
|
+
|
|
for (cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity cur : roleList) {
|
|
for (cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity cur : roleList) {
|
|
|
|
+
|
|
|
|
+ if ((!withSuperAdmin) && cur.getCode().equals(RoleMeta.SUPER_ADMIN.getCode())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
RoleBean bean = new RoleBean();
|
|
RoleBean bean = new RoleBean();
|
|
bean.setRoleId(cur.getId());
|
|
bean.setRoleId(cur.getId());
|
|
bean.setRoleName(cur.getName());
|
|
bean.setRoleName(cur.getName());
|