Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f02fdf5a53 | ||
|
|
464b99a09b | ||
|
|
6a5a8111ee | ||
|
|
1accb4b066 | ||
|
|
c865be0918 |
12
README.md
12
README.md
@@ -8,7 +8,7 @@
|
||||
|
||||
使用方法:
|
||||
|
||||
+ 在项目中放置jar包的地方把seq-1.5.1.jar、seq-1.5.1-sources.jar、seq-1.5.1-pom.xml复制过去
|
||||
+ 在项目中放置jar包的地方把seq-1.5.2.jar、seq-1.5.2-sources.jar、seq-1.5.2-pom.xml复制过去
|
||||
+ 在pom.xml中增加以下内容,然后执行maven命令:mvn clean
|
||||
|
||||
```xml
|
||||
@@ -18,7 +18,7 @@
|
||||
<dependency>
|
||||
<groupId>com.yanghuanglin</groupId>
|
||||
<artifactId>seq</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<version>1.5.2</version>
|
||||
<exclusions>
|
||||
<!-- 如若你项目中有引用spring-jdbc,则需要排除seq的jdbc依赖 -->
|
||||
<exclusion>
|
||||
@@ -50,13 +50,13 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- ${project.basedir}表示当前项目的根目录 -->
|
||||
<file>${project.basedir}/lib/seq-1.5.1.jar</file>
|
||||
<pomFile>${pom.basedir}/lib/seq-1.5.1-pom.xml</pomFile>
|
||||
<sources>${project.basedir}/lib/seq-1.5.1-sources.jar</sources>
|
||||
<file>${project.basedir}/lib/seq-1.5.2.jar</file>
|
||||
<pomFile>${project.basedir}/lib/seq-1.5.2-pom.xml</pomFile>
|
||||
<sources>${project.basedir}/lib/seq-1.5.2-sources.jar</sources>
|
||||
<repositoryLayout>default</repositoryLayout>
|
||||
<groupId>com.yanghuanglin</groupId>
|
||||
<artifactId>seq</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<version>1.5.2</version>
|
||||
<packaging>jar</packaging>
|
||||
<generatePom>true</generatePom>
|
||||
</configuration>
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.yanghuanglin</groupId>
|
||||
<artifactId>seq</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<version>1.5.2</version>
|
||||
<name>seq</name>
|
||||
<description>seq</description>
|
||||
<properties>
|
||||
|
||||
@@ -57,9 +57,9 @@ public class SequencesDaoImpl implements SequencesDao {
|
||||
@Override
|
||||
public void createTable() {
|
||||
String sql = "CREATE TABLE IF NOT EXISTS `%s` ( " +
|
||||
" `%s` VARCHAR ( 255 ) NOT NULL COMMENT '序号英文名称'," +
|
||||
" `%s` VARCHAR ( 255 ) NOT NULL COMMENT '序号类型'," +
|
||||
" `%s` BIGINT ( 2 ) NOT NULL COMMENT '已使用到的序号'," +
|
||||
" `%s` VARCHAR ( 64 ) NOT NULL COMMENT '序号英文名称'," +
|
||||
" `%s` VARCHAR ( 64 ) NOT NULL COMMENT '序号类型'," +
|
||||
" `%s` BIGINT ( 20 ) NOT NULL COMMENT '已使用到的序号'," +
|
||||
" PRIMARY KEY ( `%s`, `%s` ) " +
|
||||
" ) COMMENT '当前序号表'";
|
||||
sql = String.format(sql, tableConfig.getTable(),
|
||||
|
||||
@@ -72,9 +72,9 @@ public class SequencesUnlockDaoImpl implements SequencesUnlockDao {
|
||||
@Override
|
||||
public void createTable() {
|
||||
String sql = "CREATE TABLE IF NOT EXISTS `%s_unlock` ( " +
|
||||
" `%s` VARCHAR ( 255 ) NOT NULL COMMENT '序号英文名称'," +
|
||||
" `%s` VARCHAR ( 255 ) NOT NULL COMMENT '序号类型'," +
|
||||
" `%s` BIGINT ( 2 ) NOT NULL COMMENT '尚未锁定的序号'," +
|
||||
" `%s` VARCHAR ( 64 ) NOT NULL COMMENT '序号英文名称'," +
|
||||
" `%s` VARCHAR ( 64 ) NOT NULL COMMENT '序号类型'," +
|
||||
" `%s` BIGINT ( 20 ) NOT NULL COMMENT '尚未锁定的序号'," +
|
||||
" `%s` DATETIME NOT NULL COMMENT '使用时间'," +
|
||||
" PRIMARY KEY ( `%s`, `%s` ,`%s` ) " +
|
||||
" ) COMMENT '未锁定序号表'";
|
||||
|
||||
@@ -91,9 +91,9 @@ public class SequencesUnusedDaoImpl implements SequencesUnusedDao {
|
||||
@Override
|
||||
public void createTable() {
|
||||
String sql = "CREATE TABLE IF NOT EXISTS `%s_unused` ( " +
|
||||
" `%s` VARCHAR ( 255 ) NOT NULL COMMENT '序号英文名称'," +
|
||||
" `%s` VARCHAR ( 255 ) NOT NULL COMMENT '序号类型'," +
|
||||
" `%s` BIGINT ( 2 ) NOT NULL COMMENT '闲置的的序号'," +
|
||||
" `%s` VARCHAR ( 64 ) NOT NULL COMMENT '序号英文名称'," +
|
||||
" `%s` VARCHAR ( 64 ) NOT NULL COMMENT '序号类型'," +
|
||||
" `%s` BIGINT ( 20 ) NOT NULL COMMENT '闲置的的序号'," +
|
||||
" `%s` DATETIME NOT NULL COMMENT '设为闲置序号的时间'," +
|
||||
" PRIMARY KEY ( `%s`, `%s`, `%s` ) " +
|
||||
" ) COMMENT '闲置序号表'";
|
||||
|
||||
@@ -129,9 +129,9 @@ public class Sequences {
|
||||
* @return 补零后的序号,若未单独设置序号的长度,则最小长度为{@link BaseConfig#getMinLength()}长度;否则为修改后的长度,不足部分补零
|
||||
*/
|
||||
public String format() {
|
||||
BaseConfig baseConfig = BaseConfig.getInstance();
|
||||
if (baseConfig.getMinLength() != null)
|
||||
return String.format("%0" + baseConfig.getMinLength() + "d", this.seq);
|
||||
Integer minLength = BaseConfig.getInstance().getMinLength();
|
||||
if (minLength != null)
|
||||
return String.format("%0" + minLength + "d", this.seq);
|
||||
return String.valueOf(this.seq);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SeqTest {
|
||||
tableConfig.setTable("sequences");
|
||||
tableConfig.setKeyColumn("SEQUENCE_KEY");
|
||||
tableConfig.setTypeColumn("SEQUENCE_TYPE");
|
||||
tableConfig.setSeqColumn("NEXT_ID");
|
||||
tableConfig.setSeqColumn("CURRENT");
|
||||
generatorConfig.setTableConfig(tableConfig);
|
||||
|
||||
generator = new SequencesGenerator(generatorConfig);
|
||||
|
||||
Reference in New Issue
Block a user