| 构造器和说明 |
|---|
DaoHolder() |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
batchInsert(List<T> entities)
批量插入数据
如果entity的id为null,会自动回填id
|
long |
count()
所有数据
|
long |
count(BaseMeta<M> cnd)
根据筛选条件查询数据个数
|
int |
delete(BaseMeta<M> cnd)
根据条件物理删除数据
|
int |
deleteById(Serializable id) |
<ID extends Serializable> |
deleteByIds(List<ID> ids)
根据主键物理删除数据
|
T |
fetch(BaseMeta<M> tpl)
返回匹配到第一条符合条件的数据
(默认是没有被删除的数据),如果获取
|
List<T> |
find(BaseMeta<M> cnd)
根据条件筛选数据
注意: 分页页码从0开始,并且总分页数只有再页号非正数时才会返回,如果是第1页想获取中数据数,则page传入-1即可
|
void |
find(BaseMeta<M> cnd,
Consumer<T> consumer)
根据筛选条件,将数据依次传给consumer处理
|
Page<T> |
find(BaseMeta<M> cnd,
int page,
int pageSize) |
<ID extends Serializable> |
findByIds(List<ID> ids)
返回没有被逻辑删除的,给定ids范围内的数据
|
T |
get(Serializable id)
根据id获取对象
即使数据已经被逻辑删除依然能够获取到。
|
DaoHelper |
getDaoHelper() |
T |
insert(T entity)
插入数据
如果entity的id为null,会自动回填id
|
T |
save(T entity) |
void |
setDaoHelper(DaoHelper daoHelper) |
int |
update(T entity)
更新数据
entity的id不可为null
|
int |
updateBy(BaseMeta<M> tpl)
根据tpl中的id,特殊的更新数据,如count++等自操作更新等等。
|
int |
updateIgnoreNull(T entity)
将非null数据更新到数据哭
entity的id不可为null
|
protected DaoHelper daoHelper
public DaoHelper getDaoHelper()
public void setDaoHelper(DaoHelper daoHelper)
public T get(Serializable id)
Daopublic int updateIgnoreNull(T entity)
Daopublic int deleteById(Serializable id)
public <ID extends Serializable> int deleteByIds(List<ID> ids)
Daopublic <ID extends Serializable> List<T> findByIds(List<ID> ids)
Daopublic List<T> find(BaseMeta<M> cnd)
Daopublic long count()
DaoCopyright © 2020. All rights reserved.