diff --git a/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/DateSegment.java b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/DateSegment.java new file mode 100644 index 00000000..382fd548 --- /dev/null +++ b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/DateSegment.java @@ -0,0 +1,20 @@ +package cn.code.nl.module.base.service.codegen.dto; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 日期段配置 + * + * @author zhouz + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DateSegment extends SegmentConfig { + + /** + * 日期格式,如 "yyyyMMdd"、"yyyyMM"、"yyyy" + */ + private String format; + +} diff --git a/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/PrefixSegment.java b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/PrefixSegment.java new file mode 100644 index 00000000..cd61a833 --- /dev/null +++ b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/PrefixSegment.java @@ -0,0 +1,20 @@ +package cn.code.nl.module.base.service.codegen.dto; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 固定前缀段配置 + * + * @author zhouz + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class PrefixSegment extends SegmentConfig { + + /** + * 固定前缀值,如 "ORD" + */ + private String value; + +} diff --git a/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/SegmentConfig.java b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/SegmentConfig.java new file mode 100644 index 00000000..495bbf56 --- /dev/null +++ b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/SegmentConfig.java @@ -0,0 +1,26 @@ +package cn.code.nl.module.base.service.codegen.dto; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import lombok.Data; + +/** + * 分段配置基类,使用 Jackson 多态序列化/反序列化 + * + * @author zhouz + */ +@Data +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = PrefixSegment.class, name = "PREFIX"), + @JsonSubTypes.Type(value = DateSegment.class, name = "DATE"), + @JsonSubTypes.Type(value = SequenceSegment.class, name = "SEQUENCE") +}) +public abstract class SegmentConfig { + + /** + * 段类型:PREFIX / DATE / SEQUENCE + */ + private String type; + +} diff --git a/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/SequenceSegment.java b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/SequenceSegment.java new file mode 100644 index 00000000..0b0d6057 --- /dev/null +++ b/nl-module-base/nl-module-base-server/src/main/java/cn/code/nl/module/base/service/codegen/dto/SequenceSegment.java @@ -0,0 +1,40 @@ +package cn.code.nl.module.base.service.codegen.dto; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 流水序号段配置 + * + * @author zhouz + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class SequenceSegment extends SegmentConfig { + + /** + * 重置维度:DAY / MONTH / YEAR / GLOBAL + */ + private String resetBy; + + /** + * 起始值,默认 1 + */ + private Long startAt; + + /** + * 补位后的总长度,如 4 → 0001 + */ + private Integer paddingLen; + + /** + * 补位字符,默认 "0" + */ + private String paddingChar; + + /** + * 序号最大值上限 + */ + private Long maxValue; + +}