类 SQLBatchBuilder
java.lang.Object
com.sh.wf.module.helper.SQLBatchBuilder
Description: 批量插入更新工具类
Title:首亨软件 - 聚天平台
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明static final intstatic final intstatic final intstatic final intstatic final intstatic final intprotected static org.apache.logging.log4j.Loggerstatic final intstatic final intstatic final int -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明addBigIntCol(String colName, Object obj) addDoubleCol(String colName, Object obj) addIntegerCol(String colName, Object obj) addObjectCol(String colName, Object obj) addStringCol(String colName, Object obj) addSystemTime(String colName) addTextCol(String colName, Object obj) addTimestampCol(String colName, String time, String format) addTimestampCol(String colName, Timestamp timestamp) addTimestampCol(String colName, LocalDateTime localDateTime) addTimestampCol(String colName, Date date) addTimestampColZone(String colName, String time, String format) addWhereBigIntCol(String colName, Object obj) addWhereBigIntCol_in(String colName, String obj) addWhereCol(String colName, String colType, Object obj) addWhereCol_in(String colName, String colType, String obj) addWhereDoubleCol(String colName, Object obj) addWhereIntegerCol(String colName, Object obj) addWhereIntegerCol_in(String colName, String obj) addWhereObjectCol(String colName, Object obj) addWhereStringCol(String colName, Object obj) addWhereStringCol_in(String colName, String obj) addWhereTextCol(String colName, Object obj) asInsert()asUpdate()voidcheckAndRefreshBatch(Duration duration) 手动刷新数据String[]endBatch(boolean commit) 结束批量操作String[]结束一行批量操作intintgetDc()intgetSqlBatchBuilderCol(String colName, boolean isWhereCondition) 获取列信息int获取已经addBatch,但还没有提交的数量intintifExistsQueryFromDBColValue(String... colName) 如果表里的数据已经存在,则从数据库更新非条件列booleanisColExists(String colName) 判断列是否存在,包括条件列或更新列booleanisDebug()int判断记录是否存在booleanisUpdateColExists(String colName) 判断列是否存在booleanisWhereColExists(String colName) 判断条件列是否存在refreshEveryCount(int refreshCount) 设置批量操作每次自动刷新数据量reset()重置setDebug(boolean flag) setNoChangeIgnore(boolean flag) 数据数据没有改变,则不进行更新,注意,只有asInsertOrUpdate()时有效setTableName(String tableName) 表名
-
字段详细资料
-
log4j
protected static org.apache.logging.log4j.Logger log4j -
INSERT
public static final int INSERT- 另请参阅:
-
UPDATE
public static final int UPDATE- 另请参阅:
-
REPLACE
public static final int REPLACE- 另请参阅:
-
INSERT_UPDATE
public static final int INSERT_UPDATE- 另请参阅:
-
INSERT_IGNORE
public static final int INSERT_IGNORE- 另请参阅:
-
EXISTS
public static final int EXISTS- 另请参阅:
-
ERROR
public static final int ERROR- 另请参阅:
-
NOT_EXISTS
public static final int NOT_EXISTS- 另请参阅:
-
EXISTS_IGNORE
public static final int EXISTS_IGNORE- 另请参阅:
-
-
构造器详细资料
-
SQLBatchBuilder
-
-
方法详细资料
-
setDebug
-
setTableName
表名- 参数:
tableName-- 返回:
-
refreshEveryCount
设置批量操作每次自动刷新数据量- 参数:
refreshCount-- 返回:
-
asInsert
-
asInsertIgnore
-
asUpdate
-
asInsertOrUpdate
-
onlyInsert
-
onlyUpdate
-
ifExistsQueryFromDBColValue
如果表里的数据已经存在,则从数据库更新非条件列- 参数:
colName-- 返回:
-
setNoChangeIgnore
数据数据没有改变,则不进行更新,注意,只有asInsertOrUpdate()时有效- 参数:
flag-- 返回:
-
reset
重置- 返回:
-
startBatchRow
-
addWhereCol
-
addWhereCol_in
-
addWhereStringCol
-
addWhereStringCol_in
-
addWhereTextCol
-
addWhereIntegerCol
-
addWhereIntegerCol_in
-
addWhereBigIntCol
-
addWhereBigIntCol_in
-
addWhereDoubleCol
-
addWhereObjectCol
-
addCol
-
addStringCol
-
addTextCol
-
addIntegerCol
-
addBigIntCol
-
addDoubleCol
-
addTimestampCol
-
addTimestampColZone
-
addTimestampCol
-
addTimestampCol
-
addTimestampCol
-
addObjectCol
-
addCol
-
addSystemTime
-
isColExists
判断列是否存在,包括条件列或更新列- 参数:
colName- boolean- 返回:
- boolean
-
isWhereColExists
判断条件列是否存在- 参数:
colName- boolean- 返回:
- boolean
-
isUpdateColExists
判断列是否存在- 参数:
colName- String- 返回:
- boolean
-
addCol
public SQLBatchBuilder addCol(String colName, String colType, Object obj, boolean isWhereCondition, boolean isIn) -
getSqlBatchBuilderCol
public SQLBatchBuilder.SqlBatchBuilderCol getSqlBatchBuilderCol(String colName, boolean isWhereCondition) 获取列信息- 参数:
colName- StringisWhereCondition- boolean- 返回:
- SqlBatchBuilderCol
-
endBatchRow
结束一行批量操作- 返回:
- String[]
-
isRecordExists
public int isRecordExists()判断记录是否存在- 返回:
- int
-
checkAndRefreshBatch
手动刷新数据- 参数:
duration- 时间
-
getTotalNeedCommitRowCount
public int getTotalNeedCommitRowCount()获取已经addBatch,但还没有提交的数量- 返回:
-
endBatch
结束批量操作- 参数:
commit-- 返回:
-
getInsertRow
public int getInsertRow() -
getUpdateRow
public int getUpdateRow() -
getTotalRow
public int getTotalRow() -
getCurRowHasAddCol
public int getCurRowHasAddCol() -
isDebug
public boolean isDebug() -
getCurRow
public int getCurRow() -
getDc
-