public class BeanDBBatchOperator<K> extends BeanDBSingleOperator<K> implements DbBatchOperator<K>
Modifier and Type | Field and Description |
---|---|
protected BeanOperatorManager |
manager |
jdbcTemplate
beanDbNameConverter, configuration, schema
DEFAULT_BEAN_TYPE
Constructor and Description |
---|
BeanDBBatchOperator() |
BeanDBBatchOperator(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
int[] |
batchDelete(Bean[] beans) |
void |
batchDelete(Bean[] beans,
int batchSize) |
int[] |
batchDelete(Collection<Bean> beans) |
void |
batchDelete(Collection<Bean> beans,
int batchSize) |
Bean[] |
batchInsert(Bean[] beans) |
Bean[] |
batchInsert(Bean[] beans,
int batchSize)
可以分批次进行批处理操作
|
Bean[] |
batchInsert(Collection<Bean> beans) |
Bean[] |
batchInsert(Collection<Bean> beans,
int batchSize) |
int[] |
batchUpdate(Bean[] beans) |
void |
batchUpdate(Bean[] beans,
int batchSize) |
int[] |
batchUpdate(Collection<Bean> beans) |
void |
batchUpdate(Collection<Bean> beans,
int batchSize) |
protected org.springframework.jdbc.core.SqlParameterValue |
createSqlParameter(Object value,
ColumnConfiguration primaryColumn) |
protected org.springframework.jdbc.core.SqlParameterValue[] |
createSqlParameterValue(Bean bean) |
protected org.springframework.jdbc.core.SqlParameterValue |
createSqlParamter(Object value,
ColumnConfiguration primaryColumn)
Deprecated.
|
int[] |
deleteBean(Bean[] beans) |
int[] |
deleteById(Collection<K> beanIds,
String beanType) |
int[] |
deleteById(K[] beanIds,
String beanType) |
int[] |
executeBatch(List<String> sqls)
批量执行sql语句
|
int[] |
executeBatchByList(String sql,
List<List<Object>> parameters) |
int[] |
executeBatchByList(String sql,
List<List<Object>> parameters,
int[] columnTypes) |
int[] |
executeBatchByMap(String sql,
List<Map<String,Object>> parameters) |
int |
getAutoIncreaseKey()
如果是自增长类型的Key返回新增加的值
|
Bean[] |
getBeans(Bean bean) |
Bean[] |
getBeansById(Collection<K> beanIds,
String beanType) |
Bean[] |
getBeansById(K[] beanIds,
String beanType) |
protected List<String> |
getColumnNames(Bean bean)
获取操作的所有数据库字段名称
|
protected List<Integer> |
getDataTypes(Bean bean)
获取操作的所有数据库字段类型
|
protected List<Integer> |
getDataTypes(List<ColumnConfiguration> paramsKeys) |
protected List<List<Object>> |
getDeleteParams(Bean[] beans) |
protected String |
getDeleteSqlByKey(String beanType) |
protected List<org.springframework.jdbc.core.SqlParameterValue[]> |
getInsertParams(Bean[] beans) |
BeanOperatorManager |
getManager() |
protected List<Object> |
getParam(Bean bean,
List<ColumnConfiguration> paramsKeys) |
protected List<List<Object>> |
getParamList(Bean[] beans,
List<ColumnConfiguration> paramsKeys) |
protected List<Object> |
getParams(Bean bean) |
protected List<org.springframework.jdbc.core.SqlParameterValue[]> |
getParams(Bean[] beans,
org.springframework.jdbc.core.SqlParameterValue[] values) |
protected String |
getPrimaryFieldName(DbBaseOperator operator,
String beanType) |
protected String |
getPrimaryKeyValue(DbBaseOperator operator,
Bean bean)
获取主键值
|
protected String |
getQuerySql(String beanType) |
Relation |
getRelation(String beanType)
获取关联操作对象
|
String |
getSchema()
获取schame
|
protected org.springframework.jdbc.core.SqlParameterValue[] |
getSqlParameterValue(Bean bean,
List<String> conditionColumns) |
protected org.springframework.jdbc.core.SqlParameterValue[] |
getSqlParameterValues(Bean bean) |
protected org.springframework.jdbc.core.SqlParameterValue[] |
getSqlParamterValue(Bean bean,
List<String> conditionColumns)
Deprecated.
|
protected String |
getTableNameWithSchame(String tableName) |
Bean[] |
insertBean(Bean[] beans)
处理的bean类型可以不一样,非批处理实现方式
|
void |
setManager(BeanOperatorManager manager) |
int[] |
updateBean(Bean[] beans) |
beanNotExist, checkMoreToOne, checkOneToMore, createRelationBean, createRelationBeans, delete, deleteById, deleteTopBean, getBean, getRelationBeans, insert, insertTopBean, processRelation, relationProcess, update, update, updateTopBean
account, beginTransaction, checkNullParamList, commitTransaction, deleteNullParamList, execute, executeBatchBySqlParamterValues, executeBatchOperator, executeBatchOperator, executeByArray, executeByList, executeByMap, executeBySqlParameterValue, executeBySqlParameterValues, findBeans, findBeans, findBeansByList, findBeansByListForCursorPage, findBeansByListForDialectPage, findBeansByListForPage, findBeansByMap, findBeansByMapForCursorPage, findBeansByMapForDialectPage, findBeansByMapForPage, findBeansForCursorPage, findBeansForDialectPage, findBeansForPage, getBeanDbNameConverter, getDialect, getParamArray, getTransactionDefinition, getTransactionManager, getUniqueCode, operatorDebugLog, operatorDebugLogNoParam, operatorErrorLog, operatorErrorLogNoParam, queryForInt, queryForIntByList, queryForIntByMap, queryObject, queryObjectByMap, rollbackTransaction, setBeanDbNameConverter, setDialect, setJdbcTemplate, setTransactionDefinition, setTransactionManager
setConfiguration, setSchema, toDelete, toInsert, toSelect, toUpdate
checkBeanPropertyNull, getConditionParams, getConditionSql, getDeleteSql, getFullTableName, getInsertSql, getTableName, getUpdateSql
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBeanDbNameConverter, getDialect, getUniqueCode, setBeanDbNameConverter, setConfiguration, setDialect, setJdbcTemplate, setSchema
protected BeanOperatorManager manager
public BeanDBBatchOperator()
public BeanDBBatchOperator(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, Configuration configuration)
public Bean[] getBeans(Bean bean) throws TinyDbException
getBeans
in interface DbBatchOperator<K>
TinyDbException
public Bean[] batchInsert(Bean[] beans) throws TinyDbException
batchInsert
in interface DbBatchOperator<K>
TinyDbException
public int[] batchUpdate(Bean[] beans) throws TinyDbException
batchUpdate
in interface DbBatchOperator<K>
TinyDbException
public int[] batchDelete(Bean[] beans) throws TinyDbException
batchDelete
in interface DbBatchOperator<K>
TinyDbException
public int[] deleteById(K[] beanIds, String beanType) throws TinyDbException
deleteById
in interface DbBatchOperator<K>
TinyDbException
public Bean[] getBeansById(K[] beanIds, String beanType) throws TinyDbException
getBeansById
in interface DbBatchOperator<K>
TinyDbException
public Bean[] batchInsert(Collection<Bean> beans) throws TinyDbException
batchInsert
in interface DbBatchOperator<K>
TinyDbException
public Bean[] batchInsert(Collection<Bean> beans, int batchSize) throws TinyDbException
batchInsert
in interface DbBatchOperator<K>
TinyDbException
public int[] batchUpdate(Collection<Bean> beans) throws TinyDbException
batchUpdate
in interface DbBatchOperator<K>
TinyDbException
public void batchUpdate(Collection<Bean> beans, int batchSize) throws TinyDbException
batchUpdate
in interface DbBatchOperator<K>
TinyDbException
public int[] batchDelete(Collection<Bean> beans) throws TinyDbException
batchDelete
in interface DbBatchOperator<K>
TinyDbException
public void batchDelete(Collection<Bean> beans, int batchSize) throws TinyDbException
batchDelete
in interface DbBatchOperator<K>
TinyDbException
public int[] deleteById(Collection<K> beanIds, String beanType) throws TinyDbException
deleteById
in interface DbBatchOperator<K>
TinyDbException
public Bean[] getBeansById(Collection<K> beanIds, String beanType) throws TinyDbException
getBeansById
in interface DbBatchOperator<K>
TinyDbException
public Bean[] batchInsert(Bean[] beans, int batchSize) throws TinyDbException
DbBatchOperator
batchInsert
in interface DbBatchOperator<K>
beans
- 批处理的所有记录batchSize
- 一次批处理最大数量TinyDbException
public void batchUpdate(Bean[] beans, int batchSize) throws TinyDbException
batchUpdate
in interface DbBatchOperator<K>
TinyDbException
public void batchDelete(Bean[] beans, int batchSize) throws TinyDbException
batchDelete
in interface DbBatchOperator<K>
TinyDbException
public Bean[] insertBean(Bean[] beans) throws TinyDbException
DbBatchOperator
insertBean
in interface DbBatchOperator<K>
TinyDbException
public int[] updateBean(Bean[] beans) throws TinyDbException
updateBean
in interface DbBatchOperator<K>
TinyDbException
public int[] deleteBean(Bean[] beans) throws TinyDbException
deleteBean
in interface DbBatchOperator<K>
TinyDbException
public int[] executeBatch(List<String> sqls) throws TinyDbException
DbBatchOperator
executeBatch
in interface DbBatchOperator<K>
TinyDbException
public int[] executeBatchByList(String sql, List<List<Object>> parameters) throws TinyDbException
executeBatchByList
in interface DbBatchOperator<K>
TinyDbException
public int[] executeBatchByList(String sql, List<List<Object>> parameters, int[] columnTypes) throws TinyDbException
executeBatchByList
in interface DbBatchOperator<K>
TinyDbException
public int[] executeBatchByMap(String sql, List<Map<String,Object>> parameters) throws TinyDbException
executeBatchByMap
in interface DbBatchOperator<K>
TinyDbException
public int getAutoIncreaseKey() throws TinyDbException
DbBaseOperator
getAutoIncreaseKey
in interface DbBaseOperator
TinyDbException
protected String getDeleteSqlByKey(String beanType) throws TinyDbException
TinyDbException
protected List<String> getColumnNames(Bean bean)
getColumnNames
in class StatementTransformAdapter
bean
- protected List<Integer> getDataTypes(Bean bean)
bean
- protected org.springframework.jdbc.core.SqlParameterValue[] getSqlParameterValues(Bean bean)
protected List<Integer> getDataTypes(List<ColumnConfiguration> paramsKeys)
@Deprecated protected org.springframework.jdbc.core.SqlParameterValue createSqlParamter(Object value, ColumnConfiguration primaryColumn)
protected org.springframework.jdbc.core.SqlParameterValue createSqlParameter(Object value, ColumnConfiguration primaryColumn)
@Deprecated protected org.springframework.jdbc.core.SqlParameterValue[] getSqlParamterValue(Bean bean, List<String> conditionColumns) throws TinyDbException
TinyDbException
protected org.springframework.jdbc.core.SqlParameterValue[] getSqlParameterValue(Bean bean, List<String> conditionColumns) throws TinyDbException
TinyDbException
protected List<List<Object>> getParamList(Bean[] beans, List<ColumnConfiguration> paramsKeys)
protected List<Object> getParam(Bean bean, List<ColumnConfiguration> paramsKeys)
protected org.springframework.jdbc.core.SqlParameterValue[] createSqlParameterValue(Bean bean) throws TinyDbException
TinyDbException
protected List<org.springframework.jdbc.core.SqlParameterValue[]> getInsertParams(Bean[] beans) throws TinyDbException
TinyDbException
protected List<org.springframework.jdbc.core.SqlParameterValue[]> getParams(Bean[] beans, org.springframework.jdbc.core.SqlParameterValue[] values)
protected String getQuerySql(String beanType) throws TinyDbException
TinyDbException
protected String getTableNameWithSchame(String tableName)
getTableNameWithSchame
in class StatementTransformAdapter
public String getSchema()
DbBaseOperator
getSchema
in interface DbBaseOperator
getSchema
in class StatementTransformAdapter
public BeanOperatorManager getManager()
getManager
in interface DbBaseOperator
public void setManager(BeanOperatorManager manager)
setManager
in interface DbBaseOperator
public Relation getRelation(String beanType)
DbRelationOperator
getRelation
in interface DbRelationOperator
protected String getPrimaryFieldName(DbBaseOperator operator, String beanType) throws TinyDbException
TinyDbException
protected String getPrimaryKeyValue(DbBaseOperator operator, Bean bean) throws TinyDbException
operator
- bean
- TinyDbException
Copyright © 2006–2018 TinyGroup. All rights reserved.