类 ServiceImpl<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>,T>
java.lang.Object
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M,T>
- 所有已实现的接口:
IService<T>
public abstract class ServiceImpl<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>,T>
extends Object
implements IService<T>
IService 实现类( 泛型:M 是 mapper 对象,T 是实体 )
- 从以下版本开始:
- 2018-06-23
- 作者:
- hubin
-
字段概要
字段从接口继承的字段 com.baomidou.mybatisplus.extension.service.IService
DEFAULT_BATCH_SIZE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected voidcloseSqlSession(org.apache.ibatis.session.SqlSession sqlSession) 已过时。3.3.0protected <E> booleanexecuteBatch(Collection<E> list, int batchSize, BiConsumer<org.apache.ibatis.session.SqlSession, E> consumer) 执行批量操作protected <E> booleanexecuteBatch(Collection<E> list, BiConsumer<org.apache.ibatis.session.SqlSession, E> consumer) 执行批量操作(默认批次提交数量IService.DEFAULT_BATCH_SIZE)protected booleanexecuteBatch(Consumer<org.apache.ibatis.session.SqlSession> consumer) 已过时。3.3.1 后面我打算移除掉executeBatch(Collection, int, BiConsumer)}.获取对应 entity 的 BaseMapper获取 entity 的 class根据 Wrapper,查询一条记录<V> VgetObj(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, Function<? super Object, V> mapper) 根据 Wrapper,查询一条记录根据 Wrapper,查询一条记录根据 Wrapper,查询一条记录protected org.apache.ibatis.session.SqlSessionFactoryprotected StringgetSqlStatement(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod) 获取mapperStatementIdbooleanremoveBatchByIds(Collection<?> list, int batchSize) 批量删除(jdbc批量提交)booleanremoveBatchByIds(Collection<?> list, int batchSize, boolean useFill) 批量删除(jdbc批量提交)boolean根据 ID 删除booleanremoveById(Serializable id, boolean useFill) 根据 ID 删除booleanremoveByIds(Collection<?> list) 删除(根据ID 批量删除)protected boolean已过时。3.3.1booleansaveBatch(Collection<T> entityList, int batchSize) 批量插入booleansaveOrUpdate(T entity) TableId 注解存在更新记录,否插入一条记录booleansaveOrUpdateBatch(Collection<T> entityList, int batchSize) 批量修改插入protected org.apache.ibatis.session.SqlSession已过时。3.3.0protected StringsqlStatement(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod) 已过时。3.4.0booleanupdateBatchById(Collection<T> entityList, int batchSize) 根据ID 批量更新从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 com.baomidou.mybatisplus.extension.service.IService
count, count, exists, getById, getOne, getOneOpt, getOptById, ktQuery, ktUpdate, lambdaQuery, lambdaQuery, lambdaUpdate, list, list, list, list, listByIds, listByMap, listMaps, listMaps, listMaps, listMaps, listObjs, listObjs, listObjs, listObjs, page, page, pageMaps, pageMaps, query, remove, removeBatchByIds, removeBatchByIds, removeById, removeByIds, removeByMap, save, saveBatch, saveOrUpdate, saveOrUpdateBatch, update, update, update, updateBatchById, updateById
-
字段详细资料
-
log
protected final org.apache.ibatis.logging.Log log -
baseMapper
-
typeArguments
-
entityClass
-
mapperClass
-
-
构造器详细资料
-
ServiceImpl
public ServiceImpl()
-
-
方法详细资料
-
getBaseMapper
从接口复制的说明:IService获取对应 entity 的 BaseMapper- 指定者:
getBaseMapper在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 返回:
- BaseMapper
-
getEntityClass
从接口复制的说明:IService获取 entity 的 class -
getSqlSessionFactory
protected org.apache.ibatis.session.SqlSessionFactory getSqlSessionFactory() -
retBool
已过时。3.3.1判断数据库操作是否成功- 参数:
result- 数据库操作返回影响条数- 返回:
- boolean
-
currentMapperClass
-
currentModelClass
-
sqlSessionBatch
已过时。3.3.0批量操作 SqlSession -
closeSqlSession
已过时。3.3.0释放sqlSession- 参数:
sqlSession- session
-
sqlStatement
已过时。3.4.0获取 SqlStatement- 参数:
sqlMethod- ignore- 返回:
- ignore
- 另请参阅:
-
saveBatch
@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveBatch(Collection<T> entityList, int batchSize) 批量插入 -
getSqlStatement
获取mapperStatementId- 参数:
sqlMethod- 方法名- 返回:
- 命名id
- 从以下版本开始:
- 3.4.0
-
saveOrUpdate
TableId 注解存在更新记录,否插入一条记录- 指定者:
saveOrUpdate在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
entity- 实体对象- 返回:
- boolean
-
saveOrUpdateBatch
@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize) 从接口复制的说明:IService批量修改插入- 指定者:
saveOrUpdateBatch在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
entityList- 实体对象集合batchSize- 每次的数量
-
updateBatchById
@Transactional(rollbackFor=java.lang.Exception.class) public boolean updateBatchById(Collection<T> entityList, int batchSize) 从接口复制的说明:IService根据ID 批量更新- 指定者:
updateBatchById在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
entityList- 实体对象集合batchSize- 更新批次数量
-
getOne
从接口复制的说明:IService根据 Wrapper,查询一条记录 -
getOneOpt
public Optional<T> getOneOpt(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, boolean throwEx) 从接口复制的说明:IService根据 Wrapper,查询一条记录 -
getMap
从接口复制的说明:IService根据 Wrapper,查询一条记录 -
getObj
public <V> V getObj(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, Function<? super Object, V> mapper) 从接口复制的说明:IService根据 Wrapper,查询一条记录 -
executeBatch
已过时。3.3.1 后面我打算移除掉executeBatch(Collection, int, BiConsumer)}.执行批量操作- 参数:
consumer- consumer- 从以下版本开始:
- 3.3.0
-
executeBatch
protected <E> boolean executeBatch(Collection<E> list, int batchSize, BiConsumer<org.apache.ibatis.session.SqlSession, E> consumer) 执行批量操作- 类型参数:
E- 泛型- 参数:
list- 数据集合batchSize- 批量大小consumer- 执行方法- 返回:
- 操作结果
- 从以下版本开始:
- 3.3.1
-
executeBatch
protected <E> boolean executeBatch(Collection<E> list, BiConsumer<org.apache.ibatis.session.SqlSession, E> consumer) 执行批量操作(默认批次提交数量IService.DEFAULT_BATCH_SIZE)- 类型参数:
E- 泛型- 参数:
list- 数据集合consumer- 执行方法- 返回:
- 操作结果
- 从以下版本开始:
- 3.3.1
-
removeById
从接口复制的说明:IService根据 ID 删除- 指定者:
removeById在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
id- 主键ID
-
removeByIds
@Transactional(rollbackFor=java.lang.Exception.class) public boolean removeByIds(Collection<?> list) 从接口复制的说明:IService删除(根据ID 批量删除)- 指定者:
removeByIds在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
list- 主键ID或实体列表
-
removeById
从接口复制的说明:IService根据 ID 删除- 指定者:
removeById在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
id- 主键(类型必须与实体类型字段保持一致)useFill- 是否启用填充(为true的情况,会将入参转换实体进行delete删除)- 返回:
- 删除结果
-
removeBatchByIds
@Transactional(rollbackFor=java.lang.Exception.class) public boolean removeBatchByIds(Collection<?> list, int batchSize) 从接口复制的说明:IService批量删除(jdbc批量提交)- 指定者:
removeBatchByIds在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
list- 主键ID或实体列表batchSize- 批次大小- 返回:
- 删除结果
-
removeBatchByIds
@Transactional(rollbackFor=java.lang.Exception.class) public boolean removeBatchByIds(Collection<?> list, int batchSize, boolean useFill) 从接口复制的说明:IService批量删除(jdbc批量提交)- 指定者:
removeBatchByIds在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
list- 主键ID或实体列表batchSize- 批次大小useFill- 是否启用填充(为true的情况,会将入参转换实体进行delete删除)- 返回:
- 删除结果
-