类 BaseService<Rep extends org.springframework.data.repository.CrudRepository<T,ID>,T extends Copyer<T>,ID,Input>
java.lang.Object
cn.zhxu.crud.service.BaseService<Rep,T,ID,Input>
- 类型参数:
Rep- 仓库类型T- 实体类类型ID- ID 类型Input- 输入类型
public class BaseService<Rep extends org.springframework.data.repository.CrudRepository<T,ID>,T extends Copyer<T>,ID,Input>
extends Object
基础服务层,封装了保存、删除操作
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected TforSaveByKeyValue(Input input) 使用关键字段值为保存操作查询实体类protected StringkeyValueExistsTip(Input input) protected Tprotected voidonCreating(Input input) 创建前调用protected void删除后调用protected voidonDeleting(T entity) 删除前调用protected void保存后调用protected void保存前调用protected voidonUpdating(T entity, Input input) 更新前调用static voidregisterHook(ServiceHook hook) voidsetRepository(Rep repository)
-
构造器详细资料
-
BaseService
public BaseService()
-
-
方法详细资料
-
registerHook
-
setRepository
-
repository
-
optional
-
nullable
-
require
-
forSaveByKeyValue
使用关键字段值为保存操作查询实体类- 参数:
input- Input- 返回:
- T
-
keyValueExistsTip
- 参数:
input- Input- 返回:
- 关键字段,已存在时的提示信息
-
newInstance
-
save
-
onCreating
创建前调用- 参数:
input- 创建输入
-
onUpdating
更新前调用- 参数:
entity- 更新前的实体input- 更新输入
-
onSaving
保存前调用- 参数:
entity- 带保存的实体
-
onSaved
保存后调用- 参数:
entity- 已保存的实体
-
delete
-
onDeleting
删除前调用- 参数:
entity- 待删除的实体
-
onDeleted
删除后调用- 参数:
entity- 已删除的实体
-