@@ -205,3 +205,58 @@ VALUES (
|
|||||||
'1953702581324398598', '系统序列号导出', 'system:sequence:export', 3, 5, 1953701540574969857,
|
'1953702581324398598', '系统序列号导出', 'system:sequence:export', 3, 5, 1953701540574969857,
|
||||||
'', '', '', 0
|
'', '', '', 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- 系统序列号相关字典数据初始化脚本(达梦8版)
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 1. 系统序列号循环类型字典
|
||||||
|
-- ========================================
|
||||||
|
|
||||||
|
-- 插入字典类型
|
||||||
|
INSERT INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted, deleted_time)
|
||||||
|
VALUES (500, '系统序列号循环类型', 'system_sequence_cycle_type', 0, '系统序列号循环类型枚举', 'admin', SYSDATE, 'admin', SYSDATE, 0, NULL);
|
||||||
|
|
||||||
|
-- 插入字典数据
|
||||||
|
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted)
|
||||||
|
VALUES
|
||||||
|
(5001, 1, '年循环', 'Y', 'system_sequence_cycle_type', 0, 'primary', '', '年循环。示例: 2025', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5002, 2, '年-月循环', 'Y-M', 'system_sequence_cycle_type', 0, 'success', '', '年-月循环。示例: 2025-08', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5003, 3, '年月紧凑', 'YM', 'system_sequence_cycle_type', 0, 'info', '', '年月紧凑。示例: 202508', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5004, 4, '两位年+月', 'yM', 'system_sequence_cycle_type', 0, 'warning', '', '两位年+月。示例: 2508', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5005, 5, '年-月-日循环', 'Y-M-D', 'system_sequence_cycle_type', 0, 'primary', '', '年-月-日循环。示例: 2025-08-08', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5006, 6, '年月日紧凑', 'YMD', 'system_sequence_cycle_type', 0, 'success', '', '年月日紧凑。示例: 20250808', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5007, 7, '两位年+月日', 'yMD', 'system_sequence_cycle_type', 0, 'info', '', '两位年+月日。示例: 250808', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5008, 8, '自定义循环值', 'CUST', 'system_sequence_cycle_type', 0, 'warning', '', '自定义循环值;若未传 circulationValue,则默认用 seqId', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5009, 9, '仅前缀', 'PFX', 'system_sequence_cycle_type', 0, 'danger', '', '仅前缀,不需要时间循环值(不设置则不抛错)', 'admin', SYSDATE, 'admin', SYSDATE, 0);
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 2. 系统序列号分段类型字典
|
||||||
|
-- ========================================
|
||||||
|
|
||||||
|
-- 插入字典类型
|
||||||
|
INSERT INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted, deleted_time)
|
||||||
|
VALUES (501, '系统序列号分段类型', 'system_sequence_detail_type', 0, '系统序列号分段类型枚举', 'admin', SYSDATE, 'admin', SYSDATE, 0, NULL);
|
||||||
|
|
||||||
|
-- 插入字典数据
|
||||||
|
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted)
|
||||||
|
VALUES
|
||||||
|
(5011, 1, '默认字符分段', 'STR', 'system_sequence_detail_type', 0, 'primary', '', '固定字符串分段', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5012, 2, '给定字符分段', 'INPUT', 'system_sequence_detail_type', 0, 'success', '', '根据输入参数动态生成的字符分段', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5013, 3, '日期分段', 'DATE', 'system_sequence_detail_type', 0, 'info', '', '基于日期格式的分段', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5014, 4, '流水号分段', 'SEQ', 'system_sequence_detail_type', 0, 'warning', '', '自增流水号分段', 'admin', SYSDATE, 'admin', SYSDATE, 0);
|
||||||
|
|
||||||
|
-- ========================================
|
||||||
|
-- 3. 系统序列号分段规则类型字典
|
||||||
|
-- ========================================
|
||||||
|
|
||||||
|
-- 插入字典类型
|
||||||
|
INSERT INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted, deleted_time)
|
||||||
|
VALUES (502, '系统序列号分段规则类型', 'system_sequence_detail_rule_type', 0, '系统序列号分段规则类型枚举', 'admin', SYSDATE, 'admin', SYSDATE, 0, NULL);
|
||||||
|
|
||||||
|
-- 插入字典数据
|
||||||
|
INSERT INTO system_dict_data (id, sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted)
|
||||||
|
VALUES
|
||||||
|
(5021, 1, '固定值', 'FIXED', 'system_sequence_detail_rule_type', 0, 'primary', '', '固定字符串值', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5022, 2, '日期格式', 'DATE', 'system_sequence_detail_rule_type', 0, 'success', '', '日期格式规则', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5023, 3, '数字格式', 'NUMBER', 'system_sequence_detail_rule_type', 0, 'info', '', '数字格式规则', 'admin', SYSDATE, 'admin', SYSDATE, 0),
|
||||||
|
(5024, 4, '自定义格式', 'CUSTOM', 'system_sequence_detail_rule_type', 0, 'warning', '', '自定义格式规则', 'admin', SYSDATE, 'admin', SYSDATE, 0); (5024, 4, '自定义格式', 'CUSTOM', 'system_sequence_detail_rule_type', 0, 'warning', '', '自定义格式规则', 'admin', NOW(), 'admin', NOW(), b'0');
|
||||||
|
|||||||
@@ -4934,4 +4934,4 @@ COMMENT ON COLUMN system_seq_rcd.create_time IS '创建时间';
|
|||||||
COMMENT ON COLUMN system_seq_rcd.updater IS '更新者';
|
COMMENT ON COLUMN system_seq_rcd.updater IS '更新者';
|
||||||
COMMENT ON COLUMN system_seq_rcd.update_time IS '更新时间';
|
COMMENT ON COLUMN system_seq_rcd.update_time IS '更新时间';
|
||||||
COMMENT ON COLUMN system_seq_rcd.deleted IS '是否删除';
|
COMMENT ON COLUMN system_seq_rcd.deleted IS '是否删除';
|
||||||
COMMENT ON TABLE system_seq_rcd IS '系统序列号记录表';
|
COMMENT ON TABLE system_seq_rcd IS '系统序列号记录表';
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.framework.common.biz.system.sequence;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author chenbowen
|
||||||
|
*/
|
||||||
|
@FeignClient(name = RpcConstants.SYSTEM_NAME)
|
||||||
|
@Tag(name = "序列管理 Api")
|
||||||
|
public interface SequenceCommonApi {
|
||||||
|
|
||||||
|
String PREFIX = RpcConstants.SYSTEM_PREFIX + "/sequence";
|
||||||
|
|
||||||
|
@PostMapping(PREFIX + "/next-sequence")
|
||||||
|
@Operation(summary = "获取下一个序列号")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "sequenceCode", description = "序列编码", example = "ORDER_NO", required = true),
|
||||||
|
@Parameter(name = "circulationValue", description = "循环值", example = "20250811"),
|
||||||
|
@Parameter(name = "inputStrs", description = "输入参数", example = "[\"A\",\"B\"]")
|
||||||
|
})
|
||||||
|
CommonResult<String> getNextSequence(@RequestParam("sequenceCode") String sequenceCode,
|
||||||
|
@RequestParam(value = "circulationValue", required = false) String circulationValue,
|
||||||
|
@RequestParam(value = "inputStrs", required = false) List<String> inputStrs);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package cn.iocoder.yudao.framework.business.annotation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author chenbowen
|
|
||||||
*
|
|
||||||
* 业务代码自动补全的注解,在 DO filed 中与 @TableField(fill = FieldFill.INSERT) 一起标注后自动新增时生成 Code chenbowen
|
|
||||||
*/
|
|
||||||
public @interface BusinessCode {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -103,6 +103,11 @@
|
|||||||
<groupId>cn.iocoder.cloud</groupId>
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package cn.iocoder.yudao.framework.datasource.config;
|
package cn.iocoder.yudao.framework.datasource.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.biz.system.sequence.SequenceCommonApi;
|
||||||
import cn.iocoder.yudao.framework.datasource.core.filter.DruidAdRemoveFilter;
|
import cn.iocoder.yudao.framework.datasource.core.filter.DruidAdRemoveFilter;
|
||||||
import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
|
import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
@@ -17,6 +19,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理
|
@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理
|
||||||
@EnableConfigurationProperties(DruidStatProperties.class)
|
@EnableConfigurationProperties(DruidStatProperties.class)
|
||||||
|
@EnableFeignClients(clients = SequenceCommonApi.class)
|
||||||
public class YudaoDataSourceAutoConfiguration {
|
public class YudaoDataSourceAutoConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.framework.mybatis.core.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author chenbowen
|
||||||
|
*/
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface BusinessCode {
|
||||||
|
String value();
|
||||||
|
String circulationValueField() default "";
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.ibatis.type.JdbcType;
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author chenbowen
|
* @author chenbowen
|
||||||
*/
|
*/
|
||||||
@@ -33,6 +35,9 @@ public class BusinessBaseDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> inputStrs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除 creator、createTime、updateTime、updater 等字段,避免前端直接传递这些字段,导致被更新
|
* 清除 creator、createTime、updateTime、updater 等字段,避免前端直接传递这些字段,导致被更新
|
||||||
*/
|
*/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,30 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.sequence;
|
package cn.iocoder.yudao.module.system.api.sequence;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.biz.system.sequence.SequenceCommonApi;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author chenbowen
|
* @author chenbowen
|
||||||
*/
|
*/
|
||||||
@FeignClient(name = ApiConstants.NAME)
|
@FeignClient(name = ApiConstants.NAME, primary = false) // TODO 芋艿:fallbackFactory =
|
||||||
@Tag(name = "序列管理 Api")
|
@Tag(name = "RPC 服务 - 序列号")
|
||||||
public interface SequenceApi {
|
public interface SequenceApi extends SequenceCommonApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/sequence";
|
||||||
|
|
||||||
|
@PostMapping(PREFIX + "/next-sequence")
|
||||||
|
@Operation(summary = "获取下一个序列号")
|
||||||
|
@Override
|
||||||
|
CommonResult<String> getNextSequence(@RequestParam("sequenceCode") String sequenceCode,
|
||||||
|
@RequestParam(value = "circulationValue", required = false) String circulationValue,
|
||||||
|
@RequestParam(value = "inputStrs", required = false) List<String> inputStrs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user