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