类 SqlToyDaoSupport
- java.lang.Object
-
- org.sagacity.sqltoy.support.SqlToyDaoSupport
-
- 直接已知子类:
SpringDaoSupport
public class SqlToyDaoSupport extends Object
- 版本:
- v4.0,Date:2012-6-1
- 作者:
- zhongxuchen
-
-
字段概要
字段 修饰符和类型 字段 说明 protected DataSourcedataSource数据源protected SaveModeIGNOREprotected org.slf4j.Loggerlogger定义日志protected SqlToyContextsqlToyContextsqlToy上下文定义protected SaveModeUPDATE
-
构造器概要
构造器 构造器 说明 SqlToyDaoSupport()
-
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected Batchbatch()protected LongbatchUpdate(String sqlOrSqlId, List dataSet, int batchSize, Boolean autoCommit)protected LongbatchUpdate(String sqlOrSqlId, List dataSet, int batchSize, Boolean autoCommit, DataSource dataSource)protected LongbatchUpdate(String sqlOrSqlId, List dataSet, Boolean autoCommit)protected String[]cacheMatchKeys(String matchRegex, CacheMatchFilter cacheMatchFilter)已过时。protected String[]cacheMatchKeys(CacheMatchFilter cacheMatchFilter, String... matchRegexes)protected <T extends Serializable>
TconvertType(Serializable source, Class<T> resultType, String... ignoreProperties)protected <T extends Serializable>
List<T>convertType(List sourceList, Class<T> resultType, String... ignoreProperties)protected <T extends Serializable>
Page<T>convertType(Page sourcePage, Class<T> resultType, String... ignoreProperties)protected Deletedelete()protected Longdelete(Serializable entity)protected Longdelete(Serializable entity, DataSource dataSource)protected <T extends Serializable>
LongdeleteAll(List<T> entities)protected <T extends Serializable>
LongdeleteAll(List<T> entities, DataSource dataSource)protected LongdeleteByIds(Class entityClass, Object... ids)protected LongdeleteByQuery(Class entityClass, EntityQuery entityQuery)protected Elasticelastic()protected Executeexecute()protected LongexecuteSql(String sqlOrSqlId)protected LongexecuteSql(String sqlOrSqlId, Serializable entity)protected LongexecuteSql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue)protected LongexecuteSql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Boolean autoCommit, DataSource dataSource)protected LongexecuteSql(String sqlOrSqlId, Map<String,Object> paramsMap)protected StoreResultexecuteStore(String storeSqlOrKey, Object[] inParamValues)protected StoreResultexecuteStore(String storeSqlOrKey, Object[] inParamValues, Integer[] outParamsType, Class resultType)protected StoreResultexecuteStore(String storeSqlOrKey, Object[] inParamsValue, Integer[] outParamsType, Class resultType, DataSource dataSource)protected booleanexistCache(String cacheName)protected voidfetchStream(QueryExecutor queryExecutor, StreamResultHandler streamResultHandler)protected QueryResultfindByQuery(QueryExecutor queryExecutor)protected <T> List<T>findBySql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType)protected <T> List<T>findBySql(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)protected <T extends Serializable>
List<T>findBySql(String sqlOrSqlId, T entity)protected <T> List<T>findEntity(Class<T> entityClass, EntityQuery entityQuery)protected <T> List<T>findEntity(Class entityClass, EntityQuery entityQuery, Class<T> resultType)protected QueryResultfindPageByQuery(Page page, QueryExecutor queryExecutor)protected <T> Page<T>findPageBySql(Page page, String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType)protected <T> Page<T>findPageBySql(Page page, String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)protected <T extends Serializable>
Page<T>findPageBySql(Page page, String sqlOrSqlId, T entity)protected <T> Page<T>findPageEntity(Page page, Class<T> entityClass, EntityQuery entityQuery)protected <T> Page<T>findPageEntity(Page page, Class entityClass, EntityQuery entityQuery, Class<T> resultType)protected QueryResultfindTopByQuery(QueryExecutor queryExecutor, double topSize)protected <T> List<T>findTopBySql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType, double topSize)protected <T> List<T>findTopBySql(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType, double topSize)protected <T extends Serializable>
List<T>findTopBySql(String sqlOrSqlId, T entity, double topSize)protected voidflush()protected voidflush(DataSource dataSource)protected StringgenerateBizId(Serializable entity)protected longgenerateBizId(String signature, int increment)protected intgetBatchSize()protected Set<String>getCacheNames()protected LonggetCountByEntityQuery(Class entityClass, EntityQuery entityQuery)protected LonggetCountByQuery(QueryExecutor queryExecutor)protected LonggetCountBySql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue)protected LonggetCountBySql(String sqlOrSqlId, Map<String,Object> paramsMap)protected DataSourcegetDataSource(DataSource pointDataSource)protected StringgetDialect(DataSource dataSource)protected EntityMetagetEntityMeta(Class entityClass)protected <T> List<T>getRandomResult(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType, double randomCount)protected <T> List<T>getRandomResult(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType, double randomCount)protected QueryResultgetRandomResult(QueryExecutor queryExecutor, double randomCount)protected ObjectgetSingleValue(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue)已过时。protected ObjectgetSingleValue(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, DataSource dataSource)protected ObjectgetSingleValue(String sqlOrSqlId, Map<String,Object> paramsMap)protected <T> TgetSingleValue(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)protected SqlToyConfiggetSqlToyConfig(String sqlKey, SqlType sqlType)protected SqlToyContextgetSqlToyContext()protected List<ColumnMeta>getTableColumns(String catalog, String schema, String tableName, DataSource dataSource)protected List<TableMeta>getTables(String catalog, String schema, String tableName, DataSource dataSource)protected HashMap<String,Object[]>getTranslateCache(String cacheName, String cacheType)protected <T> List<T>getTranslateCache(String cacheName, String cacheType, Class<T> reusltType)protected booleanisUnique(Serializable entity, String... paramsNamed)protected booleanisUnique(UniqueExecutor uniqueExecutor)protected Loadload()protected <T extends Serializable>
Tload(T entity)protected <T extends Serializable>
Tload(T entity, LockMode lockMode)protected <T extends Serializable>
Tload(T entity, LockMode lockMode, DataSource dataSource)protected <T extends Serializable>
List<T>loadAll(List<T> entities, LockMode lockMode)protected <T extends Serializable>
List<T>loadAllCascade(List<T> entities, LockMode lockMode, Class... cascadeTypes)protected <T extends Serializable>
List<T>loadByIds(Class<T> entityClass, Object... ids)protected <T extends Serializable>
List<T>loadByIds(Class<T> entityClass, LockMode lockMode, Object... ids)protected ObjectloadByQuery(QueryExecutor queryExecutor)TODO 通过构造QueyExecutor 提供更加灵活的参数传递方式,包括DataSource 比如: 1、new QueryExecutor(sql,entity).dataSource(dataSource) 2、new QueryExecutor(sql).names(paramNames).values(paramValues).resultType(resultType);protected <T> TloadBySql(String sqlOrSqlId, String[] paramNames, Object[] paramValues, Class<T> resultType)protected <T> TloadBySql(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)protected <T extends Serializable>
TloadBySql(String sqlOrSqlId, T entity)protected <T extends Serializable>
TloadCascade(T entity, LockMode lockMode, Class... cascadeTypes)protected <T extends Serializable>
TloadEntity(Class<T> entityClass, EntityQuery entityQuery)protected Mongomongo()protected <T> List<QueryResult<T>>parallQuery(List<ParallQuery> parallQueryList, String[] paramNames, Object[] paramValues)-- 避免开发者将全部功能用一个超级sql完成,提供拆解执行的同时确保执行效率,达到了效率和可维护的平衡protected <T> List<QueryResult<T>>parallQuery(List<ParallQuery> parallQueryList, String[] paramNames, Object[] paramValues, ParallelConfig parallelConfig)protected <T> List<QueryResult<T>>parallQuery(List<ParallQuery> parallQueryList, Map<String,Object> paramsMap, ParallelConfig parallelConfig)protected Queryquery()protected Savesave()protected Objectsave(Serializable entity)protected Objectsave(Serializable entity, DataSource dataSource)protected <T extends Serializable>
LongsaveAll(List<T> entities)protected <T extends Serializable>
LongsaveAll(List<T> entities, DataSource dataSource)protected <T extends Serializable>
LongsaveAllIgnoreExist(List<T> entities)protected <T extends Serializable>
LongsaveAllIgnoreExist(List<T> entities, DataSource dataSource)protected LongsaveOrUpdate(Serializable entity, String... forceUpdateProps)protected LongsaveOrUpdate(Serializable entity, String[] forceUpdateProps, DataSource dataSource)protected <T extends Serializable>
LongsaveOrUpdateAll(List<T> entities, String... forceUpdateProps)protected <T extends Serializable>
LongsaveOrUpdateAll(List<T> entities, String[] forceUpdateProps, DataSource dataSource)voidsetDataSource(DataSource dataSource)voidsetSqlToyContext(SqlToyContext sqlToyContext)protected Storestore()protected voidtranslate(Collection dataSet, String cacheName, String cacheType, Integer cacheNameIndex, TranslateHandler translateHandler)protected TreeTabletreeTable()protected voidtruncate(Class entityClass, Boolean autoCommit)protected voidtruncate(String tableName, Boolean autoCommit, DataSource dataSource)protected Uniqueunique()protected Updateupdate()protected Longupdate(Serializable entity, String... forceUpdateProps)protected Longupdate(Serializable entity, String[] forceUpdateProps, DataSource dataSource)protected <T extends Serializable>
LongupdateAll(List<T> entities, String... forceUpdateProps)protected <T extends Serializable>
LongupdateAll(List<T> entities, String[] forceUpdateProps, DataSource dataSource)protected <T extends Serializable>
LongupdateAllDeeply(List<T> entities)protected <T extends Serializable>
LongupdateAllDeeply(List<T> entities, DataSource dataSource)protected LongupdateByQuery(Class entityClass, EntityUpdate entityUpdate)protected LongupdateCascade(Serializable entity, String[] forceUpdateProps, Class[] forceCascadeClasses, HashMap<Class,String[]> subTableForceUpdateProps)protected LongupdateDeeply(Serializable entity)protected LongupdateDeeply(Serializable entity, DataSource dataSource)protected ListupdateFetch(QueryExecutor queryExecutor, UpdateRowHandler updateRowHandler)<T extends Serializable>
TupdateSaveFetch(T entity, UpdateRowHandler updateRowHandler, String[] uniqueProps, DataSource dataSource)protected BeanWrapperwrapBeanProps(String... names)protected booleanwrapTreeTableRoute(TreeTableModel treeModel)protected booleanwrapTreeTableRoute(TreeTableModel treeModel, DataSource dataSource)
-
-
-
字段详细资料
-
logger
protected final org.slf4j.Logger logger
定义日志
-
dataSource
protected DataSource dataSource
数据源
-
UPDATE
protected SaveMode UPDATE
-
IGNORE
protected SaveMode IGNORE
-
sqlToyContext
protected SqlToyContext sqlToyContext
sqlToy上下文定义
-
-
方法详细资料
-
setDataSource
public void setDataSource(DataSource dataSource)
-
getDataSource
protected DataSource getDataSource(DataSource pointDataSource)
- 参数:
pointDataSource-- 返回:
-
load
protected Load load()
- 返回:
-
delete
protected Delete delete()
- 返回:
-
update
protected Update update()
- 返回:
-
save
protected Save save()
- 返回:
-
query
protected Query query()
- 返回:
-
store
protected Store store()
- 返回:
-
unique
protected Unique unique()
- 返回:
-
treeTable
protected TreeTable treeTable()
- 返回:
-
execute
protected Execute execute()
- 返回:
-
batch
protected Batch batch()
- 返回:
-
elastic
protected Elastic elastic()
- 返回:
-
mongo
protected Mongo mongo()
- 返回:
-
setSqlToyContext
public void setSqlToyContext(SqlToyContext sqlToyContext)
- 参数:
sqlToyContext- the sqlToyContext to set
-
getSqlToyContext
protected SqlToyContext getSqlToyContext()
- 返回:
- the sqlToyContext
-
getSqlToyConfig
protected SqlToyConfig getSqlToyConfig(String sqlKey, SqlType sqlType)
- 参数:
sqlKey-sqlType-- 返回:
-
isUnique
protected boolean isUnique(Serializable entity, String... paramsNamed)
- 参数:
entity-paramsNamed- 对象属性名称(不是数据库表字段名称)- 返回:
-
isUnique
protected boolean isUnique(UniqueExecutor uniqueExecutor)
-
getCountBySql
protected Long getCountBySql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue)
- 参数:
sqlOrSqlId-paramsNamed-paramsValue-- 返回:
- Long
-
getCountByEntityQuery
protected Long getCountByEntityQuery(Class entityClass, EntityQuery entityQuery)
- 参数:
entityClass-entityQuery-- 返回:
-
getCountByQuery
protected Long getCountByQuery(QueryExecutor queryExecutor)
- 参数:
queryExecutor-- 返回:
-
executeStore
protected StoreResult executeStore(String storeSqlOrKey, Object[] inParamValues, Integer[] outParamsType, Class resultType)
-
executeStore
protected StoreResult executeStore(String storeSqlOrKey, Object[] inParamValues)
-
executeStore
protected StoreResult executeStore(String storeSqlOrKey, Object[] inParamsValue, Integer[] outParamsType, Class resultType, DataSource dataSource)
- 参数:
storeSqlOrKey- 可以直接传call storeName (?,?) 也可以传xml中的存储过程sqlIdinParamsValue-outParamsType- (可以为null)resultType- VOClass,HashMap或null(表示二维List)dataSource-- 返回:
-
getSingleValue
@Deprecated protected Object getSingleValue(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue)
已过时。- 参数:
sqlOrSqlId-paramsNamed-paramsValue-- 返回:
- 另请参阅:
getSingleValue(String, Map)
-
getSingleValue
protected <T> T getSingleValue(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)
-
getSingleValue
protected Object getSingleValue(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, DataSource dataSource)
- 参数:
sqlOrSqlId-paramsNamed-paramsValue-dataSource-- 返回:
-
load
protected <T extends Serializable> T load(T entity)
- 参数:
entity-- 返回:
-
load
protected <T extends Serializable> T load(T entity, LockMode lockMode)
- 参数:
entity-lockMode-- 返回:
-
load
protected <T extends Serializable> T load(T entity, LockMode lockMode, DataSource dataSource)
- 参数:
entity-lockMode-dataSource-- 返回:
-
loadCascade
protected <T extends Serializable> T loadCascade(T entity, LockMode lockMode, Class... cascadeTypes)
- 参数:
entity-lockMode-cascadeTypes-- 返回:
-
loadAll
protected <T extends Serializable> List<T> loadAll(List<T> entities, LockMode lockMode)
- 参数:
entities-lockMode-- 返回:
-
loadByIds
protected <T extends Serializable> List<T> loadByIds(Class<T> entityClass, Object... ids)
- 类型参数:
T-- 参数:
entityClass-ids-- 返回:
-
loadByIds
protected <T extends Serializable> List<T> loadByIds(Class<T> entityClass, LockMode lockMode, Object... ids)
- 类型参数:
T-- 参数:
entityClass-lockMode-ids-- 返回:
-
loadAllCascade
protected <T extends Serializable> List<T> loadAllCascade(List<T> entities, LockMode lockMode, Class... cascadeTypes)
- 参数:
entities-lockMode-cascadeTypes-- 返回:
-
loadBySql
protected <T> T loadBySql(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)
-
loadBySql
protected <T> T loadBySql(String sqlOrSqlId, String[] paramNames, Object[] paramValues, Class<T> resultType)
- 参数:
sqlOrSqlId-paramNames-paramValues-resultType-- 返回:
-
loadBySql
protected <T extends Serializable> T loadBySql(String sqlOrSqlId, T entity)
- 参数:
sqlOrSqlId-entity-- 返回:
-
loadEntity
protected <T extends Serializable> T loadEntity(Class<T> entityClass, EntityQuery entityQuery)
-
loadByQuery
protected Object loadByQuery(QueryExecutor queryExecutor)
TODO 通过构造QueyExecutor 提供更加灵活的参数传递方式,包括DataSource 比如:- 1、new QueryExecutor(sql,entity).dataSource(dataSource)
- 2、new QueryExecutor(sql).names(paramNames).values(paramValues).resultType(resultType);
- 参数:
queryExecutor-- 返回:
-
executeSql
protected Long executeSql(String sqlOrSqlId, Serializable entity)
- 参数:
sqlOrSqlId-entity-- 返回:
-
executeSql
protected Long executeSql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue)
- 参数:
sqlOrSqlId-paramsNamed-paramsValue-- 返回:
-
executeSql
protected Long executeSql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Boolean autoCommit, DataSource dataSource)
- 参数:
sqlOrSqlId-paramsNamed-paramsValue-autoCommit- 自动提交,默认可以填nulldataSource-- 返回:
-
batchUpdate
protected Long batchUpdate(String sqlOrSqlId, List dataSet, int batchSize, Boolean autoCommit)
- 参数:
sqlOrSqlId-dataSet- 支持List- 、List
batchSize-autoCommit- 自动提交,默认可以填null- 返回:
-
batchUpdate
protected Long batchUpdate(String sqlOrSqlId, List dataSet, int batchSize, Boolean autoCommit, DataSource dataSource)
- 参数:
sqlOrSqlId-dataSet- 支持List- 、List
batchSize-autoCommit-dataSource-- 返回:
-
wrapTreeTableRoute
protected boolean wrapTreeTableRoute(TreeTableModel treeModel)
-
wrapTreeTableRoute
protected boolean wrapTreeTableRoute(TreeTableModel treeModel, DataSource dataSource)
- 参数:
treeModel-dataSource-- 返回:
-
findBySql
protected <T extends Serializable> List<T> findBySql(String sqlOrSqlId, T entity)
- 参数:
sqlOrSqlId-entity-- 返回:
-
findBySql
protected <T> List<T> findBySql(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)
-
findBySql
protected <T> List<T> findBySql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType)
- 类型参数:
T-- 参数:
sqlOrSqlId-paramsNamed-paramsValue-resultType- 分null(返回二维List)、voClass、HashMap.class、LinkedHashMap.class等- 返回:
-
findByQuery
protected QueryResult findByQuery(QueryExecutor queryExecutor)
- 参数:
queryExecutor- (可动态设置数据源)- 返回:
-
fetchStream
protected void fetchStream(QueryExecutor queryExecutor, StreamResultHandler streamResultHandler)
- 参数:
queryExecutor-streamResultHandler-
-
findPageByQuery
protected QueryResult findPageByQuery(Page page, QueryExecutor queryExecutor)
- 参数:
page-queryExecutor- (可动态设置数据源)- 返回:
-
findPageBySql
protected <T> Page<T> findPageBySql(Page page, String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType)
- 参数:
page-sqlOrSqlId-paramsNamed-paramsValue-resultType- (null则返回List- 二维集合,HashMap.class:则返回List
>) - 返回:
-
findPageBySql
protected <T extends Serializable> Page<T> findPageBySql(Page page, String sqlOrSqlId, T entity)
-
findPageBySql
protected <T> Page<T> findPageBySql(Page page, String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType)
-
findTopBySql
protected <T> List<T> findTopBySql(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType, double topSize)
-
findTopBySql
protected <T> List<T> findTopBySql(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType, double topSize)
- 参数:
sqlOrSqlId-paramsNamed-paramsValue-resultType- (null则返回List- 二维集合,HashMap.class:则返回List
>) topSize- >1 取整数部分,<1 则表示按比例获取- 返回:
-
findTopBySql
protected <T extends Serializable> List<T> findTopBySql(String sqlOrSqlId, T entity, double topSize)
-
findTopByQuery
protected QueryResult findTopByQuery(QueryExecutor queryExecutor, double topSize)
- 参数:
queryExecutor- (可动态设置数据源)topSize-- 返回:
-
getRandomResult
protected QueryResult getRandomResult(QueryExecutor queryExecutor, double randomCount)
- 参数:
queryExecutor- (可动态设置数据源)randomCount-- 返回:
-
getRandomResult
protected <T> List<T> getRandomResult(String sqlOrSqlId, Map<String,Object> paramsMap, Class<T> resultType, double randomCount)
-
getRandomResult
protected <T> List<T> getRandomResult(String sqlOrSqlId, String[] paramsNamed, Object[] paramsValue, Class<T> resultType, double randomCount)
-
truncate
protected void truncate(String tableName, Boolean autoCommit, DataSource dataSource)
- 参数:
tableName-autoCommit-dataSource-
-
save
protected Object save(Serializable entity)
- 参数:
entity-- 返回:
-
save
protected Object save(Serializable entity, DataSource dataSource)
- 参数:
entity-dataSource-- 返回:
-
saveAll
protected <T extends Serializable> Long saveAll(List<T> entities)
- 类型参数:
T-- 参数:
entities-- 返回:
-
saveAll
protected <T extends Serializable> Long saveAll(List<T> entities, DataSource dataSource)
- 类型参数:
T-- 参数:
entities-dataSource-- 返回:
-
saveAllIgnoreExist
protected <T extends Serializable> Long saveAllIgnoreExist(List<T> entities)
- 参数:
entities-- 返回:
-
saveAllIgnoreExist
protected <T extends Serializable> Long saveAllIgnoreExist(List<T> entities, DataSource dataSource)
- 参数:
entities-dataSource-- 返回:
-
update
protected Long update(Serializable entity, String... forceUpdateProps)
- 参数:
entity-forceUpdateProps- 强制修改的属性- 返回:
-
update
protected Long update(Serializable entity, String[] forceUpdateProps, DataSource dataSource)
- 参数:
entity-forceUpdateProps-dataSource-- 返回:
-
updateCascade
protected Long updateCascade(Serializable entity, String[] forceUpdateProps, Class[] forceCascadeClasses, HashMap<Class,String[]> subTableForceUpdateProps)
- 参数:
entity-forceUpdateProps-forceCascadeClasses- (强制需要修改的子对象,当子集合数据为null,则进行清空或置为无效处理,否则则忽视对存量数据的处理)subTableForceUpdateProps-- 返回:
-
updateSaveFetch
public <T extends Serializable> T updateSaveFetch(T entity, UpdateRowHandler updateRowHandler, String[] uniqueProps, DataSource dataSource)
- 类型参数:
T-- 参数:
entity-updateRowHandler-uniqueProps-dataSource-- 返回:
-
updateDeeply
protected Long updateDeeply(Serializable entity)
- 参数:
entity-- 返回:
-
updateDeeply
protected Long updateDeeply(Serializable entity, DataSource dataSource)
- 参数:
entity-dataSource-- 返回:
-
updateAll
protected <T extends Serializable> Long updateAll(List<T> entities, String... forceUpdateProps)
- 类型参数:
T-- 参数:
entities-forceUpdateProps-- 返回:
-
updateAll
protected <T extends Serializable> Long updateAll(List<T> entities, String[] forceUpdateProps, DataSource dataSource)
- 类型参数:
T-- 参数:
entities-forceUpdateProps-dataSource-- 返回:
-
updateAllDeeply
protected <T extends Serializable> Long updateAllDeeply(List<T> entities)
- 类型参数:
T-- 参数:
entities-- 返回:
-
updateAllDeeply
protected <T extends Serializable> Long updateAllDeeply(List<T> entities, DataSource dataSource)
- 类型参数:
T-- 参数:
entities-dataSource-- 返回:
-
saveOrUpdate
protected Long saveOrUpdate(Serializable entity, String... forceUpdateProps)
-
saveOrUpdate
protected Long saveOrUpdate(Serializable entity, String[] forceUpdateProps, DataSource dataSource)
- 参数:
entity-forceUpdateProps-dataSource-- 返回:
-
saveOrUpdateAll
protected <T extends Serializable> Long saveOrUpdateAll(List<T> entities, String... forceUpdateProps)
- 类型参数:
T-- 参数:
entities-forceUpdateProps-- 返回:
-
saveOrUpdateAll
protected <T extends Serializable> Long saveOrUpdateAll(List<T> entities, String[] forceUpdateProps, DataSource dataSource)
- 类型参数:
T-- 参数:
entities-forceUpdateProps-dataSource-- 返回:
-
delete
protected Long delete(Serializable entity)
- 参数:
entity-- 返回:
-
delete
protected Long delete(Serializable entity, DataSource dataSource)
-
deleteByQuery
protected Long deleteByQuery(Class entityClass, EntityQuery entityQuery)
- 参数:
entityClass-entityQuery-- 返回:
-
deleteAll
protected <T extends Serializable> Long deleteAll(List<T> entities)
-
deleteAll
protected <T extends Serializable> Long deleteAll(List<T> entities, DataSource dataSource)
- 类型参数:
T-- 参数:
entities-dataSource-- 返回:
-
deleteByIds
protected Long deleteByIds(Class entityClass, Object... ids)
- 参数:
entityClass-ids-- 返回:
-
updateFetch
protected List updateFetch(QueryExecutor queryExecutor, UpdateRowHandler updateRowHandler)
- 参数:
queryExecutor-updateRowHandler-- 返回:
-
getEntityMeta
protected EntityMeta getEntityMeta(Class entityClass)
- 参数:
entityClass-- 返回:
-
getBatchSize
protected int getBatchSize()
- 返回:
-
wrapBeanProps
protected BeanWrapper wrapBeanProps(String... names)
- 参数:
names-- 返回:
-
flush
protected void flush()
-
flush
protected void flush(DataSource dataSource)
- 参数:
dataSource-
-
generateBizId
protected long generateBizId(String signature, int increment)
- 参数:
signature- 唯一标识符号increment- 唯一标识符号,默认设置为1- 返回:
-
generateBizId
protected String generateBizId(Serializable entity)
- 参数:
entity-- 返回:
-
existCache
protected boolean existCache(String cacheName)
- 参数:
cacheName-- 返回:
-
getTranslateCache
protected <T> List<T> getTranslateCache(String cacheName, String cacheType, Class<T> reusltType)
- 类型参数:
T-- 参数:
cacheName-cacheType- 如是数据字典,则传入字典类型否则为null即可reusltType-- 返回:
-
getTranslateCache
protected HashMap<String,Object[]> getTranslateCache(String cacheName, String cacheType)
- 参数:
cacheName-cacheType-- 返回:
-
cacheMatchKeys
@Deprecated protected String[] cacheMatchKeys(String matchRegex, CacheMatchFilter cacheMatchFilter)
已过时。- 参数:
matchRegex-cacheMatchFilter-- 返回:
- 另请参阅:
cacheMatchKeys(org.sagacity.sqltoy.model.CacheMatchFilter,java.lang.String...)
-
cacheMatchKeys
protected String[] cacheMatchKeys(CacheMatchFilter cacheMatchFilter, String... matchRegexes)
- 参数:
cacheMatchFilter- 例如: CacheMatchFilter.create().cacheName("staffIdNameCache")cacheMatchFilter- 如: 页面传过来的员工名称、客户名称等,反查对应的员工id和客户idmatchRegexes-- 返回:
-
translate
protected void translate(Collection dataSet, String cacheName, String cacheType, Integer cacheNameIndex, TranslateHandler translateHandler)
- 参数:
dataSet- 要翻译的数据集合cacheName- 缓存名称cacheType- 缓存分类(如字典分类),非分类型的填nullcacheNameIndex- 缓存名称对应的列,默认为1(null也表示1)translateHandler- 2个方法:getKey(Object row),setName(Object row,String name)
-
findEntity
protected <T> List<T> findEntity(Class<T> entityClass, EntityQuery entityQuery)
- 类型参数:
T-- 参数:
entityClass-entityQuery-- 返回:
-
findEntity
protected <T> List<T> findEntity(Class entityClass, EntityQuery entityQuery, Class<T> resultType)
-
findPageEntity
protected <T> Page<T> findPageEntity(Page page, Class<T> entityClass, EntityQuery entityQuery)
- 类型参数:
T-- 参数:
page-entityClass-entityQuery-- 返回:
-
findPageEntity
protected <T> Page<T> findPageEntity(Page page, Class entityClass, EntityQuery entityQuery, Class<T> resultType)
-
updateByQuery
protected Long updateByQuery(Class entityClass, EntityUpdate entityUpdate)
- 参数:
entityClass-entityUpdate-- 返回:
-
convertType
protected <T extends Serializable> T convertType(Serializable source, Class<T> resultType, String... ignoreProperties)
- 类型参数:
T-- 参数:
source-resultType-ignoreProperties-- 返回:
-
convertType
protected <T extends Serializable> List<T> convertType(List sourceList, Class<T> resultType, String... ignoreProperties)
- 类型参数:
T-- 参数:
sourceList-resultType-ignoreProperties-- 返回:
-
convertType
protected <T extends Serializable> Page<T> convertType(Page sourcePage, Class<T> resultType, String... ignoreProperties)
-
parallQuery
protected <T> List<QueryResult<T>> parallQuery(List<ParallQuery> parallQueryList, String[] paramNames, Object[] paramValues)
-- 避免开发者将全部功能用一个超级sql完成,提供拆解执行的同时确保执行效率,达到了效率和可维护的平衡- 类型参数:
T-- 参数:
parallQueryList-paramNames-paramValues-- 返回:
-
parallQuery
protected <T> List<QueryResult<T>> parallQuery(List<ParallQuery> parallQueryList, Map<String,Object> paramsMap, ParallelConfig parallelConfig)
-
getTableColumns
protected List<ColumnMeta> getTableColumns(String catalog, String schema, String tableName, DataSource dataSource)
- 参数:
catalog-schema-tableName-dataSource-- 返回:
-
getTables
protected List<TableMeta> getTables(String catalog, String schema, String tableName, DataSource dataSource)
- 参数:
catalog-schema-tableName-dataSource-- 返回:
-
parallQuery
protected <T> List<QueryResult<T>> parallQuery(List<ParallQuery> parallQueryList, String[] paramNames, Object[] paramValues, ParallelConfig parallelConfig)
- 参数:
parallQueryList-paramNames-paramValues-parallelConfig-- 返回:
-
getDialect
protected String getDialect(DataSource dataSource)
- 参数:
dataSource-- 返回:
-
-