public interface IService<T,ID extends Serializable>
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_BATCH_SIZE |
| 限定符和类型 | 方法和说明 |
|---|---|
default long |
count()
查询所有数据数量。
|
default long |
count(org.springframework.data.domain.Example<T> example)
根据查询条件查询数据数量。
|
default long |
count(com.querydsl.core.types.Predicate query)
根据查询条件查询数据数量。
|
default boolean |
exists(org.springframework.data.domain.Example condition)
根据查询条件判断数据是否存在。
|
default boolean |
exists(com.querydsl.core.types.Predicate query)
根据查询条件判断数据是否存在。
|
default boolean |
existsById(ID id)
根据ID判断是否存在
|
default T |
getById(ID id)
根据数据主键查询一条数据。
|
default Optional<T> |
getByIdOpt(ID id)
根据数据主键查询一条数据。
|
javax.persistence.EntityManager |
getEntityManager()
JPA数据持久操作API EntityManager
|
com.querydsl.jpa.impl.JPAQueryFactory |
getJPAQueryFactory()
queryDSL 查询器工厂 JPAQueryFactory
|
default T |
getOne(org.springframework.data.domain.Example<T> example)
根据查询条件查询一条数据。
|
default T |
getOne(com.querydsl.core.types.Predicate query)
根据查询条件查询一条数据。
|
default Optional<T> |
getOneOpt(org.springframework.data.domain.Example<T> example)
根据查询条件查询一条数据。
|
BaseRepository<T,ID> |
getRepository()
获取对应实体类(Entity)的基础映射类(BaseMapper)。
|
default List<T> |
list()
查询所有数据。
|
default List<T> |
list(org.springframework.data.domain.Example query)
根据查询条件查询数据集合。
|
default List<T> |
list(com.querydsl.core.types.Predicate query)
根据查询条件查询数据集合。
|
default List<T> |
listByIds(Collection<ID> ids)
根据数据主键查询数据集合。
|
default org.springframework.data.domain.Page<T> |
page(org.springframework.data.domain.Pageable page)
分页查询所有数据。
|
default org.springframework.data.domain.Page<T> |
page(org.springframework.data.domain.Pageable page,
com.querydsl.core.types.Predicate query)
根据查询条件分页查询数据。
|
com.querydsl.jpa.impl.JPAQuery |
queryChain()
queryDSL 查询 query
|
default boolean |
remove() |
default boolean |
remove(Collection<T> entities)
根据查询条件删除数据。
|
default boolean |
remove(T entity)
根据Entity 注解 查询条件删除数据。
|
default boolean |
removeAll(Collection<? extends T> entities)
根据查询条件删除数据。
|
default boolean |
removeById(ID id)
根据数据主键删除数据。
|
default boolean |
removeByIds(Collection<? extends ID> ids)
根据数据主键批量删除数据。
|
default T |
save(T entity)
插入一条记录
|
default List<T> |
saveBatch(Collection<T> entities)
批量保存实体类对象数据。
|
default T |
saveOrUpdate(T entity)
保存或者更新实体类对象数据。
|
default boolean |
update(com.querydsl.jpa.impl.JPAUpdateClause query)
根据
Map 构建查询条件更新数据。 |
default T |
update(T entity,
Boolean ignore) |
default T |
update(T entity,
Boolean ignore,
String[] ignoreProperties) |
default T |
update(T entity,
Object... ignore) |
com.querydsl.jpa.impl.JPAUpdateClause |
updateChain(com.querydsl.core.types.EntityPath entityPath)
queryDSL 更新
|
static final int DEFAULT_BATCH_SIZE
BaseRepository<T,ID> getRepository()
获取对应实体类(Entity)的基础映射类(BaseMapper)。
com.querydsl.jpa.impl.JPAQueryFactory getJPAQueryFactory()
com.querydsl.jpa.impl.JPAQuery queryChain()
com.querydsl.jpa.impl.JPAUpdateClause updateChain(com.querydsl.core.types.EntityPath entityPath)
javax.persistence.EntityManager getEntityManager()
default List<T> saveBatch(Collection<T> entities)
批量保存实体类对象数据。
entities - 实体类对象true 保存成功,false 保存失败。@Transactional default T update(T entity, Object... ignore)
entity - 实体类对象entity - 查询条件 根据实体ID 更新。 全量覆盖@Transactional default T update(T entity, Boolean ignore)
entity - 实体类对象entity - 查询条件 根据实体ID 更新。 全量覆盖@Transactional default T update(T entity, Boolean ignore, String[] ignoreProperties)
entity - 实体类对象entity - 查询条件 根据实体ID 更新。 全量覆盖@Transactional default T saveOrUpdate(T entity)
保存或者更新实体类对象数据。
entity - 实体类对象true 保存或更新成功,false 保存或更新失败。@Transactional default boolean update(com.querydsl.jpa.impl.JPAUpdateClause query)
根据 Map 构建查询条件更新数据。
query - 查询条件true 更新成功,false 更新失败。default long count()
查询所有数据数量。
default long count(org.springframework.data.domain.Example<T> example)
根据查询条件查询数据数量。
example - 查询条件default Optional<T> getOneOpt(org.springframework.data.domain.Example<T> example)
根据查询条件查询一条数据。
example - 查询条件default T getOne(org.springframework.data.domain.Example<T> example)
根据查询条件查询一条数据。
example - 查询条件default T getOne(com.querydsl.core.types.Predicate query)
根据查询条件查询一条数据。
query - 查询条件default long count(com.querydsl.core.types.Predicate query)
根据查询条件查询数据数量。
query - 查询条件default boolean exists(com.querydsl.core.types.Predicate query)
根据查询条件判断数据是否存在。
query - 查询条件true 数据存在,false 数据不存在。default boolean exists(org.springframework.data.domain.Example condition)
根据查询条件判断数据是否存在。
condition - 查询条件true 数据存在,false 数据不存在。default boolean existsById(ID id)
id - default List<T> list(com.querydsl.core.types.Predicate query)
根据查询条件查询数据集合。
query - 查询条件default List<T> list(org.springframework.data.domain.Example query)
根据查询条件查询数据集合。
query - 查询条件default List<T> listByIds(Collection<ID> ids)
根据数据主键查询数据集合。
ids - 数据主键default org.springframework.data.domain.Page<T> page(org.springframework.data.domain.Pageable page)
分页查询所有数据。
page - 分页对象default org.springframework.data.domain.Page<T> page(org.springframework.data.domain.Pageable page, com.querydsl.core.types.Predicate query)
根据查询条件分页查询数据。
page - 分页对象query - 查询条件default boolean removeById(ID id)
根据数据主键删除数据。
id - 数据主键true 删除成功,false 删除失败。default boolean removeByIds(Collection<? extends ID> ids)
根据数据主键批量删除数据。
ids - 数据主键true 删除成功,false 删除失败。default boolean remove(T entity)
根据Entity 注解 查询条件删除数据。 以ID为主键删除。
entity - true 删除成功,false 删除失败。default boolean remove(Collection<T> entities)
根据查询条件删除数据。
entities - 实体集合 根据集合ID主键true 删除成功,false 删除失败。default boolean removeAll(Collection<? extends T> entities)
根据查询条件删除数据。
entities - 实体集合 根据集合ID主键true 删除成功,false 删除失败。default boolean remove()
true 删除成功,false 删除失败。Copyright © 2023. All rights reserved.