Browse Source

增加是否内置角色字段

master
WendyYang 1 year ago
parent
commit
7a24ff6b1d
4 changed files with 17 additions and 9 deletions
  1. +8
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java
  2. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Role.java
  3. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/RolePageReq.java
  4. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java

+ 8
- 8
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java View File

@@ -12,8 +12,8 @@ import com.ningdatech.pmapi.sys.model.entity.RoleMenu;
import com.ningdatech.pmapi.sys.model.req.RolePageReq;
import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO;
import com.ningdatech.pmapi.sys.model.vo.RoleVO;
import com.ningdatech.pmapi.sys.service.IRoleMenuService;
import com.ningdatech.pmapi.sys.service.IMenuService;
import com.ningdatech.pmapi.sys.service.IRoleMenuService;
import com.ningdatech.pmapi.sys.service.IRoleService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
@@ -35,9 +35,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class RoleManage {

private final IRoleService IRoleService;
private final IMenuService IMenuService;

private final IRoleService roleService;
private final IMenuService menuService;
private final IRoleMenuService roleMenuService;

public PageVo<RoleVO> queryList(RolePageReq rolePageReq) {
@@ -48,16 +47,17 @@ public class RoleManage {
return PageVo.of(data, page.getTotal());
}

private void searchList(Page<Role> page, LambdaQueryWrapper<Role> wrapper, RolePageReq rolePageReq) {
wrapper.like(StringUtils.isNotBlank(rolePageReq.getName()), Role::getName, rolePageReq.getName())
private void searchList(Page<Role> page, LambdaQueryWrapper<Role> wrapper, RolePageReq req) {
wrapper.like(StringUtils.isNotBlank(req.getName()), Role::getName, req.getName())
.eq(req.getFixed() != null, Role::getFixed, req.getFixed())
.orderByDesc(Role::getUpdateOn);
IRoleService.page(page, wrapper);
roleService.page(page, wrapper);
}


public void buildMenu(RoleVO query) {
//改成直接返回有权限的
List<Menu> list = IMenuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort));
List<Menu> list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort));
List<RoleMenu> roleMenus = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class)
.eq(RoleMenu::getRoleId, query.getId()));
List<MenuRoleVO> menus = list.stream().map(menu -> {


+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Role.java View File

@@ -29,7 +29,7 @@ public class Role extends BaseEntity {

private static final long serialVersionUID = 1L;

@TableId(value = "id",type = IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty(value = "名称")
@@ -38,6 +38,8 @@ public class Role extends BaseEntity {
@ApiModelProperty("角色编码")
private String code;

@ApiModelProperty("是否是内置角色")
private Boolean fixed;

@ApiModelProperty(value = "描述")
private String describe;


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/RolePageReq.java View File

@@ -34,4 +34,7 @@ public class RolePageReq extends PagePo implements Serializable {
@ApiModelProperty(value = "名称")
private String name;

@ApiModelProperty("是否是内置角色")
private Boolean fixed;

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java View File

@@ -43,6 +43,9 @@ public class RoleVO extends BaseEntity {
@ApiModelProperty(value = "描述")
private String describe;

@ApiModelProperty("是否是内置角色:true 是、false 否")
private Boolean fixed;

/**
* 数据范围
*/


Loading…
Cancel
Save