T
- public class DaoMapperImpl<T extends DBObject> extends Object implements DaoMapper<T>
Modifier and Type | Field and Description |
---|---|
protected DBClient |
dbClient |
protected Class<T> |
domainClass |
protected DynmicSQLMapper<T> |
dynmicSQLMapper |
protected JooqMapper<T> |
jooqMapper |
protected QueryDSLMapper<T> |
queryDSLMapper |
Constructor and Description |
---|
DaoMapperImpl(Class<T> domainClass,
DBClient dbClient) |
Modifier and Type | Method and Description |
---|---|
long |
count()
返回实体在数据库里的总数
|
long |
count(T query)
根据条件查询数量
|
int |
delete(T entity)
删除
|
void |
deleteAllInBatch()
清空表
|
int |
deleteById(Object... key)
根据主键删除对象,如果对象是复合主键,传入对象本生即可
|
int[] |
deleteInBatch(Iterable<T> entities)
批量删除
|
int |
executeTemplate(String sql,
Map<String,Object> paras)
执行一个更新的jdbc sql
|
boolean |
exists(T query)
是否存在,根据对象查询
|
boolean |
existsById(Object... id)
是否存在,根据主键查询
|
DBClient |
getDbClient() |
Class<T> |
getDomainClass() |
DynmicSQLMapper<T> |
getDynmicSQLMapper() |
JooqMapper<T> |
getJooqMapper() |
QueryDSLMapper<T> |
getQueryDSLMapper() |
int |
insert(T t)
通用插入,插入一个实体对象到数据库,返回主键
|
int[] |
insertBatch(List<T> list)
批量插入实体,返回主键
|
int[] |
insertBatchFast(List<T> list)
批量插入实体,快速插入 不返回主键
|
T |
lock(T query)
获取单一对象,如果在事物中执行会添加数据库行级锁(select * from table where id = ? for
update),如果对象不存在,返回null
|
int |
merge(T entity)
合并记录
|
List<T> |
selectList(T query)
返回实体对应的所有数据库记录
|
Page<T> |
selectPage(T query,
int start,
int size)
返回实体对应的一个范围的记录
|
List<T> |
selectTemplate(String sql,
Map<String,Object> paras)
执行一个jdbc sql模板查询
|
T |
single(T query)
获取单一对象,如果对象不存在,返回null
|
T |
unique(Object... keys)
根据主键获取对象,如果对象不存在,返回null
|
int |
update(T entity)
更新
|
int[] |
updateBatch(List<T> entity)
批量更新
|
int |
updateById(T entity)
根据主键更新对象,对象set过才被更新
|
protected DBClient dbClient
protected volatile JooqMapper<T extends DBObject> jooqMapper
protected volatile QueryDSLMapper<T extends DBObject> queryDSLMapper
protected volatile DynmicSQLMapper<T extends DBObject> dynmicSQLMapper
public int[] insertBatch(List<T> list)
DaoMapper
insertBatch
in interface DaoMapper<T extends DBObject>
public int[] insertBatchFast(List<T> list)
DaoMapper
insertBatchFast
in interface DaoMapper<T extends DBObject>
public int updateById(T entity)
DaoMapper
updateById
in interface DaoMapper<T extends DBObject>
entity
- 实体public int[] updateBatch(List<T> entity)
DaoMapper
updateBatch
in interface DaoMapper<T extends DBObject>
public int deleteById(Object... key)
DaoMapper
deleteById
in interface DaoMapper<T extends DBObject>
key
- 主键public int[] deleteInBatch(Iterable<T> entities)
DaoMapper
deleteInBatch
in interface DaoMapper<T extends DBObject>
public void deleteAllInBatch()
DaoMapper
deleteAllInBatch
in interface DaoMapper<T extends DBObject>
public T unique(Object... keys)
DaoMapper
public T lock(T query)
DaoMapper
public long count()
DaoMapper
public boolean existsById(Object... id)
DaoMapper
existsById
in interface DaoMapper<T extends DBObject>
public List<T> selectList(T query)
DaoMapper
selectList
in interface DaoMapper<T extends DBObject>
public Page<T> selectPage(T query, int start, int size)
DaoMapper
selectPage
in interface DaoMapper<T extends DBObject>
public List<T> selectTemplate(String sql, Map<String,Object> paras)
DaoMapper
selectTemplate
in interface DaoMapper<T extends DBObject>
public int executeTemplate(String sql, Map<String,Object> paras)
DaoMapper
executeTemplate
in interface DaoMapper<T extends DBObject>
public DynmicSQLMapper<T> getDynmicSQLMapper()
getDynmicSQLMapper
in interface DaoMapper<T extends DBObject>
public JooqMapper<T> getJooqMapper()
getJooqMapper
in interface DaoMapper<T extends DBObject>
public QueryDSLMapper<T> getQueryDSLMapper()
getQueryDSLMapper
in interface DaoMapper<T extends DBObject>
public DBClient getDbClient()
getDbClient
in interface DaoMapper<T extends DBObject>
Copyright © 2020. All rights reserved.