feat;增加角色模块
This commit is contained in:
@@ -19,6 +19,7 @@ tiesheng:
|
||||
test-map:
|
||||
"1111":
|
||||
id: "1111"
|
||||
role-id: "student_bks"
|
||||
global:
|
||||
version: 2
|
||||
host: http://localhost:8100
|
||||
|
||||
@@ -25,6 +25,7 @@ import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/role")
|
||||
@@ -243,10 +244,15 @@ public class RoleController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/owner/server")
|
||||
public ApiResp<List<CoreRoleAuthority>> ownerServer() {
|
||||
public ApiResp<List<CoreRoleServer>> ownerServer() {
|
||||
TokenBean tokenBean = TsTokenConfig.get();
|
||||
List<CoreRoleAuthority> allOwnerMenus = coreRoleService.getAllOwnerMenus(tokenBean.getId(), tokenBean.getRoleId());
|
||||
return ApiResp.respOK(allOwnerMenus);
|
||||
|
||||
List<CoreRoleServer> roleServerList = coreServerService.list(new QueryWrapper<CoreRoleServer>()
|
||||
.in("id", allOwnerMenus.stream().map(CoreRoleAuthority::getService).collect(Collectors.toList()))
|
||||
);
|
||||
|
||||
return ApiResp.respOK(roleServerList);
|
||||
}
|
||||
|
||||
|
||||
@@ -259,6 +265,7 @@ public class RoleController {
|
||||
public ApiResp<String> ownerMenu(@Valid ServiceDTO dto) {
|
||||
|
||||
|
||||
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
@@ -268,10 +275,23 @@ public class RoleController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/owner/point")
|
||||
public ApiResp<String> ownerPoint(@Valid OwerPointDTO dto) {
|
||||
public ApiResp<List<CoreRoleAuthority>> ownerPoint(@Valid OwerPointDTO dto) {
|
||||
|
||||
TokenBean tokenBean = TsTokenConfig.get();
|
||||
List<CoreRoleAuthority> allOwnerMenus = coreRoleService.getAllOwnerMenus(tokenBean.getId(), tokenBean.getRoleId());
|
||||
|
||||
return ApiResp.respOK("");
|
||||
List<CoreRoleAuthority> collect = allOwnerMenus.stream()
|
||||
.filter(it -> Objects.equals(it.getType(), "point"))
|
||||
.filter(it -> it.getService().equals(dto.getService()))
|
||||
.filter(it -> it.getPlatform().equals(dto.getPlatform()))
|
||||
.filter(it -> {
|
||||
if (StrUtil.isNotEmpty(dto.getParent())) {
|
||||
return dto.getParent().equals(it.getParent());
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return ApiResp.respOK(collect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.tiesheng.role.pojos.dto;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
public class OwerPointDTO extends ServiceDTO {
|
||||
|
||||
private String parent;
|
||||
|
||||
@NotEmpty(message = "请选择一个平台")
|
||||
private String platform;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -15,4 +20,12 @@ public class OwerPointDTO extends ServiceDTO {
|
||||
public void setParent(String parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user