删除菜单权限,菜单列表加已有的功能
This commit is contained in:
@@ -66,9 +66,9 @@ public class MenuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除菜单权限", description = "删除菜单权限")
|
@Operation(summary = "删除菜单权限", description = "删除菜单权限")
|
||||||
@DeleteMapping("/delete/fun/{menuBindFunId}")
|
@DeleteMapping("/delete/fun/{menuId}")
|
||||||
public XResult<Void> deleteFun(@PathVariable Long menuBindFunId) {
|
public XResult<Void> deleteFun(@PathVariable Long menuId) {
|
||||||
return menuService.deleteFun(menuBindFunId);
|
return menuService.deleteFun(menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity;
|
package com.cczsa.xinghe.codegen.entity;
|
||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
||||||
|
import com.cczsa.xinghe.codegen.entity.enums.MenuTypeEnum;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
import com.mybatisflex.core.keygen.KeyGenerators;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -54,6 +53,16 @@ public class MenuEntity extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作ID/来自操作表
|
||||||
|
*/
|
||||||
|
private Long funId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0菜单1按钮
|
||||||
|
*/
|
||||||
|
private MenuTypeEnum menuType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由路径
|
* 路由路径
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.cczsa.xinghe.codegen.entity.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import com.mybatisflex.annotation.EnumValue;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单类型
|
||||||
|
*
|
||||||
|
* @author My
|
||||||
|
*/
|
||||||
|
@Schema(description = "菜单类型",
|
||||||
|
example = "0",
|
||||||
|
allowableValues = {"0: 菜单", "1: 按钮"})
|
||||||
|
@Getter
|
||||||
|
public enum MenuTypeEnum {
|
||||||
|
// 0: 菜单 1: 按钮
|
||||||
|
MENU_ID(0, "菜单"),
|
||||||
|
BUTTON_ID(1, "按钮");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
MenuTypeEnum(int code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
@EnumValue
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity.req.menu;
|
package com.cczsa.xinghe.codegen.entity.req.menu;
|
||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
||||||
|
import com.cczsa.xinghe.codegen.entity.enums.MenuTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -50,4 +51,8 @@ public class MenuAddReq implements Serializable {
|
|||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
@NotNull(message = "菜单类型不能为空")
|
||||||
|
@Schema(description = "0菜单1按钮")
|
||||||
|
private MenuTypeEnum menuType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import lombok.Setter;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单绑定权限 请求参数
|
* 菜单绑定权限 请求参数
|
||||||
@@ -29,6 +28,6 @@ public class MenuBindFunReq implements Serializable {
|
|||||||
|
|
||||||
@NotNull(message = "功能ID不能为空")
|
@NotNull(message = "功能ID不能为空")
|
||||||
@Schema(description = "功能ID")
|
@Schema(description = "功能ID")
|
||||||
private List<Long> funIdList;
|
private Long funId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity.req.menu;
|
package com.cczsa.xinghe.codegen.entity.req.menu;
|
||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
||||||
|
import com.cczsa.xinghe.codegen.entity.enums.MenuTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -52,4 +53,8 @@ public class MenuEditReq implements Serializable {
|
|||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
@NotNull(message = "菜单类型不能为空")
|
||||||
|
@Schema(description = "0菜单1按钮")
|
||||||
|
private MenuTypeEnum menuType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity.res.menu;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单功能列表 响应参数
|
|
||||||
*
|
|
||||||
* @author xia
|
|
||||||
* @version 0.0.1
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Schema(description = "菜单功能列表-响应")
|
|
||||||
public class MenuFunListQueryRes implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Schema(description = "菜单绑定功能ID")
|
|
||||||
private Long menuBindFunId;
|
|
||||||
|
|
||||||
@Schema(description = "功能ID")
|
|
||||||
private Long funId;
|
|
||||||
|
|
||||||
@Schema(description = "功能名称")
|
|
||||||
private String funName;
|
|
||||||
|
|
||||||
@Schema(description = "存在个数")
|
|
||||||
private Integer existNum;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity.res.menu;
|
package com.cczsa.xinghe.codegen.entity.res.menu;
|
||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
||||||
|
import com.cczsa.xinghe.codegen.entity.enums.MenuTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -50,8 +51,17 @@ public class MenuQueryRes implements Serializable {
|
|||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
@Schema(description = "菜单功能列表")
|
@Schema(description = "0菜单1按钮")
|
||||||
private List<MenuFunListQueryRes> funList;
|
private MenuTypeEnum menuType;
|
||||||
|
|
||||||
|
@Schema(description = "功能ID")
|
||||||
|
private Long funId;
|
||||||
|
|
||||||
|
@Schema(description = "功能名称")
|
||||||
|
private String funName;
|
||||||
|
|
||||||
|
@Schema(description = "功能存在个数")
|
||||||
|
private Integer existNum;
|
||||||
|
|
||||||
@Schema(description = "子菜单")
|
@Schema(description = "子菜单")
|
||||||
private List<MenuQueryRes> children;
|
private List<MenuQueryRes> children;
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity.res.role;
|
|
||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.enums.UsableConfigEnum;
|
|
||||||
import com.cczsa.xinghe.codegen.handler.PostgreSQLJsonTypeHandler;
|
|
||||||
import com.mybatisflex.annotation.Column;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单功能列表 响应参数
|
|
||||||
*
|
|
||||||
* @author xia
|
|
||||||
* @version 0.0.1
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Schema(description = "菜单功能列表-响应")
|
|
||||||
public class MenuFunListRes implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Schema(description = "权限id")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "操作名称")
|
|
||||||
private String funName;
|
|
||||||
|
|
||||||
@Schema(description = "可配置数据类型")
|
|
||||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
|
||||||
private List<UsableConfigEnum> usableConfig;
|
|
||||||
|
|
||||||
@Schema(description = "可配置字段")
|
|
||||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
|
||||||
private List<String> fieldConfig;
|
|
||||||
|
|
||||||
@Schema(description = "排序")
|
|
||||||
private Integer sortOrder;
|
|
||||||
|
|
||||||
@Schema(description = "说明")
|
|
||||||
private String describe;
|
|
||||||
|
|
||||||
@Schema(description = "是否已选择")
|
|
||||||
private Boolean isSelect = false;
|
|
||||||
|
|
||||||
@Schema(description = "角色权限绑定的id")
|
|
||||||
private Long funBindId;
|
|
||||||
|
|
||||||
@Schema(description = "数据权限")
|
|
||||||
private UsableConfigEnum dataScope;
|
|
||||||
|
|
||||||
@Schema(description = "指定的数据权限范围")
|
|
||||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
|
||||||
private List<Long> assignDataScope;
|
|
||||||
|
|
||||||
@Schema(description = "排除的字段")
|
|
||||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
|
||||||
private List<String> excludeField;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity.res.role;
|
package com.cczsa.xinghe.codegen.entity.res.role;
|
||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
import com.cczsa.xinghe.codegen.entity.enums.ClientTypeEnum;
|
||||||
|
import com.cczsa.xinghe.codegen.entity.enums.UsableConfigEnum;
|
||||||
|
import com.cczsa.xinghe.codegen.handler.PostgreSQLJsonTypeHandler;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -50,8 +53,39 @@ public class RoleQueryFunRes implements Serializable {
|
|||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
@Schema(description = "菜单功能列表")
|
@Schema(description = "权限id")
|
||||||
private List<MenuFunListRes> menuFunList;
|
private Long funId;
|
||||||
|
|
||||||
|
@Schema(description = "操作名称")
|
||||||
|
private String funName;
|
||||||
|
|
||||||
|
@Schema(description = "可配置数据类型")
|
||||||
|
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||||
|
private List<UsableConfigEnum> usableConfig;
|
||||||
|
|
||||||
|
@Schema(description = "可配置字段")
|
||||||
|
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||||
|
private List<String> fieldConfig;
|
||||||
|
|
||||||
|
@Schema(description = "说明")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
@Schema(description = "是否已选择")
|
||||||
|
private Boolean isSelect = false;
|
||||||
|
|
||||||
|
@Schema(description = "角色权限绑定的id")
|
||||||
|
private Long funBindId;
|
||||||
|
|
||||||
|
@Schema(description = "数据权限")
|
||||||
|
private UsableConfigEnum dataScope;
|
||||||
|
|
||||||
|
@Schema(description = "指定的数据权限范围")
|
||||||
|
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||||
|
private List<Long> assignDataScope;
|
||||||
|
|
||||||
|
@Schema(description = "排除的字段")
|
||||||
|
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||||
|
private List<String> excludeField;
|
||||||
|
|
||||||
@Schema(description = "子菜单")
|
@Schema(description = "子菜单")
|
||||||
private List<RoleQueryFunRes> children;
|
private List<RoleQueryFunRes> children;
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.cczsa.xinghe.codegen.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.cczsa.xinghe.codegen.entity.MenuBindFunEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单绑定权限 映射层。
|
|
||||||
*
|
|
||||||
* @author My
|
|
||||||
* @since 0.0.1
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface MenuBindFunMapper extends BaseMapper<MenuBindFunEntity> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
package com.cczsa.xinghe.codegen.mapper.def;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.query.QueryColumn;
|
|
||||||
import com.mybatisflex.core.table.TableDef;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单绑定权限 表定义层。
|
|
||||||
*
|
|
||||||
* @author My
|
|
||||||
* @since 0.0.1
|
|
||||||
*/
|
|
||||||
public class MenuBindFunDef extends TableDef {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单绑定权限
|
|
||||||
*/
|
|
||||||
public static final MenuBindFunDef MENU_BIND_FUN_ENTITY = new MenuBindFunDef();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能ID
|
|
||||||
*/
|
|
||||||
public final QueryColumn FUN_ID = new QueryColumn(this, "fun_id");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单ID
|
|
||||||
*/
|
|
||||||
public final QueryColumn MENU_ID = new QueryColumn(this, "menu_id");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所有字段。
|
|
||||||
*/
|
|
||||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
|
||||||
*/
|
|
||||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, MENU_ID, FUN_ID};
|
|
||||||
|
|
||||||
public MenuBindFunDef() {
|
|
||||||
super("", "cg_menu_bind_fun");
|
|
||||||
}
|
|
||||||
|
|
||||||
private MenuBindFunDef(String schema, String name, String alisa) {
|
|
||||||
super(schema, name, alisa);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MenuBindFunDef as(String alias) {
|
|
||||||
String key = getNameWithSchema() + "." + alias;
|
|
||||||
return getCache(key, k -> new MenuBindFunDef("", "cg_menu_bind_fun", alias));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -36,6 +36,11 @@ public class MenuDef extends TableDef {
|
|||||||
*/
|
*/
|
||||||
public final QueryColumn PATH = new QueryColumn(this, "path");
|
public final QueryColumn PATH = new QueryColumn(this, "path");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作ID/来自操作表
|
||||||
|
*/
|
||||||
|
public final QueryColumn FUN_ID = new QueryColumn(this, "fun_id");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否隐藏
|
* 是否隐藏
|
||||||
*/
|
*/
|
||||||
@@ -51,12 +56,19 @@ public class MenuDef extends TableDef {
|
|||||||
*/
|
*/
|
||||||
public final QueryColumn MENU_NAME = new QueryColumn(this, "menu_name");
|
public final QueryColumn MENU_NAME = new QueryColumn(this, "menu_name");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0菜单1按钮
|
||||||
|
*/
|
||||||
|
public final QueryColumn MENU_TYPE = new QueryColumn(this, "menu_type");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父菜单ID
|
* 父菜单ID
|
||||||
*/
|
*/
|
||||||
public final QueryColumn PARENT_ID = new QueryColumn(this, "parent_id");
|
public final QueryColumn PARENT_ID = new QueryColumn(this, "parent_id");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
public final QueryColumn SORT_ORDER = new QueryColumn(this, "sort_order");
|
public final QueryColumn SORT_ORDER = new QueryColumn(this, "sort_order");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +84,7 @@ public class MenuDef extends TableDef {
|
|||||||
/**
|
/**
|
||||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||||
*/
|
*/
|
||||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, CLIENT_TYPE, MENU_NAME, PARENT_ID, PATH, ICON, IS_TENANT, IS_HIDE, SORT_ORDER};
|
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, CLIENT_TYPE, MENU_NAME, PARENT_ID, FUN_ID, MENU_TYPE, PATH, ICON, IS_TENANT, IS_HIDE, SORT_ORDER};
|
||||||
|
|
||||||
public MenuDef() {
|
public MenuDef() {
|
||||||
super("", "cg_menu");
|
super("", "cg_menu");
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ public interface MenuService {
|
|||||||
/**
|
/**
|
||||||
* 删除菜单权限
|
* 删除菜单权限
|
||||||
*/
|
*/
|
||||||
XResult<Void> deleteFun(Long menuBindFunId);
|
XResult<Void> deleteFun(Long menuId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,14 +8,11 @@ import com.cczsa.xinghe.codegen.entity.req.menu.MenuAddReq;
|
|||||||
import com.cczsa.xinghe.codegen.entity.req.menu.MenuBindFunReq;
|
import com.cczsa.xinghe.codegen.entity.req.menu.MenuBindFunReq;
|
||||||
import com.cczsa.xinghe.codegen.entity.req.menu.MenuEditReq;
|
import com.cczsa.xinghe.codegen.entity.req.menu.MenuEditReq;
|
||||||
import com.cczsa.xinghe.codegen.entity.req.menu.MenuQueryReq;
|
import com.cczsa.xinghe.codegen.entity.req.menu.MenuQueryReq;
|
||||||
import com.cczsa.xinghe.codegen.entity.res.menu.MenuFunListQueryRes;
|
|
||||||
import com.cczsa.xinghe.codegen.entity.res.menu.MenuQueryRes;
|
import com.cczsa.xinghe.codegen.entity.res.menu.MenuQueryRes;
|
||||||
import com.cczsa.xinghe.codegen.mapper.FunItemMapper;
|
import com.cczsa.xinghe.codegen.mapper.FunItemMapper;
|
||||||
import com.cczsa.xinghe.codegen.mapper.FunOperationMapper;
|
import com.cczsa.xinghe.codegen.mapper.FunOperationMapper;
|
||||||
import com.cczsa.xinghe.codegen.mapper.MenuBindFunMapper;
|
|
||||||
import com.cczsa.xinghe.codegen.mapper.MenuMapper;
|
import com.cczsa.xinghe.codegen.mapper.MenuMapper;
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.FunOperationDef;
|
import com.cczsa.xinghe.codegen.mapper.def.FunOperationDef;
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.MenuBindFunDef;
|
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.MenuDef;
|
import com.cczsa.xinghe.codegen.mapper.def.MenuDef;
|
||||||
import com.cczsa.xinghe.codegen.service.MenuService;
|
import com.cczsa.xinghe.codegen.service.MenuService;
|
||||||
import com.cczsa.xinghe.codegen.util.XResult;
|
import com.cczsa.xinghe.codegen.util.XResult;
|
||||||
@@ -42,7 +39,6 @@ import java.util.Map;
|
|||||||
public class MenuServiceImpl implements MenuService {
|
public class MenuServiceImpl implements MenuService {
|
||||||
|
|
||||||
private final MenuMapper menuMapper;
|
private final MenuMapper menuMapper;
|
||||||
private final MenuBindFunMapper menuBindFunMapper;
|
|
||||||
private final FunOperationMapper funOperationMapper;
|
private final FunOperationMapper funOperationMapper;
|
||||||
private final FunItemMapper funItemMapper;
|
private final FunItemMapper funItemMapper;
|
||||||
|
|
||||||
@@ -53,65 +49,45 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
@Override
|
@Override
|
||||||
public XResult<List<MenuQueryRes>> query(MenuQueryReq req) {
|
public XResult<List<MenuQueryRes>> query(MenuQueryReq req) {
|
||||||
MenuDef menuDef = MenuDef.MENU_ENTITY;
|
MenuDef menuDef = MenuDef.MENU_ENTITY;
|
||||||
|
FunOperationDef funOperationDef = FunOperationDef.FUN_OPERATION_ENTITY;
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.select(menuDef.ALL_COLUMNS)
|
query.select(
|
||||||
|
menuDef.ALL_COLUMNS,
|
||||||
|
funOperationDef.ID.as("funId"),
|
||||||
|
funOperationDef.FUN_NAME.as("funName")
|
||||||
|
)
|
||||||
.from(menuDef)
|
.from(menuDef)
|
||||||
|
.leftJoin(funOperationDef).on(menuDef.FUN_ID.eq(funOperationDef.ID))
|
||||||
.eq(MenuEntity::getClientType, req.getClientType())
|
.eq(MenuEntity::getClientType, req.getClientType())
|
||||||
.like(MenuEntity::getMenuName, req.getMenuName(), StrUtil.isNotBlank(req.getMenuName()))
|
.like(MenuEntity::getMenuName, req.getMenuName(), StrUtil.isNotBlank(req.getMenuName()))
|
||||||
.eq(MenuEntity::getParentId, req.getParentId(), req.getParentId() != null)
|
.eq(MenuEntity::getParentId, req.getParentId(), req.getParentId() != null)
|
||||||
.orderBy(MenuEntity::getSortOrder, false);
|
.orderBy(MenuEntity::getSortOrder, false);
|
||||||
List<MenuQueryRes> menuEntities = menuMapper.selectListByQueryAs(query, MenuQueryRes.class);
|
List<MenuQueryRes> menuEntities = menuMapper.selectListByQueryAs(query, MenuQueryRes.class);
|
||||||
// 获取功能ID
|
fillExistNumForMenuList(menuEntities);
|
||||||
for (MenuQueryRes menuEntity : menuEntities) {
|
|
||||||
FunOperationDef funOperationDef = FunOperationDef.FUN_OPERATION_ENTITY;
|
|
||||||
MenuBindFunDef menuBindFunDef = MenuBindFunDef.MENU_BIND_FUN_ENTITY;
|
|
||||||
QueryWrapper queryMenuBindFun = new QueryWrapper();
|
|
||||||
queryMenuBindFun.select(
|
|
||||||
menuBindFunDef.ID.as("menuBindFunId"),
|
|
||||||
funOperationDef.ID.as("funId"),
|
|
||||||
funOperationDef.FUN_NAME.as("funName")
|
|
||||||
)
|
|
||||||
.from(menuBindFunDef)
|
|
||||||
.leftJoin(funOperationDef).on(menuBindFunDef.FUN_ID.eq(funOperationDef.ID))
|
|
||||||
.eq(MenuBindFunEntity::getMenuId, menuEntity.getId());
|
|
||||||
List<MenuFunListQueryRes> menuFunListQueryRes = menuBindFunMapper.selectListByQueryAs(queryMenuBindFun, MenuFunListQueryRes.class);
|
|
||||||
menuEntity.setFunList(menuFunListQueryRes);
|
|
||||||
}
|
|
||||||
// 为功能列表填充存在个数信息
|
|
||||||
fillExistNumForFunList(menuEntities);
|
|
||||||
// 构建树形结构
|
// 构建树形结构
|
||||||
List<MenuQueryRes> treeList = buildMenuTree(menuEntities);
|
List<MenuQueryRes> treeList = buildMenuTree(menuEntities);
|
||||||
return XResult.ok(treeList);
|
return XResult.ok(treeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 为功能列表填充存在个数信息
|
* 为菜单列表填充功能存在个数信息
|
||||||
*
|
*
|
||||||
* @param menuEntities 菜单实体列表
|
* @param menuEntities 菜单实体列表
|
||||||
*/
|
*/
|
||||||
private void fillExistNumForFunList(List<MenuQueryRes> menuEntities) {
|
private void fillExistNumForMenuList(List<MenuQueryRes> menuEntities) {
|
||||||
// 统计每个功能ID在整个系统中的出现次数
|
// 统计每个功能ID在整个系统中的出现次数
|
||||||
Map<Long, Integer> funIdCountMap = new HashMap<>();
|
Map<Long, Integer> funIdCountMap = new HashMap<>();
|
||||||
// 遍历所有菜单及其功能列表,统计功能ID出现次数
|
// 遍历所有菜单,统计功能ID出现次数
|
||||||
for (MenuQueryRes menu : menuEntities) {
|
for (MenuQueryRes menu : menuEntities) {
|
||||||
if (menu.getFunList() != null && !menu.getFunList().isEmpty()) {
|
if (menu.getFunId() != null) {
|
||||||
for (MenuFunListQueryRes fun : menu.getFunList()) {
|
funIdCountMap.put(menu.getFunId(),
|
||||||
if (fun.getFunId() != null) {
|
funIdCountMap.getOrDefault(menu.getFunId(), 0) + 1);
|
||||||
funIdCountMap.put(fun.getFunId(),
|
|
||||||
funIdCountMap.getOrDefault(fun.getFunId(), 0) + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新每个菜单中的功能列表的 existNum 字段
|
// 更新每个菜单中的 existNum 字段
|
||||||
for (MenuQueryRes menu : menuEntities) {
|
for (MenuQueryRes menu : menuEntities) {
|
||||||
if (menu.getFunList() != null && !menu.getFunList().isEmpty()) {
|
if (menu.getFunId() != null && funIdCountMap.containsKey(menu.getFunId())) {
|
||||||
for (MenuFunListQueryRes fun : menu.getFunList()) {
|
menu.setExistNum(funIdCountMap.get(menu.getFunId()));
|
||||||
if (fun.getFunId() != null) {
|
|
||||||
// 设置该功能在整个系统中的存在个数
|
|
||||||
fun.setExistNum(funIdCountMap.get(fun.getFunId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,10 +202,6 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
QueryWrapper deleteMenu = new QueryWrapper();
|
QueryWrapper deleteMenu = new QueryWrapper();
|
||||||
deleteMenu.eq(MenuEntity::getId, id);
|
deleteMenu.eq(MenuEntity::getId, id);
|
||||||
menuMapper.deleteByQuery(deleteMenu);
|
menuMapper.deleteByQuery(deleteMenu);
|
||||||
// 删除菜单绑定的权限
|
|
||||||
QueryWrapper deleteMenuBindFun = new QueryWrapper();
|
|
||||||
deleteMenuBindFun.eq(MenuBindFunEntity::getMenuId, id);
|
|
||||||
menuBindFunMapper.deleteByQuery(deleteMenuBindFun);
|
|
||||||
return XResult.ok();
|
return XResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,50 +218,26 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
if (menuEntity == null) {
|
if (menuEntity == null) {
|
||||||
return XResult.failed("菜单不存在");
|
return XResult.failed("菜单不存在");
|
||||||
}
|
}
|
||||||
// 获取操作
|
QueryWrapper queryFun = new QueryWrapper();
|
||||||
List<Long> funIdList = req.getFunIdList();
|
queryFun.eq(FunOperationEntity::getId, req.getFunId());
|
||||||
// 删除旧绑定
|
FunOperationEntity funOperationEntity = funOperationMapper.selectOneByQuery(queryFun);
|
||||||
QueryWrapper deleteMenuBindFun = new QueryWrapper();
|
if (funOperationEntity == null) {
|
||||||
deleteMenuBindFun.eq(MenuBindFunEntity::getMenuId, req.getMenuId());
|
return XResult.failed("权限不存在:" + req.getFunId());
|
||||||
menuBindFunMapper.deleteByQuery(deleteMenuBindFun);
|
|
||||||
for (Long funId : funIdList) {
|
|
||||||
QueryWrapper queryFun = new QueryWrapper();
|
|
||||||
queryFun.eq(FunOperationEntity::getId, funId);
|
|
||||||
FunOperationEntity funOperationEntity = funOperationMapper.selectOneByQuery(queryFun);
|
|
||||||
if (funOperationEntity == null) {
|
|
||||||
return XResult.failed("权限不存在:" + funId);
|
|
||||||
}
|
|
||||||
// 获取功能
|
|
||||||
QueryWrapper queryItem = new QueryWrapper();
|
|
||||||
queryItem.eq(FunItemEntity::getId, funOperationEntity.getItemId());
|
|
||||||
FunItemEntity funItemEntity = funItemMapper.selectOneByQuery(queryItem);
|
|
||||||
if (funItemEntity == null) {
|
|
||||||
return XResult.failed("功能不存在:" + funId);
|
|
||||||
}
|
|
||||||
Boolean menuIsTenant = menuEntity.getIsTenant();
|
|
||||||
Boolean itemIsTenant = funItemEntity.getIsTenant();
|
|
||||||
if (!menuIsTenant.equals(itemIsTenant)) {
|
|
||||||
return XResult.failed("菜单和权限是否租户不一致:" + funId);
|
|
||||||
}
|
|
||||||
// 获取最大ID
|
|
||||||
MenuBindFunDef menuBindFunDef = MenuBindFunDef.MENU_BIND_FUN_ENTITY;
|
|
||||||
QueryWrapper queryId = new QueryWrapper();
|
|
||||||
queryId.select(menuBindFunDef.ID)
|
|
||||||
.from(menuBindFunDef)
|
|
||||||
.orderBy(MenuBindFunEntity::getId, false);
|
|
||||||
Long maxId = menuBindFunMapper.selectOneByQueryAs(queryId, Long.class);
|
|
||||||
if (maxId == null) {
|
|
||||||
maxId = 10000L;
|
|
||||||
} else {
|
|
||||||
maxId++;
|
|
||||||
}
|
|
||||||
// 新增绑定
|
|
||||||
MenuBindFunEntity menuBindFunEntity = new MenuBindFunEntity();
|
|
||||||
menuBindFunEntity.setId(maxId);
|
|
||||||
menuBindFunEntity.setMenuId(req.getMenuId());
|
|
||||||
menuBindFunEntity.setFunId(funId);
|
|
||||||
menuBindFunMapper.insertSelective(menuBindFunEntity);
|
|
||||||
}
|
}
|
||||||
|
// 获取功能
|
||||||
|
QueryWrapper queryItem = new QueryWrapper();
|
||||||
|
queryItem.eq(FunItemEntity::getId, funOperationEntity.getItemId());
|
||||||
|
FunItemEntity funItemEntity = funItemMapper.selectOneByQuery(queryItem);
|
||||||
|
if (funItemEntity == null) {
|
||||||
|
return XResult.failed("功能不存在:" + req.getFunId());
|
||||||
|
}
|
||||||
|
Boolean menuIsTenant = menuEntity.getIsTenant();
|
||||||
|
Boolean itemIsTenant = funItemEntity.getIsTenant();
|
||||||
|
if (!menuIsTenant.equals(itemIsTenant)) {
|
||||||
|
return XResult.failed("菜单和权限是否租户不一致:" + req.getFunId());
|
||||||
|
}
|
||||||
|
menuEntity.setFunId(req.getFunId());
|
||||||
|
menuMapper.update(menuEntity);
|
||||||
return XResult.ok();
|
return XResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,10 +245,16 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
* 删除菜单权限
|
* 删除菜单权限
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public XResult<Void> deleteFun(Long menuBindFunId) {
|
public XResult<Void> deleteFun(Long menuId) {
|
||||||
QueryWrapper deleteMenuBindFun = new QueryWrapper();
|
// 获取菜单
|
||||||
deleteMenuBindFun.eq(MenuBindFunEntity::getId, menuBindFunId);
|
QueryWrapper queryMenu = new QueryWrapper();
|
||||||
menuBindFunMapper.deleteByQuery(deleteMenuBindFun);
|
queryMenu.eq(MenuEntity::getId, menuId);
|
||||||
|
MenuEntity menuEntity = menuMapper.selectOneByQuery(queryMenu);
|
||||||
|
if (menuEntity == null) {
|
||||||
|
return XResult.failed("菜单不存在");
|
||||||
|
}
|
||||||
|
menuEntity.setFunId(null);
|
||||||
|
menuMapper.update(menuEntity, false);
|
||||||
return XResult.ok();
|
return XResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.cczsa.xinghe.codegen.service.impl;
|
package com.cczsa.xinghe.codegen.service.impl;
|
||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.FunOperationEntity;
|
import com.cczsa.xinghe.codegen.entity.FunOperationEntity;
|
||||||
import com.cczsa.xinghe.codegen.entity.MenuBindFunEntity;
|
|
||||||
import com.cczsa.xinghe.codegen.entity.MenuEntity;
|
import com.cczsa.xinghe.codegen.entity.MenuEntity;
|
||||||
import com.cczsa.xinghe.codegen.entity.RoleEntity;
|
import com.cczsa.xinghe.codegen.entity.RoleEntity;
|
||||||
import com.cczsa.xinghe.codegen.entity.RoleFunEntity;
|
import com.cczsa.xinghe.codegen.entity.RoleFunEntity;
|
||||||
@@ -11,16 +10,13 @@ import com.cczsa.xinghe.codegen.entity.req.role.RoleBindFunReq;
|
|||||||
import com.cczsa.xinghe.codegen.entity.req.role.RoleEditReq;
|
import com.cczsa.xinghe.codegen.entity.req.role.RoleEditReq;
|
||||||
import com.cczsa.xinghe.codegen.entity.req.role.RoleQueryFunReq;
|
import com.cczsa.xinghe.codegen.entity.req.role.RoleQueryFunReq;
|
||||||
import com.cczsa.xinghe.codegen.entity.req.role.RoleQueryReq;
|
import com.cczsa.xinghe.codegen.entity.req.role.RoleQueryReq;
|
||||||
import com.cczsa.xinghe.codegen.entity.res.role.MenuFunListRes;
|
|
||||||
import com.cczsa.xinghe.codegen.entity.res.role.RoleQueryFunRes;
|
import com.cczsa.xinghe.codegen.entity.res.role.RoleQueryFunRes;
|
||||||
import com.cczsa.xinghe.codegen.entity.res.role.RoleQueryRes;
|
import com.cczsa.xinghe.codegen.entity.res.role.RoleQueryRes;
|
||||||
import com.cczsa.xinghe.codegen.mapper.FunOperationMapper;
|
import com.cczsa.xinghe.codegen.mapper.FunOperationMapper;
|
||||||
import com.cczsa.xinghe.codegen.mapper.MenuBindFunMapper;
|
|
||||||
import com.cczsa.xinghe.codegen.mapper.MenuMapper;
|
import com.cczsa.xinghe.codegen.mapper.MenuMapper;
|
||||||
import com.cczsa.xinghe.codegen.mapper.RoleFunMapper;
|
import com.cczsa.xinghe.codegen.mapper.RoleFunMapper;
|
||||||
import com.cczsa.xinghe.codegen.mapper.RoleMapper;
|
import com.cczsa.xinghe.codegen.mapper.RoleMapper;
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.FunOperationDef;
|
import com.cczsa.xinghe.codegen.mapper.def.FunOperationDef;
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.MenuBindFunDef;
|
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.MenuDef;
|
import com.cczsa.xinghe.codegen.mapper.def.MenuDef;
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.RoleDef;
|
import com.cczsa.xinghe.codegen.mapper.def.RoleDef;
|
||||||
import com.cczsa.xinghe.codegen.mapper.def.RoleFunDef;
|
import com.cczsa.xinghe.codegen.mapper.def.RoleFunDef;
|
||||||
@@ -52,7 +48,6 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
private final RoleFunMapper roleFunMapper;
|
private final RoleFunMapper roleFunMapper;
|
||||||
private final FunOperationMapper funOperationMapper;
|
private final FunOperationMapper funOperationMapper;
|
||||||
private final MenuMapper menuMapper;
|
private final MenuMapper menuMapper;
|
||||||
private final MenuBindFunMapper menuBindFunMapper;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,9 +218,19 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
public XResult<List<RoleQueryFunRes>> queryRoleFun(RoleQueryFunReq req) {
|
public XResult<List<RoleQueryFunRes>> queryRoleFun(RoleQueryFunReq req) {
|
||||||
// 获取菜单
|
// 获取菜单
|
||||||
MenuDef menuDef = MenuDef.MENU_ENTITY;
|
MenuDef menuDef = MenuDef.MENU_ENTITY;
|
||||||
|
FunOperationDef funOperationDef = FunOperationDef.FUN_OPERATION_ENTITY;
|
||||||
QueryWrapper queryMenu = new QueryWrapper();
|
QueryWrapper queryMenu = new QueryWrapper();
|
||||||
queryMenu.select(menuDef.ALL_COLUMNS)
|
queryMenu.select
|
||||||
|
(
|
||||||
|
menuDef.ALL_COLUMNS,
|
||||||
|
funOperationDef.ID.as("funId"),
|
||||||
|
funOperationDef.FUN_NAME,
|
||||||
|
funOperationDef.USABLE_CONFIG,
|
||||||
|
funOperationDef.FIELD_CONFIG,
|
||||||
|
funOperationDef.DESCRIBE
|
||||||
|
)
|
||||||
.from(menuDef)
|
.from(menuDef)
|
||||||
|
.leftJoin(funOperationDef).on(menuDef.FUN_ID.eq(funOperationDef.ID))
|
||||||
.eq(MenuEntity::getClientType, req.getClientType());
|
.eq(MenuEntity::getClientType, req.getClientType());
|
||||||
List<RoleQueryFunRes> roleQueryFunList = menuMapper.selectListByQueryAs(queryMenu, RoleQueryFunRes.class);
|
List<RoleQueryFunRes> roleQueryFunList = menuMapper.selectListByQueryAs(queryMenu, RoleQueryFunRes.class);
|
||||||
// 获取角色功能权限
|
// 获取角色功能权限
|
||||||
@@ -237,42 +242,23 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
List<RoleFunEntity> roleFunEntities = roleFunMapper.selectListByQuery(queryRoleFun);
|
List<RoleFunEntity> roleFunEntities = roleFunMapper.selectListByQuery(queryRoleFun);
|
||||||
for (RoleQueryFunRes roleQueryFunRes : roleQueryFunList) {
|
for (RoleQueryFunRes roleQueryFunRes : roleQueryFunList) {
|
||||||
// 获取菜单功能
|
// 获取菜单功能
|
||||||
FunOperationDef funOperationDef = FunOperationDef.FUN_OPERATION_ENTITY;
|
RoleFunEntity roleFunEntity = roleFunEntities.stream()
|
||||||
MenuBindFunDef menuBindFunDef = MenuBindFunDef.MENU_BIND_FUN_ENTITY;
|
.filter(entity -> entity.getFunId().equals(roleQueryFunRes.getFunId()))
|
||||||
QueryWrapper queryMenuBindFun = new QueryWrapper();
|
.findFirst()
|
||||||
queryMenuBindFun.select(
|
.orElse(null);
|
||||||
funOperationDef.ID,
|
if (roleFunEntity != null) {
|
||||||
funOperationDef.FUN_NAME,
|
// 设置角色权限配置
|
||||||
funOperationDef.USABLE_CONFIG,
|
roleQueryFunRes.setDataScope(roleFunEntity.getDataScope());
|
||||||
funOperationDef.FIELD_CONFIG,
|
roleQueryFunRes.setExcludeField(roleFunEntity.getExcludeField());
|
||||||
funOperationDef.SORT_ORDER,
|
roleQueryFunRes.setAssignDataScope(roleFunEntity.getAssignDataScope());
|
||||||
funOperationDef.DESCRIBE
|
roleQueryFunRes.setIsSelect(true);
|
||||||
)
|
roleQueryFunRes.setFunBindId(roleFunEntity.getId());
|
||||||
.from(menuBindFunDef)
|
} else {
|
||||||
.leftJoin(funOperationDef).on(funOperationDef.ID.eq(menuBindFunDef.FUN_ID))
|
// 如果角色没有此功能的权限,设置默认值
|
||||||
.eq(MenuBindFunEntity::getMenuId, roleQueryFunRes.getId());
|
roleQueryFunRes.setDataScope(null);
|
||||||
List<MenuFunListRes> menuFunList = menuBindFunMapper.selectListByQueryAs(queryMenuBindFun, MenuFunListRes.class);
|
roleQueryFunRes.setExcludeField(new ArrayList<>());
|
||||||
for (MenuFunListRes menuFunListRes : menuFunList) {
|
roleQueryFunRes.setAssignDataScope(new ArrayList<>());
|
||||||
// 在roleFunEntities中查找匹配的功能权限
|
|
||||||
RoleFunEntity roleFunEntity = roleFunEntities.stream()
|
|
||||||
.filter(entity -> entity.getFunId().equals(menuFunListRes.getId()))
|
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
if (roleFunEntity != null) {
|
|
||||||
// 设置角色权限配置
|
|
||||||
menuFunListRes.setDataScope(roleFunEntity.getDataScope());
|
|
||||||
menuFunListRes.setExcludeField(roleFunEntity.getExcludeField());
|
|
||||||
menuFunListRes.setAssignDataScope(roleFunEntity.getAssignDataScope());
|
|
||||||
menuFunListRes.setIsSelect(true);
|
|
||||||
menuFunListRes.setFunBindId(roleFunEntity.getId());
|
|
||||||
} else {
|
|
||||||
// 如果角色没有此功能的权限,设置默认值
|
|
||||||
menuFunListRes.setDataScope(null);
|
|
||||||
menuFunListRes.setExcludeField(new ArrayList<>());
|
|
||||||
menuFunListRes.setAssignDataScope(new ArrayList<>());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
roleQueryFunRes.setMenuFunList(menuFunList);
|
|
||||||
}
|
}
|
||||||
// 构建树形结构
|
// 构建树形结构
|
||||||
List<RoleQueryFunRes> treeList = buildMenuTree(roleQueryFunList);
|
List<RoleQueryFunRes> treeList = buildMenuTree(roleQueryFunList);
|
||||||
|
|||||||
Reference in New Issue
Block a user