public class DBSpringBaseOperator extends StatementTransformComposite implements TransactionOperator
Modifier and Type | Field and Description |
---|---|
protected org.springframework.jdbc.core.JdbcTemplate |
jdbcTemplate |
beanDbNameConverter, configuration, schema
Constructor and Description |
---|
DBSpringBaseOperator() |
DBSpringBaseOperator(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
int |
account(String sql) |
void |
beginTransaction()
开始事务
|
protected Object[] |
checkNullParamList(List<Object> parameters) |
void |
commitTransaction()
提交事务
|
protected Object[] |
deleteNullParamList(List<Object> parameters) |
Object |
execute(TransactionCallBack callback)
以事务方式执行回调处理
|
protected int[] |
executeBatchBySqlParamterValues(String sql,
List<org.springframework.jdbc.core.SqlParameterValue[]> parameters)
根据参数中sql语句进行批处理操作
|
protected int[] |
executeBatchOperator(String[] sqls) |
protected int[] |
executeBatchOperator(String sql,
List<List<Object>> parameters,
int[] columnTypes)
根据参数中sql语句进行批处理操作
|
int |
executeByArray(String sql,
Object... parameters) |
int |
executeByList(String sql,
List<Object> parameters,
List<Integer> dataTypes) |
int |
executeByMap(String sql,
Map<String,Object> parameters,
List<Integer> dataTypes) |
int |
executeBySqlParameterValue(String sql,
org.springframework.jdbc.core.SqlParameterValue value) |
int |
executeBySqlParameterValues(String sql,
org.springframework.jdbc.core.SqlParameterValue[] values) |
List<Bean> |
findBeans(String sql,
String beanType,
String schema) |
List<Bean> |
findBeans(String sql,
String beanType,
String schema,
Object... parameters) |
List<Bean> |
findBeansByList(String sql,
String beanType,
String schema,
List<Object> parameters) |
protected List<Bean> |
findBeansByListForCursorPage(String sql,
String beanType,
String schema,
int start,
int limit,
List<Object> parameters) |
protected List<Bean> |
findBeansByListForDialectPage(String sql,
String beanType,
String schema,
int start,
int limit,
List<Object> parameters) |
List<Bean> |
findBeansByListForPage(String sql,
String beanType,
String schema,
int start,
int limit,
List<Object> parameters) |
List<Bean> |
findBeansByMap(String sql,
String beanType,
String schema,
Map<String,Object> parameters,
List<Integer> dataTypes) |
protected List<Bean> |
findBeansByMapForCursorPage(String sql,
String beanType,
String schema,
int start,
int limit,
Map<String,Object> parameters,
List<Integer> dataTypes) |
protected List<Bean> |
findBeansByMapForDialectPage(String sql,
String beanType,
String schema,
int start,
int limit,
Map<String,Object> parameters,
List<Integer> dataTypes) |
List<Bean> |
findBeansByMapForPage(String sql,
String beanType,
String schema,
int start,
int limit,
Map<String,Object> parameters,
List<Integer> dataTypes) |
protected List<Bean> |
findBeansForCursorPage(String sql,
String beanType,
String schema,
int start,
int limit) |
protected List<Bean> |
findBeansForDialectPage(String sql,
String beanType,
String schema,
int start,
int limit) |
List<Bean> |
findBeansForPage(String sql,
String beanType,
String schema,
int start,
int limit) |
BeanDbNameConverter |
getBeanDbNameConverter() |
Dialect |
getDialect() |
protected List<Object> |
getParamArray(String sql,
Map<String,Object> parameters,
StringBuffer buf) |
org.springframework.transaction.TransactionDefinition |
getTransactionDefinition() |
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager() |
UUID |
getUniqueCode() |
protected void |
operatorDebugLog(String sql,
Object... parameters) |
protected void |
operatorDebugLogNoParam(String sql) |
protected void |
operatorErrorLog(String sql,
org.springframework.dao.DataAccessException exception,
Object... parameters) |
protected void |
operatorErrorLogNoParam(String sql,
org.springframework.dao.DataAccessException e) |
int |
queryForInt(String sql,
Object... parameters) |
int |
queryForIntByList(String sql,
List<Object> parameters) |
int |
queryForIntByMap(String sql,
Map<String,Object> parameters) |
Object |
queryObject(String sql,
String beanType,
String schema,
Object... parameters) |
Object |
queryObjectByMap(String sql,
String beanType,
String schema,
Map<String,Object> parameters,
List<Integer> dataTypes) |
void |
rollbackTransaction()
回滚事务
|
void |
setBeanDbNameConverter(BeanDbNameConverter beanDbNameConverter) |
void |
setDialect(Dialect dialect) |
void |
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) |
void |
setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition)
设置事务定义,默认为PROPAGATION_REQUIRED,ISOLATION_DEFAULT
|
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
设置事务管理对象
|
setConfiguration, setSchema, toDelete, toInsert, toSelect, toUpdate
checkBeanPropertyNull, getColumnNames, getConditionParams, getConditionSql, getDeleteSql, getFullTableName, getInsertSql, getSchema, getTableName, getTableNameWithSchame, getUpdateSql
public DBSpringBaseOperator()
public DBSpringBaseOperator(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, Configuration configuration)
public UUID getUniqueCode()
public BeanDbNameConverter getBeanDbNameConverter()
public void setBeanDbNameConverter(BeanDbNameConverter beanDbNameConverter)
public Dialect getDialect()
public void setDialect(Dialect dialect)
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
public int account(String sql) throws TinyDbException
TinyDbException
public int executeByList(String sql, List<Object> parameters, List<Integer> dataTypes) throws TinyDbException
TinyDbException
public int executeBySqlParameterValues(String sql, org.springframework.jdbc.core.SqlParameterValue[] values) throws TinyDbException
TinyDbException
public int executeBySqlParameterValue(String sql, org.springframework.jdbc.core.SqlParameterValue value) throws TinyDbException
TinyDbException
protected int[] executeBatchOperator(String sql, List<List<Object>> parameters, int[] columnTypes) throws TinyDbException
sql
- parameters
- dataTypes
- key代表未赋参数值的sql语句 value代表sql语句中的参数列表信息TinyDbException
protected int[] executeBatchOperator(String[] sqls) throws TinyDbException
TinyDbException
protected int[] executeBatchBySqlParamterValues(String sql, List<org.springframework.jdbc.core.SqlParameterValue[]> parameters) throws TinyDbException
sql
- parameters
- key代表未赋参数值的sql语句 value代表sql语句中的参数列表信息TinyDbException
public List<Bean> findBeansForPage(String sql, String beanType, String schema, int start, int limit) throws TinyDbException
TinyDbException
protected List<Bean> findBeansForCursorPage(String sql, String beanType, String schema, int start, int limit) throws TinyDbException
TinyDbException
protected List<Bean> findBeansForDialectPage(String sql, String beanType, String schema, int start, int limit) throws TinyDbException
TinyDbException
public List<Bean> findBeansByListForPage(String sql, String beanType, String schema, int start, int limit, List<Object> parameters) throws TinyDbException
TinyDbException
protected List<Bean> findBeansByListForDialectPage(String sql, String beanType, String schema, int start, int limit, List<Object> parameters) throws TinyDbException
TinyDbException
protected List<Bean> findBeansByListForCursorPage(String sql, String beanType, String schema, int start, int limit, List<Object> parameters) throws TinyDbException
TinyDbException
public List<Bean> findBeansByMapForPage(String sql, String beanType, String schema, int start, int limit, Map<String,Object> parameters, List<Integer> dataTypes) throws TinyDbException
TinyDbException
protected List<Bean> findBeansByMapForDialectPage(String sql, String beanType, String schema, int start, int limit, Map<String,Object> parameters, List<Integer> dataTypes) throws TinyDbException
TinyDbException
protected List<Bean> findBeansByMapForCursorPage(String sql, String beanType, String schema, int start, int limit, Map<String,Object> parameters, List<Integer> dataTypes) throws TinyDbException
TinyDbException
public List<Bean> findBeans(String sql, String beanType, String schema) throws TinyDbException
TinyDbException
public List<Bean> findBeans(String sql, String beanType, String schema, Object... parameters) throws TinyDbException
TinyDbException
public List<Bean> findBeansByList(String sql, String beanType, String schema, List<Object> parameters) throws TinyDbException
TinyDbException
public Object queryObject(String sql, String beanType, String schema, Object... parameters) throws TinyDbException
TinyDbException
public List<Bean> findBeansByMap(String sql, String beanType, String schema, Map<String,Object> parameters, List<Integer> dataTypes) throws TinyDbException
TinyDbException
public Object queryObjectByMap(String sql, String beanType, String schema, Map<String,Object> parameters, List<Integer> dataTypes) throws TinyDbException
TinyDbException
public int executeByMap(String sql, Map<String,Object> parameters, List<Integer> dataTypes) throws TinyDbException
TinyDbException
public int executeByArray(String sql, Object... parameters) throws TinyDbException
TinyDbException
public int queryForInt(String sql, Object... parameters) throws TinyDbException
TinyDbException
public int queryForIntByList(String sql, List<Object> parameters) throws TinyDbException
TinyDbException
public int queryForIntByMap(String sql, Map<String,Object> parameters) throws TinyDbException
TinyDbException
protected List<Object> getParamArray(String sql, Map<String,Object> parameters, StringBuffer buf)
public void beginTransaction()
TransactionOperator
beginTransaction
in interface TransactionOperator
public void commitTransaction()
TransactionOperator
commitTransaction
in interface TransactionOperator
public void rollbackTransaction()
TransactionOperator
rollbackTransaction
in interface TransactionOperator
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
TransactionOperator
setTransactionManager
in interface TransactionOperator
public org.springframework.transaction.TransactionDefinition getTransactionDefinition()
public void setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition)
TransactionOperator
setTransactionDefinition
in interface TransactionOperator
public Object execute(TransactionCallBack callback)
TransactionOperator
execute
in interface TransactionOperator
protected void operatorErrorLog(String sql, org.springframework.dao.DataAccessException exception, Object... parameters)
protected void operatorErrorLogNoParam(String sql, org.springframework.dao.DataAccessException e)
protected void operatorDebugLogNoParam(String sql)
Copyright © 2006–2018 TinyGroup. All rights reserved.