1. 新增统一的业务编码生成功能
This commit is contained in:
@@ -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>
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
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 com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@@ -17,6 +19,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@AutoConfiguration
|
||||
@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理
|
||||
@EnableConfigurationProperties(DruidStatProperties.class)
|
||||
@EnableFeignClients(clients = SequenceCommonApi.class)
|
||||
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 org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author chenbowen
|
||||
*/
|
||||
@@ -33,6 +35,9 @@ public class BusinessBaseDO extends BaseDO {
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> inputStrs;
|
||||
|
||||
/**
|
||||
* 清除 creator、createTime、updateTime、updater 等字段,避免前端直接传递这些字段,导致被更新
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user