public abstract class BaseDbService<T extends BaseDbModel> extends BaseDbCommonService<T>
key, tableName, tClass
Constructor and Description |
---|
BaseDbService() |
Modifier and Type | Method and Description |
---|---|
protected void |
autoClear(String timeColumn,
int maxCount,
Consumer<Long> consumer)
自动清理数据接口
|
protected void |
autoLoopClear(String timeClo,
int maxCount,
Consumer<cn.hutool.db.Entity> whereCon,
Predicate<T> predicate)
自动清理数据接口
|
protected String[] |
clearTimeColumns()
安装时间自动清理数据对字段
|
long |
count() |
long |
count(T data) |
protected String |
covetTableName(String tableName,
Class<T> tClass)
转换表面
|
protected cn.hutool.db.sql.Order[] |
defaultOrders() |
protected void |
executeClearImpl(int h2DbLogStorageCount)
清理分发实现
|
protected void |
fillInsert(T t)
插入数据填充
|
T |
getData(String nodeId,
String dataId)
根据 节点和数据ID查询数据
|
protected long |
getLastTimeValue(String timeColumn,
int maxCount,
Consumer<cn.hutool.db.Entity> whereCon)
查询指定字段降序 指定条数对最后一个值
|
void |
insert(Collection<T> t)
插入数据
|
void |
insert(T t)
插入数据
|
void |
insertNotFill(T t)
不填充 插入
|
List<T> |
list() |
List<T> |
listById(Collection<String> ids)
多个 id 查询数据
|
List<T> |
listById(Collection<String> ids,
Consumer<cn.hutool.db.Entity> consumer)
多个 id 查询数据
|
PageResultDto<T> |
listPage(cn.hutool.db.Entity where,
cn.hutool.db.Page page)
分页查询
|
PageResultDto<T> |
listPage(javax.servlet.http.HttpServletRequest request)
通用的分页查询, 使用该方法查询,数据库表字段不能包含 "page", "limit", "order_field", "order", "total"
|
PageResultDto<T> |
listPage(Map<String,String> paramMap)
通用的分页查询, 使用该方法查询,数据库表字段不能包含 "page", "limit", "order_field", "order", "total"
|
cn.hutool.db.Page |
parsePage(Map<String,String> paramMap)
转换为 page 对象
|
int |
update(T t)
修改数据,需要自行实现
|
int |
updateById(T info)
update by id with data
|
int |
updateById(T info,
Consumer<cn.hutool.db.Entity> whereConsumer)
update by id with data
|
void |
upsert(T t)
先尝试 更新,更新失败插入
|
count, count, dataBeanToEntity, del, delByKey, delByKey, entityToBean, entityToBean, entityToBeanList, execute, exists, exists, fillSelectResult, findByCondition, getByKey, getByKey, getByKey, getKey, getTableName, insert, listByBean, listByEntity, listPageOnlyResult, query, query, queryByBean, queryList, queryList, queryList, update, warpException
protected String covetTableName(String tableName, Class<T> tClass)
BaseDbCommonService
covetTableName
in class BaseDbCommonService<T extends BaseDbModel>
tableName
- 表面tClass
- 类public void insert(T t)
BaseDbCommonService
insert
in class BaseDbCommonService<T extends BaseDbModel>
t
- 数据public void upsert(T t)
t
- 数据public void insertNotFill(T t)
t
- 数据public void insert(Collection<T> t)
BaseDbCommonService
insert
in class BaseDbCommonService<T extends BaseDbModel>
t
- 数据protected void fillInsert(T t)
t
- 数据public int updateById(T info, Consumer<cn.hutool.db.Entity> whereConsumer)
info
- datawhereConsumer
- 查询条件回调public int updateById(T info)
info
- datapublic int update(T t)
BaseDbCommonService
update
in class BaseDbCommonService<T extends BaseDbModel>
t
- 数据public long count()
public long count(T data)
public PageResultDto<T> listPage(javax.servlet.http.HttpServletRequest request)
page=1&limit=10&order=ascend&order_field=name
request
- 请求对象public cn.hutool.db.Page parsePage(Map<String,String> paramMap)
paramMap
- 请求参数public PageResultDto<T> listPage(Map<String,String> paramMap)
page=1&limit=10&order=ascend&order_field=name
paramMap
- 请求参数public PageResultDto<T> listPage(cn.hutool.db.Entity where, cn.hutool.db.Page page)
BaseDbCommonService
listPage
in class BaseDbCommonService<T extends BaseDbModel>
where
- 条件page
- 分页protected cn.hutool.db.sql.Order[] defaultOrders()
public List<T> listById(Collection<String> ids)
ids
- idspublic List<T> listById(Collection<String> ids, Consumer<cn.hutool.db.Entity> consumer)
ids
- idsprotected void executeClearImpl(int h2DbLogStorageCount)
h2DbLogStorageCount
- 保留数量protected String[] clearTimeColumns()
protected void autoClear(String timeColumn, int maxCount, Consumer<Long> consumer)
timeColumn
- 时间字段maxCount
- 最大数量consumer
- 查询出超过范围的时间回调protected long getLastTimeValue(String timeColumn, int maxCount, Consumer<cn.hutool.db.Entity> whereCon)
timeColumn
- 时间字段maxCount
- 最大数量whereCon
- 添加查询条件回调protected void autoLoopClear(String timeClo, int maxCount, Consumer<cn.hutool.db.Entity> whereCon, Predicate<T> predicate)
timeClo
- 时间字段maxCount
- 最大数量predicate
- 查询出超过范围的时间,回调Copyright © 2017–2022. All rights reserved.