forked from baomidou/mybatis-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
61 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
50 changes: 23 additions & 27 deletions
50
DmKeyGenerator → ...extension/incrementer/DmKeyGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...on/src/main/java/com/baomidou/mybatisplus/extension/incrementer/FirebirdKeyGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 19 additions & 19 deletions
38
FirebirdDialect → .../pagination/dialects/FirebirdDialect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
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(); | ||
} | ||
} |