|
@@ -1,16 +1,15 @@
|
|
|
package com.chelvc.cloud.admin.controller;
|
|
|
|
|
|
+import java.util.List;
|
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.constraints.Min;
|
|
|
|
|
|
import com.chelvc.cloud.uc.api.dto.RoleDTO;
|
|
|
import com.chelvc.cloud.uc.api.dto.RoleDetailDTO;
|
|
|
-import com.chelvc.cloud.uc.api.param.PermissionModifyParam;
|
|
|
import com.chelvc.cloud.uc.api.param.RoleModifyParam;
|
|
|
import com.chelvc.cloud.uc.api.param.RolePagingParam;
|
|
|
import com.chelvc.cloud.uc.api.service.RoleService;
|
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
-import com.chelvc.framework.base.util.ResourceUtils;
|
|
|
import com.chelvc.framework.common.model.Pagination;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -22,8 +21,6 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* 角色接口
|
|
|
*
|
|
@@ -33,7 +30,6 @@ import java.util.List;
|
|
|
@Validated
|
|
|
@RestController
|
|
|
@ResponseWrapping
|
|
|
-@PreAuthorize("isScope('EMPLOYEE')")
|
|
|
public class RoleController {
|
|
|
@DubboReference
|
|
|
private RoleService roleService;
|
|
@@ -61,38 +57,25 @@ public class RoleController {
|
|
|
this.roleService.updateRole(id, param);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 修改角色权限
|
|
|
- *
|
|
|
- * @param id 角色主键
|
|
|
- * @param param 修改参数
|
|
|
- */
|
|
|
- @PutMapping("/role/{id}/permission")
|
|
|
- public void updateRolePermission(@PathVariable("id") @Min(value = 1, message = "角色主键不能小于1") Long id,
|
|
|
- @RequestBody @Valid PermissionModifyParam param) {
|
|
|
- this.roleService.updateRolePermission(id, param);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取角色信息
|
|
|
*
|
|
|
* @param id 角色主键
|
|
|
* @return 角色信息
|
|
|
*/
|
|
|
- @GetMapping("/role/{id}")
|
|
|
- public RoleDTO getRole(@PathVariable("id") @Min(value = 1, message = "角色主键不能小于1") Long id) {
|
|
|
- return ResourceUtils.required(this.roleService.getRole(id), "角色不存在");
|
|
|
+ @GetMapping("/role/{id}/detail")
|
|
|
+ public RoleDetailDTO getRoleDetail(@PathVariable("id") @Min(value = 1, message = "角色主键不能小于1") Long id) {
|
|
|
+ return this.roleService.getRoleDetail(id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取角色详细信息
|
|
|
+ * 获取启用角色列表
|
|
|
*
|
|
|
- * @param id 角色主键
|
|
|
- * @return 角色信息
|
|
|
+ * @return 角色列表信息
|
|
|
*/
|
|
|
- @GetMapping("/role/{id}/detail")
|
|
|
- public RoleDetailDTO getRoleDetail(@PathVariable("id") @Min(value = 1, message = "角色主键不能小于1") Long id) {
|
|
|
- return ResourceUtils.required(this.roleService.getRoleDetail(id), "角色不存在");
|
|
|
+ @GetMapping("/role/enables")
|
|
|
+ public List<RoleDTO> listEnableRoles() {
|
|
|
+ return this.roleService.listEnableRoles();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -105,14 +88,4 @@ public class RoleController {
|
|
|
public Pagination<RoleDTO> getRolePaging(@Valid RolePagingParam param) {
|
|
|
return this.roleService.getRolePaging(param);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询角色列表
|
|
|
- *
|
|
|
- * @return 角色列表信息
|
|
|
- */
|
|
|
- @GetMapping("/role/list")
|
|
|
- public List<RoleDTO> listRoles() {
|
|
|
- return this.roleService.listRoles();
|
|
|
- }
|
|
|
}
|