Browse Source

Merge remote-tracking branch 'origin/master'

master
liuxinxin 1 year ago
parent
commit
aa0bdcb269
5 changed files with 30 additions and 11 deletions
  1. +3
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java
  2. +6
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java
  3. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java
  4. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java
  5. +3
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java

+ 3
- 2
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java View File

@@ -61,8 +61,9 @@ public class NoticeController {

@GetMapping("/dashboard/list")
@ApiOperation("工作台公告列表")
public PageVo<NoticeListItemVO> dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit) {
return noticeManage.dashboardList(limit);
public PageVo<NoticeListItemVO> dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit,
@RequestParam(required = false) Integer type) {
return noticeManage.dashboardList(limit, type);
}

@GetMapping("/manage/list")


+ 6
- 3
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java View File

@@ -5,12 +5,13 @@ import cn.hutool.core.lang.Assert;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.req.RolePageReq;
import com.ningdatech.pmapi.sys.manage.RoleManage;
import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO;
import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO;
import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.req.RolePageReq;
import com.ningdatech.pmapi.sys.model.vo.RoleVO;
import com.ningdatech.pmapi.sys.manage.RoleManage;
import com.ningdatech.pmapi.sys.service.IRoleService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import io.swagger.annotations.Api;
@@ -62,6 +63,8 @@ public class RoleController {
Assert.notNull(role, "角色不存在");
RoleVO query = BeanUtil.toBean(role, RoleVO.class);
query.setManageRoleIdList(BizUtils.splitToLong(role.getManageRoleIds()));
List<MenuDataScopeDTO> menuDataScope = roleManage.getMenuDataScope(id);
query.setMenuDataScopeList(menuDataScope);
// 菜单
roleManage.buildMenu(query);
return query;


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java View File

@@ -73,10 +73,11 @@ public class NoticeManage {
}


public PageVo<NoticeListItemVO> dashboardList(Integer limit) {
public PageVo<NoticeListItemVO> dashboardList(Integer limit, Integer type) {
NoticeListReq req = new NoticeListReq();
req.setPageSize(limit);
req.setEnabled(true);
req.setType(type);
return listByManager(req);
}



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

@@ -6,13 +6,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO;
import com.ningdatech.pmapi.sys.model.entity.Menu;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.entity.RoleMenu;
import com.ningdatech.pmapi.sys.model.entity.RoleMenuDatascope;
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.IMenuService;
import com.ningdatech.pmapi.sys.service.IRoleMenuDatascopeService;
import com.ningdatech.pmapi.sys.service.IRoleMenuService;
import com.ningdatech.pmapi.sys.service.IRoleService;
import lombok.RequiredArgsConstructor;
@@ -38,6 +41,7 @@ public class RoleManage {
private final IRoleService roleService;
private final IMenuService menuService;
private final IRoleMenuService roleMenuService;
private final IRoleMenuDatascopeService roleMenuDatascopeService;

public PageVo<RoleVO> queryList(RolePageReq rolePageReq) {
Page<Role> page = rolePageReq.page();
@@ -71,4 +75,16 @@ public class RoleManage {
query.setMenu(menus);
}

public List<MenuDataScopeDTO> getMenuDataScope(Long roleId) {
LambdaQueryWrapper<RoleMenuDatascope> query = Wrappers.lambdaQuery(RoleMenuDatascope.class)
.eq(RoleMenuDatascope::getRoleId, roleId);
List<RoleMenuDatascope> menuDataScopes = roleMenuDatascopeService.list(query);
return CollUtils.convert(menuDataScopes, w -> {
MenuDataScopeDTO dto = new MenuDataScopeDTO();
dto.setDataScope(w.getDatascope());
dto.setMenuId(w.getMenuId());
return dto;
});
}

}

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

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.sys.model.vo;

import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO;
import com.ningdatech.pmapi.sys.model.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -49,11 +50,8 @@ public class RoleVO extends BaseEntity {
@ApiModelProperty("是否是内置角色:true 是、false 否")
private Boolean fixed;

/**
* 数据范围
*/
@ApiModelProperty(value = "数据范围 1全部 2本区域 3本区域以及下区域 4本公司")
private Integer dataScope;
@ApiModelProperty("菜单数据权限")
private List<MenuDataScopeDTO> menuDataScopeList;

/**
* 菜单


Loading…
Cancel
Save