Skip to content

Commit

Permalink
pr 问题修改
Browse files Browse the repository at this point in the history
  • Loading branch information
qmdx committed May 7, 2022
1 parent 7f7a7cf commit 8f9f618
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 70 deletions.
22 changes: 0 additions & 22 deletions FirebirdKeyGenerator

This file was deleted.

50 changes: 23 additions & 27 deletions DmKeyGenerator → ...extension/incrementer/DmKeyGenerator.java
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;
}
}
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
38 changes: 19 additions & 19 deletions FirebirdDialect → .../pagination/dialects/FirebirdDialect.java
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();
}
}

0 comments on commit 8f9f618

Please sign in to comment.