diff --git a/FirebirdKeyGenerator b/FirebirdKeyGenerator deleted file mode 100644 index 334e552f35..0000000000 --- a/FirebirdKeyGenerator +++ /dev/null @@ -1,22 +0,0 @@ -package com.baomidou.mybatisplus.extension.incrementer; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.baomidou.mybatisplus.annotation.DbType; - -import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; - -public class FirebirdKeyGenerator implements IKeyGenerator { - @Override - public String executeSql(String incrementerName) { - // TODO Auto-generated method stub - return "SELECT next value for " + incrementerName + " from rdb$database"; - } - - @Override - public DbType dbType() { - // TODO Auto-generated method stub - return DbType.FIREBIRD; - } -} diff --git a/DmKeyGenerator b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/DmKeyGenerator.java similarity index 75% rename from DmKeyGenerator rename to mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/DmKeyGenerator.java index 279837ffdb..86089dcb51 100644 --- a/DmKeyGenerator +++ b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/DmKeyGenerator.java @@ -1,27 +1,23 @@ -package com.baomidou.mybatisplus.extension.incrementer; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.baomidou.mybatisplus.annotation.DbType; -import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; - -/** - * DM Sequence - * - * @author cdtjj - * @since 2022-04-22 - */ - -public class DmKeyGenerator implements IKeyGenerator { - @Override - public String executeSql(String incrementerName) { - // TODO Auto-generated method stub - return "SELECT " + incrementerName + ".NEXTVAL FROM DUAL"; - } - - @Override - public DbType dbType() { - // TODO Auto-generated method stub - return DbType.DM; - } -} +package com.baomidou.mybatisplus.extension.incrementer; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; + +/** + * DM Sequence + * + * @author cdtjj + * @since 2022-04-22 + */ +public class DmKeyGenerator implements IKeyGenerator { + + @Override + public String executeSql(String incrementerName) { + return "SELECT " + incrementerName + ".NEXTVAL FROM DUAL"; + } + + @Override + public DbType dbType() { + return DbType.DM; + } +} diff --git a/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/FirebirdKeyGenerator.java b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/FirebirdKeyGenerator.java new file mode 100644 index 0000000000..a694d7979f --- /dev/null +++ b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/FirebirdKeyGenerator.java @@ -0,0 +1,17 @@ +package com.baomidou.mybatisplus.extension.incrementer; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; + +public class FirebirdKeyGenerator implements IKeyGenerator { + + @Override + public String executeSql(String incrementerName) { + return "SELECT next value for " + incrementerName + " from rdb$database"; + } + + @Override + public DbType dbType() { + return DbType.FIREBIRD; + } +} diff --git a/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/DialectFactory.java b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/DialectFactory.java index c8edf6d132..24c58a2449 100644 --- a/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/DialectFactory.java +++ b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/DialectFactory.java @@ -80,9 +80,9 @@ else if (dbType == DbType.POSTGRE_SQL dialect = new SybaseDialect(); } else if (dbType == DbType.GBASEDBT) { dialect = new GBasedbtDialect(); - } else if (dbType == DbType.GBASE_INFORMIX){ + } else if (dbType == DbType.GBASE_INFORMIX) { dialect = new GBaseInfromixDialect(); - } else if (dbType == DbType.FIREBIRD){ + } else if (dbType == DbType.FIREBIRD) { dialect = new FirebirdDialect(); } DIALECT_ENUM_MAP.put(dbType, dialect); diff --git a/FirebirdDialect b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/FirebirdDialect.java similarity index 81% rename from FirebirdDialect rename to mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/FirebirdDialect.java index e9560b3c2f..9cc6604012 100644 --- a/FirebirdDialect +++ b/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/FirebirdDialect.java @@ -1,19 +1,19 @@ -package com.baomidou.mybatisplus.extension.plugins.pagination.dialects; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.DialectModel; -import com.baomidou.mybatisplus.extension.plugins.pagination.dialects.IDialect; - -/** - * Firebird 数据库分页语句组装实现,SQL测试版本为4.0 - * 备注:The FIRST/SKIP and ROWS clause are non-standard alternatives - * @author cdtjj - * @since 2022-04-26 - */ -public class FirebirdDialect implements IDialect { - @Override - public DialectModel buildPaginationSql(String originalSql, long offset, long limit) { - String sql = originalSql + " OFFSET " + FIRST_MARK + " ROWS FETCH NEXT " + SECOND_MARK + " ROWS ONLY"; - return new DialectModel(sql, offset, limit).setConsumerChain(); - } -} \ No newline at end of file +package com.baomidou.mybatisplus.extension.plugins.pagination.dialects; + +import com.baomidou.mybatisplus.extension.plugins.pagination.DialectModel; + +/** + * Firebird 数据库分页语句组装实现,SQL测试版本为4.0 + * 备注:The FIRST/SKIP and ROWS clause are non-standard alternatives + * + * @author cdtjj + * @since 2022-04-26 + */ +public class FirebirdDialect implements IDialect { + + @Override + public DialectModel buildPaginationSql(String originalSql, long offset, long limit) { + String sql = originalSql + " OFFSET " + FIRST_MARK + " ROWS FETCH NEXT " + SECOND_MARK + " ROWS ONLY"; + return new DialectModel(sql, offset, limit).setConsumerChain(); + } +}