模块增加参数
This commit is contained in:
@@ -66,4 +66,24 @@ public class FunModuleEntity extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要请求参数
|
||||||
|
*/
|
||||||
|
private Boolean isReqParams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要响应参数
|
||||||
|
*/
|
||||||
|
private Boolean isResParams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否分页
|
||||||
|
*/
|
||||||
|
private Boolean isPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路径参数(与请求参数true互斥)
|
||||||
|
*/
|
||||||
|
private String pathParams;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,13 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "可配置数据类型",
|
@Schema(description = "可配置数据类型",
|
||||||
example = "0",
|
example = "0",
|
||||||
allowableValues = {"1: 所有", "2: 本人", "3: 本部门",
|
allowableValues = {"0: 无需处理", "1: 所有", "2: 本人", "3: 本部门",
|
||||||
"4: 本部门及子部门", "5: 指定部门", "6: 指定人员"
|
"4: 本部门及子部门", "5: 指定部门", "6: 指定人员"
|
||||||
})
|
})
|
||||||
@Getter
|
@Getter
|
||||||
public enum UsableConfigEnum {
|
public enum UsableConfigEnum {
|
||||||
|
|
||||||
|
NO_PROCESSING(0, "无需处理"),
|
||||||
ALL(1, "所有"),
|
ALL(1, "所有"),
|
||||||
SELF(2, "本人"),
|
SELF(2, "本人"),
|
||||||
DEPARTMENT(3, "本部门"),
|
DEPARTMENT(3, "本部门"),
|
||||||
|
|||||||
@@ -55,4 +55,20 @@ public class FunModuleSaveUpdateReq implements Serializable {
|
|||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
@NotNull(message = "是否需要请求参数不能为空")
|
||||||
|
@Schema(description = "是否需要请求参数")
|
||||||
|
private Boolean isReqParams;
|
||||||
|
|
||||||
|
@NotNull(message = "是否需要响应参数不能为空")
|
||||||
|
@Schema(description = "是否需要响应参数")
|
||||||
|
private Boolean isResParams;
|
||||||
|
|
||||||
|
@NotNull(message = "是否分页不能为空")
|
||||||
|
@Schema(description = "是否分页")
|
||||||
|
private Boolean isPage;
|
||||||
|
|
||||||
|
@Pattern(regexp = "^[a-zA-Z]*$", message = "路径参数只能包含英文字符")
|
||||||
|
@Schema(description = "路径参数")
|
||||||
|
private String pathParams;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cczsa.xinghe.codegen.entity.res.funModule;
|
package com.cczsa.xinghe.codegen.entity.res.funModule;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@@ -42,4 +43,16 @@ public class FunModuleQueryRes implements Serializable {
|
|||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
@Schema(description = "是否需要请求参数")
|
||||||
|
private Boolean isReqParams;
|
||||||
|
|
||||||
|
@Schema(description = "是否需要响应参数")
|
||||||
|
private Boolean isResParams;
|
||||||
|
|
||||||
|
@Schema(description = "是否分页")
|
||||||
|
private Boolean isPage;
|
||||||
|
|
||||||
|
@Schema(description = "路径参数")
|
||||||
|
private String pathParams;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class MenuDef extends TableDef {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单
|
* 功能模块配置表
|
||||||
*/
|
*/
|
||||||
public static final MenuDef MENU_ENTITY = new MenuDef();
|
public static final MenuDef MENU_ENTITY = new MenuDef();
|
||||||
|
|
||||||
@@ -27,42 +27,54 @@ public class MenuDef extends TableDef {
|
|||||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单图标
|
* 是否分页
|
||||||
*/
|
*/
|
||||||
public final QueryColumn ICON = new QueryColumn(this, "icon");
|
public final QueryColumn IS_PAGE = new QueryColumn(this, "is_page");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由路径
|
* 描述
|
||||||
*/
|
*/
|
||||||
public final QueryColumn PATH = new QueryColumn(this, "path");
|
public final QueryColumn DESCRIBE = new QueryColumn(this, "describe");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否隐藏
|
* 排序
|
||||||
*/
|
*/
|
||||||
public final QueryColumn IS_HIDE = new QueryColumn(this, "is_hide");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否租户
|
|
||||||
*/
|
|
||||||
public final QueryColumn IS_TENANT = new QueryColumn(this, "is_tenant");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单名称
|
|
||||||
*/
|
|
||||||
public final QueryColumn MENU_NAME = new QueryColumn(this, "menu_name");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 父菜单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");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户端类型:0 PC端,1 小程序端,2 H5端
|
* 模块编码
|
||||||
*/
|
*/
|
||||||
public final QueryColumn CLIENT_TYPE = new QueryColumn(this, "client_type");
|
public final QueryColumn MODULE_CODE = new QueryColumn(this, "module_code");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块名称
|
||||||
|
*/
|
||||||
|
public final QueryColumn MODULE_NAME = new QueryColumn(this, "module_name");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路径参数(与请求参数true互斥)
|
||||||
|
*/
|
||||||
|
public final QueryColumn PATH_PARAMS = new QueryColumn(this, "path_params");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要请求参数
|
||||||
|
*/
|
||||||
|
public final QueryColumn IS_REQ_PARAMS = new QueryColumn(this, "is_req_params");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要响应参数
|
||||||
|
*/
|
||||||
|
public final QueryColumn IS_RES_PARAMS = new QueryColumn(this, "is_res_params");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 包名称
|
||||||
|
*/
|
||||||
|
public final QueryColumn PACKAGE_NAME = new QueryColumn(this, "package_name");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数包名
|
||||||
|
*/
|
||||||
|
public final QueryColumn API_PACKAGE_NAME = new QueryColumn(this, "api_package_name");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有字段。
|
* 所有字段。
|
||||||
@@ -72,10 +84,10 @@ 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, MODULE_NAME, MODULE_CODE, DESCRIBE, PACKAGE_NAME, API_PACKAGE_NAME, SORT_ORDER, IS_REQ_PARAMS, IS_RES_PARAMS, IS_PAGE, PATH_PARAMS};
|
||||||
|
|
||||||
public MenuDef() {
|
public MenuDef() {
|
||||||
super("", "cg_menu");
|
super("", "cg_fun_module");
|
||||||
}
|
}
|
||||||
|
|
||||||
private MenuDef(String schema, String name, String alisa) {
|
private MenuDef(String schema, String name, String alisa) {
|
||||||
@@ -84,7 +96,8 @@ public class MenuDef extends TableDef {
|
|||||||
|
|
||||||
public MenuDef as(String alias) {
|
public MenuDef as(String alias) {
|
||||||
String key = getNameWithSchema() + "." + alias;
|
String key = getNameWithSchema() + "." + alias;
|
||||||
return getCache(key, k -> new MenuDef("", "cg_menu", alias));
|
return getCache(key, k -> new MenuDef("", "cg_fun_module", alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ public class FunModuleServiceImpl implements FunModuleService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public XResult<Void> saveUpdate(FunModuleSaveUpdateReq req) {
|
public XResult<Void> saveUpdate(FunModuleSaveUpdateReq req) {
|
||||||
|
if (req.getIsReqParams() && StrUtil.isNotBlank(req.getPathParams())) {
|
||||||
|
return XResult.failed("请求参数和路径参数冲突");
|
||||||
|
}
|
||||||
// 模块编码不能重复
|
// 模块编码不能重复
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
queryWrapper.eq(FunModuleEntity::getModuleCode, req.getModuleCode());
|
queryWrapper.eq(FunModuleEntity::getModuleCode, req.getModuleCode());
|
||||||
|
|||||||
Reference in New Issue
Block a user