Class SuperServiceImpl<M extends SuperManager<Entity>,Id extends Serializable,Entity extends SuperEntity<?>>
java.lang.Object
top.tangyh.basic.base.service.impl.SuperServiceImpl<M,Id,Entity>
- Type Parameters:
M- ManagerId- IDEntity- 实体
- All Implemented Interfaces:
SuperService<Id,Entity>
- Direct Known Subclasses:
SuperCacheServiceImpl
public class SuperServiceImpl<M extends SuperManager<Entity>,Id extends Serializable,Entity extends SuperEntity<?>>
extends Object
implements SuperService<Id,Entity>
不含缓存的Service实现
2,removeById:重写 ServiceImpl 类的方法,删除db 3,removeByIds:重写 ServiceImpl 类的方法,删除db 4,updateAllById: 新增的方法: 修改数据(所有字段) 5,updateById:重写 ServiceImpl 类的方法,修改db后
- Author:
- zuihou
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription复制一条数据根据 ID 查询获取实体的类型获取主键的类型获取Manager的类型查询列表批量查询<E extends com.baomidou.mybatisplus.core.metadata.IPage<Entity>>
E翻页查询booleanremoveByIds(Collection<Id> idList) 删除(根据ID 批量删除)<SaveVO> Entitysave(SaveVO saveVO) 插入一条记录(选择字段,策略插入)protected <SaveVO> void保存之后设置参数值,淘汰缓存等操作boolean批量保存protected <SaveVO> EntitysaveBefore(SaveVO saveVO) 保存之前处理参数等操作protected <UpdateVO> voidupdateAfter(UpdateVO updateVO, Entity entity) 修改之后设置参数值,淘汰缓存等操作protected <UpdateVO> voidupdateAllAfter(UpdateVO updateVO, Entity entity) 修改之后设置参数值,淘汰缓存等操作protected <UpdateVO> EntityupdateAllBefore(UpdateVO updateVO) 修改之前处理参数等操作<UpdateVO> EntityupdateAllById(UpdateVO updateVO) 根据id修改 entity 的所有字段protected <UpdateVO> EntityupdateBefore(UpdateVO updateVO) 修改之前处理参数等操作<UpdateVO> EntityupdateById(UpdateVO updateVO) 根据 ID 修改实体中非空的字段
-
Field Details
-
superManager
-
managerClass
-
entityClass
-
idClass
-
-
Constructor Details
-
SuperServiceImpl
public SuperServiceImpl()
-
-
Method Details
-
getSuperManager
Description copied from interface:SuperService获取Manager的类型- Specified by:
getSuperManagerin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Returns:
- Manager的class类型
-
getEntityClass
Description copied from interface:SuperService获取实体的类型- Specified by:
getEntityClassin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Returns:
- 实体类class类型
-
getIdClass
Description copied from interface:SuperService获取主键的类型- Specified by:
getIdClassin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Returns:
- 主键class类型
-
currentManagerClass
-
currentIdClass
-
currentModelClass
-
save
Description copied from interface:SuperService插入一条记录(选择字段,策略插入)- Specified by:
savein interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
saveVO- 实体对象- Returns:
- 是否插入成功
-
saveBatch
@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveBatch(List<Entity> entityList) Description copied from interface:SuperService批量保存- Specified by:
saveBatchin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
entityList- 实体集合- Returns:
- 是否执行成功
-
saveBefore
保存之前处理参数等操作- Parameters:
saveVO- 保存VO
-
saveAfter
保存之后设置参数值,淘汰缓存等操作- Parameters:
saveVO- 保存VOentity- 实体
-
updateById
@Transactional(rollbackFor=java.lang.Exception.class) public <UpdateVO> Entity updateById(UpdateVO updateVO) Description copied from interface:SuperService根据 ID 修改实体中非空的字段- Specified by:
updateByIdin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
updateVO- 实体对象- Returns:
- 是否修改成功
-
updateBefore
修改之前处理参数等操作- Parameters:
updateVO- 修改VO
-
updateAfter
修改之后设置参数值,淘汰缓存等操作- Parameters:
updateVO- 修改VOentity- 实体
-
updateAllById
@Transactional(rollbackFor=java.lang.Exception.class) public <UpdateVO> Entity updateAllById(UpdateVO updateVO) Description copied from interface:SuperService根据id修改 entity 的所有字段- Specified by:
updateAllByIdin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
updateVO- 实体对象- Returns:
- 是否修改成功
-
updateAllBefore
修改之前处理参数等操作- Parameters:
updateVO- 修改VO
-
updateAllAfter
修改之后设置参数值,淘汰缓存等操作- Parameters:
updateVO- 修改VOentity- 实体
-
copy
Description copied from interface:SuperService复制一条数据注意:若该数据存在唯一索引等限制条件,需要重写该方法进行判断或处理。
- Specified by:
copyin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
id- ID- Returns:
- 复制后的实体
-
removeByIds
@Transactional(rollbackFor=java.lang.Exception.class) public boolean removeByIds(Collection<Id> idList) Description copied from interface:SuperService删除(根据ID 批量删除)- Specified by:
removeByIdsin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
idList- 主键ID列表- Returns:
- 是否删除成功
-
getById
Description copied from interface:SuperService根据 ID 查询- Specified by:
getByIdin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
id- 主键ID- Returns:
- 实体对象或null
-
list
@Transactional(readOnly=true) public List<Entity> list(com.baomidou.mybatisplus.core.conditions.Wrapper<Entity> queryWrapper) Description copied from interface:SuperService查询列表- Specified by:
listin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
queryWrapper- 实体对象封装操作类QueryWrapper- Returns:
- 实体对象集合或空集合
-
listByIds
Description copied from interface:SuperService批量查询- Specified by:
listByIdsin interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
ids- 主键- Returns:
- 实体对象集合或空集合
-
page
@Transactional(readOnly=true) public <E extends com.baomidou.mybatisplus.core.metadata.IPage<Entity>> E page(E page, com.baomidou.mybatisplus.core.conditions.Wrapper<Entity> queryWrapper) Description copied from interface:SuperService翻页查询- Specified by:
pagein interfaceSuperService<M extends SuperManager<Entity>,Id extends Serializable> - Parameters:
page- 翻页对象queryWrapper- 实体对象封装操作类QueryWrapper- Returns:
- 实体分页对象
-