字典及菜单模块联调
This commit is contained in:
parent
d75e6cc9ca
commit
6981bf525e
@ -108,7 +108,6 @@ public class AuthController {
|
|||||||
Set<Long> menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId));
|
Set<Long> menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId));
|
||||||
List<MenuDO> menuList = menuService.getMenuList(menuIds);
|
List<MenuDO> menuList = menuService.getMenuList(menuIds);
|
||||||
menuList = menuService.filterDisableMenus(menuList);
|
menuList = menuService.filterDisableMenus(menuList);
|
||||||
|
|
||||||
// 2. 拼接结果返回
|
// 2. 拼接结果返回
|
||||||
return success(AuthConvert.INSTANCE.convert(user, roles, menuList));
|
return success(AuthConvert.INSTANCE.convert(user, roles, menuList));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cd.casic.module.system.controller.admin.auth.vo;
|
package cd.casic.module.system.controller.admin.auth.vo;
|
||||||
|
|
||||||
|
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@ -88,6 +89,34 @@ public class AuthPermissionInfoRespVO {
|
|||||||
@Schema(description = "是否总是显示", example = "false")
|
@Schema(description = "是否总是显示", example = "false")
|
||||||
private Boolean alwaysShow;
|
private Boolean alwaysShow;
|
||||||
|
|
||||||
|
@Schema(description = "是否显示子菜单", example = "false")
|
||||||
|
private Boolean showChildren;
|
||||||
|
|
||||||
|
@Schema(description = "当前激活目录", example = "/sys-conf/job")
|
||||||
|
private String currentActiveMenu;
|
||||||
|
|
||||||
|
@Schema(description = "外部站点地址", example = "/sys-conf/job")
|
||||||
|
private String frameSrc;
|
||||||
|
/**
|
||||||
|
* 目录分组
|
||||||
|
*/
|
||||||
|
@Schema(description = "目录分组", example = "3")
|
||||||
|
private String menuGroup;
|
||||||
|
|
||||||
|
@Schema(description = "目录重定向", example = "/sys-conf/job")
|
||||||
|
private String redirect;
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "isTag", example = "1")
|
||||||
|
private Boolean isTag;
|
||||||
|
@Schema(description = "tagDot", example = "1")
|
||||||
|
private Boolean tagDot;
|
||||||
|
@Schema(description = "tagType", example = "1")
|
||||||
|
private String tagType;
|
||||||
|
@Schema(description = "tagContent", example = "1")
|
||||||
|
private String tagContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子路由
|
* 子路由
|
||||||
*/
|
*/
|
||||||
|
@ -7,10 +7,7 @@ import cd.casic.framework.commons.pojo.PageParam;
|
|||||||
import cd.casic.framework.commons.pojo.PageResult;
|
import cd.casic.framework.commons.pojo.PageResult;
|
||||||
import cd.casic.framework.commons.util.object.BeanUtils;
|
import cd.casic.framework.commons.util.object.BeanUtils;
|
||||||
import cd.casic.framework.excel.excel.core.util.ExcelUtils;
|
import cd.casic.framework.excel.excel.core.util.ExcelUtils;
|
||||||
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataPageReqVO;
|
import cd.casic.module.system.controller.admin.dict.vo.data.*;
|
||||||
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataRespVO;
|
|
||||||
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
|
|
||||||
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
|
||||||
import cd.casic.module.system.dal.dataobject.dict.DictDataDO;
|
import cd.casic.module.system.dal.dataobject.dict.DictDataDO;
|
||||||
import cd.casic.module.system.service.dict.DictDataService;
|
import cd.casic.module.system.service.dict.DictDataService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -101,4 +98,10 @@ public class DictDataController {
|
|||||||
BeanUtils.toBean(list, DictDataRespVO.class));
|
BeanUtils.toBean(list, DictDataRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDictDataTree")
|
||||||
|
@Operation(summary = "获取数据字典树")
|
||||||
|
public CommonResult<List<DictDataTreeVO>> getDictDataTree() {
|
||||||
|
return success(dictDataService.getDictDataTree());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package cd.casic.module.system.controller.admin.dict.vo.data;
|
|||||||
|
|
||||||
import cd.casic.framework.excel.excel.core.annotations.DictFormat;
|
import cd.casic.framework.excel.excel.core.annotations.DictFormat;
|
||||||
import cd.casic.framework.excel.excel.core.convert.DictConvert;
|
import cd.casic.framework.excel.excel.core.convert.DictConvert;
|
||||||
|
import cd.casic.module.system.dal.dataobject.dict.DictTypeDO;
|
||||||
import cd.casic.module.system.enums.DictTypeConstants;
|
import cd.casic.module.system.enums.DictTypeConstants;
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
@ -54,4 +55,5 @@ public class DictDataRespVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package cd.casic.module.system.controller.admin.dict.vo.data;
|
||||||
|
|
||||||
|
import cd.casic.module.system.controller.admin.dict.vo.type.DictTypeRespVO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author songqiang
|
||||||
|
* @date 2023-09-28 9:50
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Schema(description = "管理后台 - 字典树 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class DictDataTreeVO extends DictTypeRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "子节点")
|
||||||
|
private List<DictDataRespVO> children;
|
||||||
|
}
|
@ -32,4 +32,8 @@ public class DictTypePageReqVO extends PageParam {
|
|||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "值类型类型,模糊匹配")
|
||||||
|
@Size(max = 128, message = "字典类型类型长度不能超过128个字符")
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,4 +40,7 @@ public class DictTypeRespVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "值类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,7 @@ public class DictTypeSaveReqVO {
|
|||||||
@Schema(description = "备注", example = "快乐的备注")
|
@Schema(description = "备注", example = "快乐的备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "值类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,7 @@ public class DictTypeSimpleRespVO {
|
|||||||
@Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex")
|
@Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "值类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,7 @@ package cd.casic.module.system.controller.admin.permission;
|
|||||||
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
||||||
import cd.casic.framework.commons.pojo.CommonResult;
|
import cd.casic.framework.commons.pojo.CommonResult;
|
||||||
import cd.casic.framework.commons.util.object.BeanUtils;
|
import cd.casic.framework.commons.util.object.BeanUtils;
|
||||||
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
|
import cd.casic.module.system.controller.admin.permission.vo.menu.*;
|
||||||
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuRespVO;
|
|
||||||
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuSaveVO;
|
|
||||||
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuSimpleRespVO;
|
|
||||||
import cd.casic.module.system.dal.dataobject.permission.MenuDO;
|
import cd.casic.module.system.dal.dataobject.permission.MenuDO;
|
||||||
import cd.casic.module.system.service.permission.MenuService;
|
import cd.casic.module.system.service.permission.MenuService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -85,4 +82,15 @@ public class MenuController {
|
|||||||
return success(BeanUtils.toBean(menu, MenuRespVO.class));
|
return success(BeanUtils.toBean(menu, MenuRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getMenuTree")
|
||||||
|
@Operation(summary = "获取菜单树")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
||||||
|
public CommonResult<List<MenuTreeVO>> getMenuTree() {
|
||||||
|
// 获得菜单列表,只要开启状态的
|
||||||
|
MenuListReqVO reqVO = new MenuListReqVO();
|
||||||
|
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
List<MenuDO> list = menuService.getMenuListByTenant(reqVO);
|
||||||
|
return success(menuService.convertMenuTree(list));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cd.casic.module.system.controller.admin.permission.vo.menu;
|
package cd.casic.module.system.controller.admin.permission.vo.menu;
|
||||||
|
|
||||||
|
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -69,4 +70,30 @@ public class MenuRespVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目录分组
|
||||||
|
*/
|
||||||
|
private String menuGroup;
|
||||||
|
/**
|
||||||
|
* 目录重定向
|
||||||
|
*/
|
||||||
|
private String redirect;
|
||||||
|
|
||||||
|
private Boolean showChildren;
|
||||||
|
/**
|
||||||
|
* 当前激活目录
|
||||||
|
*/
|
||||||
|
private String currentActiveMenu;
|
||||||
|
/**
|
||||||
|
* 外部站点地址
|
||||||
|
*/
|
||||||
|
private String frameSrc;
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean isTag;
|
||||||
|
|
||||||
|
private Boolean tagDot;
|
||||||
|
private String tagType;
|
||||||
|
private String tagContent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,4 +64,30 @@ public class MenuSaveVO {
|
|||||||
@Schema(description = "是否总是显示", example = "false")
|
@Schema(description = "是否总是显示", example = "false")
|
||||||
private Boolean alwaysShow;
|
private Boolean alwaysShow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目录分组
|
||||||
|
*/
|
||||||
|
private String menuGroup;
|
||||||
|
/**
|
||||||
|
* 目录重定向
|
||||||
|
*/
|
||||||
|
private String redirect;
|
||||||
|
|
||||||
|
private Boolean showChildren;
|
||||||
|
/**
|
||||||
|
* 当前激活目录
|
||||||
|
*/
|
||||||
|
private String currentActiveMenu;
|
||||||
|
/**
|
||||||
|
* 外部站点地址
|
||||||
|
*/
|
||||||
|
private String frameSrc;
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean isTag;
|
||||||
|
|
||||||
|
private Boolean tagDot;
|
||||||
|
private String tagType;
|
||||||
|
private String tagContent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
package cd.casic.module.system.controller.admin.permission.vo.menu;
|
||||||
|
|
||||||
|
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author songqiang
|
||||||
|
* @date 2023-11-08 11:40
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Schema(description = "管理后台 - 菜单树 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
public class MenuTreeVO {
|
||||||
|
|
||||||
|
@Schema(description = "菜单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "父菜单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "类型,参见 MenuTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "路由地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "/system")
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
@Schema(description = "菜单图标", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "system")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
@Schema(description = "组件路径", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "system/user/index")
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
@Schema(description = "组件名", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "SystemUser")
|
||||||
|
private String componentName;
|
||||||
|
|
||||||
|
@Schema(description = "子菜单", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
private List<MenuTreeVO> child;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目录分组
|
||||||
|
*/
|
||||||
|
private String menuGroup;
|
||||||
|
/**
|
||||||
|
* 目录重定向
|
||||||
|
*/
|
||||||
|
private String redirect;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link CommonStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 是否可见
|
||||||
|
*
|
||||||
|
* 只有菜单、目录使用
|
||||||
|
* 当设置为 true 时,该菜单不会展示在侧边栏,但是路由还是存在。例如说,一些独立的编辑页面 /edit/1024 等等
|
||||||
|
*/
|
||||||
|
private Boolean visible;
|
||||||
|
/**
|
||||||
|
* 是否缓存
|
||||||
|
*
|
||||||
|
* 只有菜单、目录使用,否使用 Vue 路由的 keep-alive 特性
|
||||||
|
* 注意:如果开启缓存,则必须填写 {@link #componentName} 属性,否则无法缓存
|
||||||
|
*/
|
||||||
|
private Boolean keepAlive;
|
||||||
|
/**
|
||||||
|
* 是否总是显示
|
||||||
|
*
|
||||||
|
* 如果为 false 时,当该菜单只有一个子菜单时,不展示自己,直接展示子菜单
|
||||||
|
*/
|
||||||
|
private Boolean alwaysShow;
|
||||||
|
/**
|
||||||
|
* 是否显示子菜单
|
||||||
|
*/
|
||||||
|
private Boolean showChildren;
|
||||||
|
/**
|
||||||
|
* 当前激活目录
|
||||||
|
*/
|
||||||
|
private String currentActiveMenu;
|
||||||
|
/**
|
||||||
|
* 外部站点地址
|
||||||
|
*/
|
||||||
|
private String frameSrc;
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean isTag;
|
||||||
|
|
||||||
|
private Boolean tagDot;
|
||||||
|
private String tagType;
|
||||||
|
private String tagContent;
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package cd.casic.module.system.convert.dict;
|
||||||
|
|
||||||
|
//import cd.casic.commons.pojo.PageResult;
|
||||||
|
import cd.casic.module.system.api.dict.dto.DictDataRespDTO;
|
||||||
|
import cd.casic.module.system.controller.admin.dict.vo.data.*;
|
||||||
|
import cd.casic.module.system.dal.dataobject.dict.DictDataDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DictDataConvert {
|
||||||
|
|
||||||
|
DictDataConvert INSTANCE = Mappers.getMapper(DictDataConvert.class);
|
||||||
|
|
||||||
|
List<DictDataSimpleRespVO> convertList(List<DictDataDO> list);
|
||||||
|
|
||||||
|
DictDataRespVO convert(DictDataDO bean);
|
||||||
|
|
||||||
|
// PageResult<DictDataRespVO> convertPage(PageResult<DictDataDO> page);
|
||||||
|
//
|
||||||
|
// DictDataDO convert(DictDataUpdateReqVO bean);
|
||||||
|
//
|
||||||
|
// DictDataDO convert(DictDataCreateReqVO bean);
|
||||||
|
//
|
||||||
|
// List<DictDataExcelVO> convertList02(List<DictDataDO> bean);
|
||||||
|
|
||||||
|
DictDataRespDTO convert02(DictDataDO bean);
|
||||||
|
|
||||||
|
List<DictDataRespVO> convertList03(List<DictDataDO> bean);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package cd.casic.module.system.convert.dict;
|
||||||
|
|
||||||
|
//import cd.casic.commons.pojo.PageResult;
|
||||||
|
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataTreeVO;
|
||||||
|
import cd.casic.module.system.controller.admin.dict.vo.type.*;
|
||||||
|
import cd.casic.module.system.dal.dataobject.dict.DictTypeDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DictTypeConvert {
|
||||||
|
|
||||||
|
DictTypeConvert INSTANCE = Mappers.getMapper(DictTypeConvert.class);
|
||||||
|
|
||||||
|
// PageResult<DictTypeRespVO> convertPage(PageResult<DictTypeDO> bean);
|
||||||
|
//
|
||||||
|
// DictTypeRespVO convert(DictTypeDO bean);
|
||||||
|
//
|
||||||
|
// DictTypeDO convert(DictTypeCreateReqVO bean);
|
||||||
|
//
|
||||||
|
// DictTypeDO convert(DictTypeUpdateReqVO bean);
|
||||||
|
//
|
||||||
|
// List<DictTypeSimpleRespVO> convertList(List<DictTypeDO> list);
|
||||||
|
//
|
||||||
|
// List<DictTypeExcelVO> convertList02(List<DictTypeDO> list);
|
||||||
|
|
||||||
|
List<DictDataTreeVO> convertList03(List<DictTypeDO> list);
|
||||||
|
|
||||||
|
}
|
@ -55,4 +55,9 @@ public class DictTypeDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private LocalDateTime deletedTime;
|
private LocalDateTime deletedTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 值类型
|
||||||
|
*/
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,14 @@ public class MenuDO extends BaseDO {
|
|||||||
* 组件名
|
* 组件名
|
||||||
*/
|
*/
|
||||||
private String componentName;
|
private String componentName;
|
||||||
|
/**
|
||||||
|
* 目录分组
|
||||||
|
*/
|
||||||
|
private String menuGroup;
|
||||||
|
/**
|
||||||
|
* 目录重定向
|
||||||
|
*/
|
||||||
|
private String redirect;
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*
|
*
|
||||||
@ -105,5 +113,23 @@ public class MenuDO extends BaseDO {
|
|||||||
* 如果为 false 时,当该菜单只有一个子菜单时,不展示自己,直接展示子菜单
|
* 如果为 false 时,当该菜单只有一个子菜单时,不展示自己,直接展示子菜单
|
||||||
*/
|
*/
|
||||||
private Boolean alwaysShow;
|
private Boolean alwaysShow;
|
||||||
|
/**
|
||||||
|
* 是否显示子菜单
|
||||||
|
*/
|
||||||
|
private Boolean showChildren;
|
||||||
|
/**
|
||||||
|
* 当前激活目录
|
||||||
|
*/
|
||||||
|
private String currentActiveMenu;
|
||||||
|
/**
|
||||||
|
* 外部站点地址
|
||||||
|
*/
|
||||||
|
private String frameSrc;
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean isTag;
|
||||||
|
|
||||||
|
private Boolean tagDot;
|
||||||
|
private String tagType;
|
||||||
|
private String tagContent;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cd.casic.module.system.service.dict;
|
|||||||
import cd.casic.framework.commons.pojo.PageResult;
|
import cd.casic.framework.commons.pojo.PageResult;
|
||||||
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataPageReqVO;
|
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataPageReqVO;
|
||||||
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
|
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
|
||||||
|
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataTreeVO;
|
||||||
import cd.casic.module.system.dal.dataobject.dict.DictDataDO;
|
import cd.casic.module.system.dal.dataobject.dict.DictDataDO;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
@ -107,4 +108,12 @@ public interface DictDataService {
|
|||||||
*/
|
*/
|
||||||
List<DictDataDO> getDictDataListByDictType(String dictType);
|
List<DictDataDO> getDictDataListByDictType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成数据字典树
|
||||||
|
* @author songqiang
|
||||||
|
* @date 2023-09-28 9:57
|
||||||
|
* @return 字典树
|
||||||
|
*/
|
||||||
|
List<DictDataTreeVO> getDictDataTree();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package cd.casic.module.system.service.dict;
|
package cd.casic.module.system.service.dict;
|
||||||
|
|
||||||
|
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataRespVO;
|
||||||
|
import cd.casic.module.system.controller.admin.dict.vo.data.DictDataTreeVO;
|
||||||
|
import cd.casic.module.system.convert.dict.DictDataConvert;
|
||||||
|
import cd.casic.module.system.convert.dict.DictTypeConvert;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
||||||
import cd.casic.framework.commons.pojo.PageResult;
|
import cd.casic.framework.commons.pojo.PageResult;
|
||||||
@ -15,10 +19,8 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.Comparator;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static cd.casic.framework.commons.exception.util.ServiceExceptionUtil.exception;
|
import static cd.casic.framework.commons.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cd.casic.module.system.enums.ErrorCodeConstants.*;
|
import static cd.casic.module.system.enums.ErrorCodeConstants.*;
|
||||||
@ -176,4 +178,27 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DictDataTreeVO> getDictDataTree() {
|
||||||
|
|
||||||
|
List<DictTypeDO> dictTypeList = dictTypeService.getDictTypeList();
|
||||||
|
List<DictDataTreeVO> dataTree = DictTypeConvert.INSTANCE.convertList03(dictTypeList);
|
||||||
|
if (CollUtil.isEmpty(dataTree)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<DictDataDO> dictDataList = dictDataMapper.selectList();
|
||||||
|
dictDataList.sort(COMPARATOR_TYPE_AND_SORT);
|
||||||
|
List<DictDataRespVO> list = DictDataConvert.INSTANCE.convertList03(dictDataList);
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return dataTree;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, List<DictDataRespVO>> map = list.stream().collect(Collectors.groupingBy(DictDataRespVO::getDictType));
|
||||||
|
for (DictDataTreeVO treeVO : dataTree) {
|
||||||
|
treeVO.setChildren(map.get(treeVO.getType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataTree;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cd.casic.module.system.service.permission;
|
|||||||
|
|
||||||
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
|
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
|
||||||
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuSaveVO;
|
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuSaveVO;
|
||||||
|
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuTreeVO;
|
||||||
import cd.casic.module.system.dal.dataobject.permission.MenuDO;
|
import cd.casic.module.system.dal.dataobject.permission.MenuDO;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -93,4 +94,13 @@ public interface MenuService {
|
|||||||
*/
|
*/
|
||||||
List<MenuDO> getMenuList(Collection<Long> ids);
|
List<MenuDO> getMenuList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成菜单树
|
||||||
|
* @author songqiang
|
||||||
|
* @date 2023-11-08 14:08
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MenuTreeVO> convertMenuTree(List<MenuDO> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cd.casic.module.system.service.permission;
|
package cd.casic.module.system.service.permission;
|
||||||
|
|
||||||
|
import cd.casic.module.system.controller.admin.permission.vo.menu.MenuTreeVO;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
import cd.casic.framework.commons.enums.CommonStatusEnum;
|
||||||
@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cd.casic.framework.commons.exception.util.ServiceExceptionUtil.exception;
|
import static cd.casic.framework.commons.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cd.casic.framework.commons.util.collection.CollectionUtils.convertList;
|
import static cd.casic.framework.commons.util.collection.CollectionUtils.convertList;
|
||||||
@ -259,4 +261,54 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MenuTreeVO> convertMenuTree(List<MenuDO> list) {
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
list.sort(Comparator.comparing(MenuDO::getSort));
|
||||||
|
List<MenuTreeVO> menuTreeList = new ArrayList<>(list.size());
|
||||||
|
for (MenuDO menuDO : list) {
|
||||||
|
menuTreeList.add(menuDOToMenuTreeVO(menuDO));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MenuTreeVO> parentList = menuTreeList.stream()
|
||||||
|
.filter(i -> i.getParentId() == 0L)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
parentList.forEach(i -> findChild(i, menuTreeList));
|
||||||
|
|
||||||
|
return parentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void findChild(MenuTreeVO menuTreeVO, List<MenuTreeVO> list) {
|
||||||
|
List<MenuTreeVO> collect = list.stream()
|
||||||
|
.filter(i -> i.getParentId().equals(menuTreeVO.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
menuTreeVO.setChild(collect);
|
||||||
|
collect.forEach(i -> findChild(i, list));
|
||||||
|
}
|
||||||
|
|
||||||
|
private MenuTreeVO menuDOToMenuTreeVO(MenuDO menuDO) {
|
||||||
|
if ( menuDO == null ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuTreeVO menuTreeVO = new MenuTreeVO();
|
||||||
|
// menuTreeVO.setId( menuDO.getId() );
|
||||||
|
// menuTreeVO.setName( menuDO.getName() );
|
||||||
|
// menuTreeVO.setParentId( menuDO.getParentId() );
|
||||||
|
// menuTreeVO.setType( menuDO.getType() );
|
||||||
|
// menuTreeVO.setPath( menuDO.getPath() );
|
||||||
|
// menuTreeVO.setIcon( menuDO.getIcon() );
|
||||||
|
// menuTreeVO.setComponent( menuDO.getComponent() );
|
||||||
|
// menuTreeVO.setComponentName( menuDO.getComponentName() );
|
||||||
|
BeanUtils.copyProperties(menuDO, menuTreeVO);
|
||||||
|
|
||||||
|
return menuTreeVO;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user