diff --git a/docs/nacos/nacos_config.zip b/docs/nacos/nacos_config.zip index 839ddc882..f79e9f25a 100644 Binary files a/docs/nacos/nacos_config.zip and b/docs/nacos/nacos_config.zip differ diff --git a/youlai-system/system-boot/src/main/java/com/youlai/system/enums/FormTypeEnum.java b/youlai-system/system-boot/src/main/java/com/youlai/system/enums/FormTypeEnum.java new file mode 100644 index 000000000..9612d4cf2 --- /dev/null +++ b/youlai-system/system-boot/src/main/java/com/youlai/system/enums/FormTypeEnum.java @@ -0,0 +1,84 @@ +package com.youlai.system.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.youlai.boot.common.base.IBaseEnum; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 表单类型枚举 + * + * @author Ray + * @since 2.10.0 + */ +@Getter +@RequiredArgsConstructor +public enum FormTypeEnum implements IBaseEnum { + + /** + * 输入框 + */ + INPUT(1, "输入框"), + + /** + * 下拉框 + */ + SELECT(2, "下拉框"), + + /** + * 单选框 + */ + RADIO(3, "单选框"), + + /** + * 复选框 + */ + CHECK_BOX(4, "复选框"), + + /** + * 数字输入框 + */ + INPUT_NUMBER(5, "数字输入框"), + + /** + * 开关 + */ + SWITCH(6, "开关"), + + /** + * 文本域 + */ + TEXT_AREA(7, "文本域"), + + /** + * 日期时间框 + */ + DATE(8, "日期框"), + + /** + * 日期框 + */ + DATE_TIME(9, "日期时间框"); + + + // Mybatis-Plus 提供注解表示插入数据库时插入该值 + @EnumValue + @JsonValue + private final Integer value; + + // @JsonValue // 表示对枚举序列化时返回此字段 + private final String label; + + + @JsonCreator + public static QueryTypeEnum fromValue(Integer value) { + for (QueryTypeEnum type : QueryTypeEnum.values()) { + if (type.getValue().equals(value)) { + return type; + } + } + throw new IllegalArgumentException("No enum constant with value " + value); + } +} diff --git a/youlai-system/system-boot/src/main/java/com/youlai/system/enums/QueryTypeEnum.java b/youlai-system/system-boot/src/main/java/com/youlai/system/enums/QueryTypeEnum.java new file mode 100644 index 000000000..dcd56392f --- /dev/null +++ b/youlai-system/system-boot/src/main/java/com/youlai/system/enums/QueryTypeEnum.java @@ -0,0 +1,73 @@ +package com.youlai.system.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.youlai.boot.common.base.IBaseEnum; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 查询类型枚举 + * + * @author Ray + * @since 2.10.0 + */ +@Getter +@RequiredArgsConstructor +public enum QueryTypeEnum implements IBaseEnum { + + /** 等于 */ + EQ(1, "="), + + /** 模糊匹配 */ + LIKE(2, "LIKE '%s%'"), + + /** 包含 */ + IN(3, "IN"), + + /** 范围 */ + BETWEEN(4, "BETWEEN"), + + /** 大于 */ + GT(5, ">"), + + /** 大于等于 */ + GE(6, ">="), + + /** 小于 */ + LT(7, "<"), + + /** 小于等于 */ + LE(8, "<="), + + /** 不等于 */ + NE(9, "!="), + + /** 左模糊匹配 */ + LIKE_LEFT(10, "LIKE '%s'"), + + /** 右模糊匹配 */ + LIKE_RIGHT(11, "LIKE 's%'"); + + + // 存储在数据库中的枚举属性值 + @EnumValue + @JsonValue + private final Integer value; + + // 序列化成 JSON 时的属性值 + private final String label; + + + @JsonCreator + public static QueryTypeEnum fromValue(Integer value) { + for (QueryTypeEnum type : QueryTypeEnum.values()) { + if (type.getValue().equals(value)) { + return type; + } + } + throw new IllegalArgumentException("No enum constant with value " + value); + } + +} diff --git a/youlai-system/system-boot/src/main/java/com/youlai/system/model/entity/GenFieldConfig.java b/youlai-system/system-boot/src/main/java/com/youlai/system/model/entity/GenFieldConfig.java index 872e70efc..949d8eae9 100644 --- a/youlai-system/system-boot/src/main/java/com/youlai/system/model/entity/GenFieldConfig.java +++ b/youlai-system/system-boot/src/main/java/com/youlai/system/model/entity/GenFieldConfig.java @@ -3,9 +3,9 @@ package com.youlai.system.model.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.youlai.boot.common.base.BaseEntity; -import com.youlai.boot.common.enums.FormTypeEnum; -import com.youlai.boot.common.enums.QueryTypeEnum; +import com.youlai.common.base.BaseEntity; +import com.youlai.system.enums.FormTypeEnum; +import com.youlai.system.enums.QueryTypeEnum; import lombok.Getter; import lombok.Setter; diff --git a/youlai-system/system-boot/src/main/java/com/youlai/system/model/form/GenConfigForm.java b/youlai-system/system-boot/src/main/java/com/youlai/system/model/form/GenConfigForm.java new file mode 100644 index 000000000..18b565600 --- /dev/null +++ b/youlai-system/system-boot/src/main/java/com/youlai/system/model/form/GenConfigForm.java @@ -0,0 +1,103 @@ +package com.youlai.system.model.form; + +import com.youlai.system.enums.FormTypeEnum; +import com.youlai.system.enums.QueryTypeEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * 代码生成配置表单 + * + * @author Ray + * @since 2.10.0 + */ +@Schema(description = "代码生成配置表单") +@Data +public class GenConfigForm { + + @Schema(description = "主键",example = "1") + private Long id; + + @Schema(description = "表名",example = "sys_user") + private String tableName; + + @Schema(description = "业务名",example = "用户") + private String businessName; + + @Schema(description = "模块名",example = "system") + private String moduleName; + + @Schema(description = "包名",example = "com.youlai") + private String packageName; + + @Schema(description = "实体名",example = "User") + private String entityName; + + @Schema(description = "作者",example = "youlaitech") + private String author; + + @Schema(description = "上级菜单ID",example = "1") + private Long parentMenuId; + + @Schema(description = "字段配置列表") + private List fieldConfigs; + + @Schema(description = "后端应用名") + private String backendAppName; + + @Schema(description = "前端应用名") + private String frontendAppName; + + @Schema(description = "字段配置") + @Data + public static class FieldConfig { + + @Schema(description = "主键") + private Long id; + + @Schema(description = "列名") + private String columnName; + + @Schema(description = "列类型") + private String columnType; + + @Schema(description = "字段名") + private String fieldName; + + @Schema(description = "字段排序") + private Integer fieldSort; + + @Schema(description = "字段类型") + private String fieldType; + + @Schema(description = "字段描述") + private String fieldComment; + + @Schema(description = "是否在列表显示") + private Integer isShowInList; + + @Schema(description = "是否在表单显示") + private Integer isShowInForm; + + @Schema(description = "是否在查询条件显示") + private Integer isShowInQuery; + + @Schema(description = "是否必填") + private Integer isRequired; + + @Schema(description = "最大长度") + private Integer maxLength; + + @Schema(description = "表单类型") + private FormTypeEnum formType; + + @Schema(description = "查询类型") + private QueryTypeEnum queryType; + + @Schema(description = "字典类型") + private String dictType; + + } +}