public class BeanDBSingleOperator<K> extends DBSpringBaseOperator implements DbSingleOperator<K>
Modifier and Type | Field and Description |
---|---|
protected BeanOperatorManager |
manager |
jdbcTemplate
beanDbNameConverter, configuration, schema
DEFAULT_BEAN_TYPE
Constructor and Description |
---|
BeanDBSingleOperator() |
BeanDBSingleOperator(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
beanNotExist(Bean bean)
bean对象描述的数据库记录是否存在
|
protected void |
checkMoreToOne(List<Relation> relations) |
protected void |
checkOneToMore(List<Relation> relations) |
protected Bean |
createRelationBean(Bean bean,
Relation relation) |
protected Bean[] |
createRelationBeans(Bean bean,
Relation relation) |
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 |
delete(Bean bean) |
int |
deleteById(K beanId,
String beanType) |
protected int |
deleteTopBean(Bean bean) |
int |
getAutoIncreaseKey()
如果是自增长类型的Key返回新增加的值
|
Bean |
getBean(K beanId,
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)
获取关联操作对象
|
protected Bean[] |
getRelationBeans(Bean bean,
String collectionMode,
String relationKeyName) |
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 |
insert(Bean bean) |
protected void |
insertTopBean(Bean bean) |
protected Bean |
processRelation(Bean bean,
Relation relation,
org.tinygroup.tinydb.operator.impl.BeanDBSingleOperator.RelationCallBack callBack) |
protected Bean[] |
relationProcess(String beanType,
List<Bean> beans) |
void |
setManager(BeanOperatorManager manager) |
int |
update(Bean bean) |
int |
update(Bean bean,
List<String> conditionColumns) |
protected int |
updateTopBean(Bean bean)
更新最上层bean
|
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 BeanDBSingleOperator()
public BeanDBSingleOperator(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, Configuration configuration)
public Bean insert(Bean bean) throws TinyDbException
insert
in interface DbSingleOperator<K>
TinyDbException
protected boolean beanNotExist(Bean bean) throws TinyDbException
bean
- TinyDbException
protected void insertTopBean(Bean bean) throws TinyDbException
TinyDbException
public int update(Bean bean) throws TinyDbException
update
in interface DbSingleOperator<K>
TinyDbException
public int update(Bean bean, List<String> conditionColumns) throws TinyDbException
update
in interface DbSingleOperator<K>
bean
- bean对象conditionColumns
- 条件字段- 数据库字段大写名称的列表集合TinyDbException
protected Bean[] getRelationBeans(Bean bean, String collectionMode, String relationKeyName)
protected int updateTopBean(Bean bean) throws TinyDbException
bean
- TinyDbException
public int delete(Bean bean) throws TinyDbException
delete
in interface DbSingleOperator<K>
TinyDbException
protected int deleteTopBean(Bean bean) throws TinyDbException
TinyDbException
public Bean getBean(K beanId, String beanType) throws TinyDbException
getBean
in interface DbSingleOperator<K>
TinyDbException
protected Bean processRelation(Bean bean, Relation relation, org.tinygroup.tinydb.operator.impl.BeanDBSingleOperator.RelationCallBack callBack) throws TinyDbException
TinyDbException
protected void checkMoreToOne(List<Relation> relations) throws TinyDbException
TinyDbException
protected Bean createRelationBean(Bean bean, Relation relation) throws TinyDbException
TinyDbException
protected Bean[] createRelationBeans(Bean bean, Relation relation) throws TinyDbException
TinyDbException
public int deleteById(K beanId, String beanType) throws TinyDbException
deleteById
in interface DbSingleOperator<K>
TinyDbException
protected Bean[] relationProcess(String beanType, List<Bean> beans) throws TinyDbException
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.