deason 8 сар өмнө
parent
commit
0f0aeca33f

+ 23 - 0
src/main/java/com/qmth/exam/reserve/bean/user/RoleVO.java

@@ -0,0 +1,23 @@
+package com.qmth.exam.reserve.bean.user;
+
+import com.qmth.exam.reserve.bean.IModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class RoleVO implements IModel {
+
+    private static final long serialVersionUID = 7223137192010228393L;
+
+    @ApiModelProperty(value = "角色代码")
+    private String roleCode;
+
+    @ApiModelProperty(value = "角色名称")
+    private String roleName;
+
+    @ApiModelProperty(value = "是否隐藏")
+    private Boolean hidden;
+
+}

+ 44 - 0
src/main/java/com/qmth/exam/reserve/controller/admin/RoleController.java

@@ -0,0 +1,44 @@
+package com.qmth.exam.reserve.controller.admin;
+
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.exam.reserve.bean.user.RoleVO;
+import com.qmth.exam.reserve.controller.BaseController;
+import com.qmth.exam.reserve.enums.Role;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@Api(tags = "【管理端】角色相关接口")
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/admin/role")
+@Aac(strict = false, auth = true)
+public class RoleController extends BaseController {
+
+    private static final Logger log = LoggerFactory.getLogger(RoleController.class);
+
+    @ApiOperation(value = "角色列表")
+    @PostMapping(value = "/list")
+    public List<RoleVO> list() {
+        List<RoleVO> roles = new ArrayList<>();
+        for (Role role : Role.values()) {
+            RoleVO vo = new RoleVO();
+            vo.setRoleCode(role.name());
+            vo.setRoleName(role.getTitle());
+            vo.setHidden(true);
+            if (Role.ADMIN == role || Role.TEACHING == role) {
+                vo.setHidden(false);
+            }
+            roles.add(vo);
+        }
+        return roles;
+    }
+
+}

+ 0 - 2
src/main/java/com/qmth/exam/reserve/enums/Role.java

@@ -6,8 +6,6 @@ public enum Role {
 
     ADMIN("学校管理员"),
 
-    HEAD_ADMIN("总部管理员"),
-
     TEACHING("教学点管理员"),
 
     STUDENT("学生");