类 RootService<E extends RootEntity<E>,R extends RootRepository<E>>
java.lang.Object
cn.hamm.airpower.root.RootService<E,R>
- 类型参数:
E- 实体R- 数据源
- 所有已实现的接口:
ITry
public class RootService<E extends RootEntity<E>,R extends RootRepository<E>>
extends Object
implements ITry
服务根类
- 作者:
- Hamm.cn
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明final long🟡添加一条数据protected final <Y extends Comparable<? super Y>>
voidaddPredicateNonNull(@NotNull jakarta.persistence.criteria.Root<E> root, List<jakarta.persistence.criteria.Predicate> predicateList, String fieldName, java.util.function.BiFunction<jakarta.persistence.criteria.Expression<? extends Y>, Y, jakarta.persistence.criteria.Predicate> expression, Y value) 添加查询条件(value不为null时)protected @NotNull List<jakarta.persistence.criteria.Predicate>addSearchPredicate(@NotNull jakarta.persistence.criteria.Root<E> root, @NotNull jakarta.persistence.criteria.CriteriaBuilder builder, E search) 🟢添加搜索的查询条件protected void🟢添加后置方法protected voidafterDelete(long id) 🟢删除后置方法protected voidafterDisable(long id) 🟢禁用后置方法protected voidafterEnable(long id) 🟢启用后置方法protected E🟢详情查询后置方法afterGetList(@NotNull List<E> list) 🟢不分页查询后置方法protected @NotNull QueryPageResponse<E>afterGetPage(@NotNull QueryPageResponse<E> queryPageResponse) 🟢分页查询后置方法protected voidafterSaved(long id, E source) 🟢保存后置方法protected voidafterUpdate(long id, E source) 🟢修改后置方法protected E🟢添加前置方法protected voidbeforeDelete(long id) 🟢删除前置方法protected voidbeforeDisable(long id) 🟢禁用前置方法protected voidbeforeEnable(long id) 🟢启用前置方法protected <T extends QueryRequest<E>>
TbeforeGetList(T sourceRequestData) 🟢不分页查询前置方法protected <T extends QueryPageRequest<E>>
TbeforeGetPage(T sourceRequestData) 🟢分页查询前置方法protected EbeforeSaveToDatabase(E entity) 🟢数据库操作前的最后一次确认protected EbeforeUpdate(E source) 🟢修改前置方法final voiddelete(long id) 🟡删除指定的数据protected final voiddeleteById(long id) 🔴删除指定的数据final voiddisable(long id) 🟡禁用指定的数据protected final voiddisableById(long id) 🔴禁用指定的数据final voidenable(long id) 🟡启用指定的数据protected final voidenableById(long id) 🔴启用指定的数据🟡过滤数据final Eget(long id) 🟡根据ID查询对应的实体getList(QueryRequest<E> queryRequest) 🟡不分页查询数据final EgetMaybeNull(long id) 🟡根据ID查询对应的实体final @NotNull QueryPageResponse<E>getPage(QueryPageRequest<E> queryPageRequest) 🟡分页查询数据protected final EignoreReadOnlyFields(E entity) 🔴忽略只读字段protected final long尝试获取当前登录用户IDfinal void🟡修改一条已经存在的数据protected final voidupdateToDatabase(E source) 🔴更新到数据库protected final voidupdateToDatabase(E source, boolean withNull) 🔴更新到数据库final voidupdateWithNull(E source) 🔴修改一条已经存在的数据
-
字段详细资料
-
repository
-
-
构造器详细资料
-
RootService
public RootService()
-
-
方法详细资料
-
beforeAdd
🟢添加前置方法
- 参数:
source- 原始实体- 返回:
- 处理后的实体
-
add
🟡添加一条数据
- 参数:
source- 原始实体- 返回:
- 保存后的主键ID
- 另请参阅:
-
afterAdd
🟢添加后置方法
- 参数:
id- 主键IDsource- 原始实体
-
beforeUpdate
🟢修改前置方法
- 参数:
source- 原始实体- 返回:
- 处理后的实体
-
update
🟡修改一条已经存在的数据
- 参数:
source- 保存的实体- 另请参阅:
-
updateWithNull
🔴修改一条已经存在的数据
- 参数:
source- 保存的实体- 另请参阅:
-
afterUpdate
- 参数:
id- 主键IDsource- 原始实体
-
afterSaved
🟢保存后置方法
- 参数:
id- 主键IDsource- 保存前的原数据
-
beforeDisable
protected void beforeDisable(long id) 🟢禁用前置方法
- 参数:
id- 主键ID
-
disable
public final void disable(long id) 🟡禁用指定的数据
- 参数:
id- 主键ID- 另请参阅:
-
afterDisable
protected void afterDisable(long id) 🟢禁用后置方法
- 参数:
id- 主键ID
-
beforeEnable
protected void beforeEnable(long id) 🟢启用前置方法
- 参数:
id- 主键ID
-
enable
public final void enable(long id) 🟡启用指定的数据
- 参数:
id- 主键ID- 另请参阅:
-
afterEnable
protected void afterEnable(long id) 🟢启用后置方法
- 参数:
id- 主键ID
-
beforeDelete
protected void beforeDelete(long id) 🟢删除前置方法
- 参数:
id- 主键ID
-
delete
public final void delete(long id) 🟡删除指定的数据
- 参数:
id- 主键ID- 另请参阅:
-
afterDelete
protected void afterDelete(long id) 🟢删除后置方法
- 参数:
id- 主键ID
-
beforeGetList
🟢不分页查询前置方法
- 参数:
sourceRequestData- 查询条件- 返回:
- 处理后的查询条件
- 另请参阅:
-
getList
🟡不分页查询数据
- 参数:
queryRequest- 请求的request- 返回:
- List数据
- 另请参阅:
-
filter
🟡过滤数据
- 参数:
filter- 全匹配过滤器- 返回:
- List数据
-
afterGetList
🟢不分页查询后置方法
- 参数:
list- 查询到的数据- 返回:
- 处理后的数据
- 另请参阅:
-
beforeGetPage
🟢分页查询前置方法
- 参数:
sourceRequestData- 原始请求的数据- 返回:
- 处理后的请求数据
-
afterGetPage
@NotNull protected @NotNull QueryPageResponse<E> afterGetPage(@NotNull @NotNull QueryPageResponse<E> queryPageResponse) 🟢分页查询后置方法
- 参数:
queryPageResponse- 查询到的数据- 返回:
- 处理后的数据
-
beforeSaveToDatabase
🟢数据库操作前的
最后一次确认- 返回:
- 当前实体
-
addSearchPredicate
@NotNull protected @NotNull List<jakarta.persistence.criteria.Predicate> addSearchPredicate(@NotNull @NotNull jakarta.persistence.criteria.Root<E> root, @NotNull @NotNull jakarta.persistence.criteria.CriteriaBuilder builder, @NotNull E search) 🟢添加搜索的查询条件
- 参数:
root- ROOTbuilder- 参数构造器search- 原始查询对象- 返回:
- 查询条件列表
-
get
🟡根据
ID查询对应的实体- 参数:
id- 主键ID- 返回:
- 实体
- 另请参阅:
-
getMaybeNull
🟡根据
ID查询对应的实体- 参数:
id- 主键ID- 返回:
- 实体
- 另请参阅:
-
afterGet
🟢详情查询后置方法
- 参数:
result- 查到的数据- 返回:
- 处理后的数据
-
getPage
🟡分页查询数据
- 参数:
queryPageRequest- 请求的request对象- 返回:
- 分页查询列表
- 另请参阅:
-
disableById
protected final void disableById(long id) 🔴禁用指定的数据
- 参数:
id- 主键ID- 另请参阅:
-
enableById
protected final void enableById(long id) 🔴启用指定的数据
- 参数:
id- 主键ID- 另请参阅:
-
deleteById
protected final void deleteById(long id) 🔴删除指定的数据
- 参数:
id- 主键ID- 另请参阅:
-
ignoreReadOnlyFields
🔴忽略只读字段
- 参数:
entity- 实体- 返回:
- 忽略只读字段之后的实体
-
updateToDatabase
🔴更新到数据库
- 参数:
source- 原始实体- 另请参阅:
-
updateToDatabase
🔴更新到数据库
- 参数:
source- 原始实体withNull- 是否更新空值- 另请参阅:
-
addPredicateNonNull
protected final <Y extends Comparable<? super Y>> void addPredicateNonNull(@NotNull @NotNull jakarta.persistence.criteria.Root<E> root, List<jakarta.persistence.criteria.Predicate> predicateList, String fieldName, java.util.function.BiFunction<jakarta.persistence.criteria.Expression<? extends Y>, Y, jakarta.persistence.criteria.Predicate> expression, Y value) 添加查询条件(
value不为null时)- 参数:
root- ROOTpredicateList- 查询条件列表fieldName- 所属的字段名称expression- 表达式value- 条件的值
-
tryToGetCurrentUserId
protected final long tryToGetCurrentUserId()尝试获取当前登录用户ID
- 返回:
- 用户ID
-