|
|
@@ -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; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |