类 ServiceImpl<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>,T>
- java.lang.Object
-
- com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M,T>
-
-
字段概要
字段 修饰符和类型 字段 说明 protected MbaseMapperprotected java.lang.Class<T>entityClassprotected org.apache.ibatis.logging.Loglogprotected java.lang.Class<M>mapperClass-
从接口继承的字段 com.baomidou.mybatisplus.extension.service.IService
DEFAULT_BATCH_SIZE
-
-
构造器概要
构造器 构造器 说明 ServiceImpl()
-
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected voidcloseSqlSession(org.apache.ibatis.session.SqlSession sqlSession)已过时。3.3.0protected java.lang.Class<M>currentMapperClass()protected java.lang.Class<T>currentModelClass()protected <E> booleanexecuteBatch(java.util.Collection<E> list, int batchSize, java.util.function.BiConsumer<org.apache.ibatis.session.SqlSession,E> consumer)执行批量操作protected <E> booleanexecuteBatch(java.util.Collection<E> list, java.util.function.BiConsumer<org.apache.ibatis.session.SqlSession,E> consumer)执行批量操作(默认批次提交数量IService.DEFAULT_BATCH_SIZE)protected booleanexecuteBatch(java.util.function.Consumer<org.apache.ibatis.session.SqlSession> consumer)已过时。3.3.1 后面我打算移除掉executeBatch(Collection, int, BiConsumer)}.MgetBaseMapper()获取对应 entity 的 BaseMapperjava.lang.Class<T>getEntityClass()获取 entity 的 classjava.util.Map<java.lang.String,java.lang.Object>getMap(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)根据 Wrapper,查询一条记录<V> VgetObj(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, java.util.function.Function<? super java.lang.Object,V> mapper)根据 Wrapper,查询一条记录TgetOne(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, boolean throwEx)根据 Wrapper,查询一条记录protected java.lang.StringgetSqlStatement(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod)获取mapperStatementIdbooleanremoveBatchByIds(java.util.Collection<?> list, int batchSize)批量删除(jdbc批量提交)booleanremoveBatchByIds(java.util.Collection<?> list, int batchSize, boolean useFill)批量删除(jdbc批量提交)booleanremoveById(java.io.Serializable id)根据 ID 删除booleanremoveById(java.io.Serializable id, boolean useFill)根据 ID 删除booleanremoveByIds(java.util.Collection<?> list)删除(根据ID 批量删除)protected booleanretBool(java.lang.Integer result)已过时。3.3.1booleansaveBatch(java.util.Collection<T> entityList, int batchSize)批量插入booleansaveOrUpdate(T entity)TableId 注解存在更新记录,否插入一条记录booleansaveOrUpdateBatch(java.util.Collection<T> entityList, int batchSize)批量修改插入protected org.apache.ibatis.session.SqlSessionsqlSessionBatch()已过时。3.3.0protected java.lang.StringsqlStatement(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod)已过时。3.4.0booleanupdateBatchById(java.util.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, getById, getOne, ktQuery, ktUpdate, lambdaQuery, lambdaUpdate, list, list, listByIds, listByMap, 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
-
-
-
-
方法详细资料
-
getBaseMapper
public M getBaseMapper()
从接口复制的说明:IService获取对应 entity 的 BaseMapper- 指定者:
getBaseMapper在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 返回:
- BaseMapper
-
getEntityClass
public java.lang.Class<T> getEntityClass()
从接口复制的说明:IService获取 entity 的 class- 指定者:
getEntityClass在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 返回:
Class
-
retBool
@Deprecated protected boolean retBool(java.lang.Integer result)
已过时。3.3.1判断数据库操作是否成功- 参数:
result- 数据库操作返回影响条数- 返回:
- boolean
-
currentMapperClass
protected java.lang.Class<M> currentMapperClass()
-
currentModelClass
protected java.lang.Class<T> currentModelClass()
-
sqlSessionBatch
@Deprecated protected org.apache.ibatis.session.SqlSession sqlSessionBatch()
已过时。3.3.0批量操作 SqlSession
-
closeSqlSession
@Deprecated protected void closeSqlSession(org.apache.ibatis.session.SqlSession sqlSession)
已过时。3.3.0释放sqlSession- 参数:
sqlSession- session
-
sqlStatement
@Deprecated protected java.lang.String sqlStatement(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod)
已过时。3.4.0获取 SqlStatement- 参数:
sqlMethod- ignore- 返回:
- ignore
- 另请参阅:
getSqlStatement(SqlMethod)
-
saveBatch
@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveBatch(java.util.Collection<T> entityList, int batchSize)
批量插入
-
getSqlStatement
protected java.lang.String getSqlStatement(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod)
获取mapperStatementId- 参数:
sqlMethod- 方法名- 返回:
- 命名id
- 从以下版本开始:
- 3.4.0
-
saveOrUpdate
@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveOrUpdate(T entity)
TableId 注解存在更新记录,否插入一条记录- 指定者:
saveOrUpdate在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
entity- 实体对象- 返回:
- boolean
-
saveOrUpdateBatch
@Transactional(rollbackFor=java.lang.Exception.class) public boolean saveOrUpdateBatch(java.util.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(java.util.Collection<T> entityList, int batchSize)
从接口复制的说明:IService根据ID 批量更新- 指定者:
updateBatchById在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
entityList- 实体对象集合batchSize- 更新批次数量
-
getOne
public T getOne(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, boolean throwEx)
从接口复制的说明:IService根据 Wrapper,查询一条记录
-
getMap
public java.util.Map<java.lang.String,java.lang.Object> getMap(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
从接口复制的说明:IService根据 Wrapper,查询一条记录
-
getObj
public <V> V getObj(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, java.util.function.Function<? super java.lang.Object,V> mapper)
从接口复制的说明:IService根据 Wrapper,查询一条记录
-
executeBatch
@Deprecated protected boolean executeBatch(java.util.function.Consumer<org.apache.ibatis.session.SqlSession> consumer)
已过时。3.3.1 后面我打算移除掉executeBatch(Collection, int, BiConsumer)}.执行批量操作- 参数:
consumer- consumer- 从以下版本开始:
- 3.3.0
-
executeBatch
protected <E> boolean executeBatch(java.util.Collection<E> list, int batchSize, java.util.function.BiConsumer<org.apache.ibatis.session.SqlSession,E> consumer)执行批量操作- 类型参数:
E- 泛型- 参数:
list- 数据集合batchSize- 批量大小consumer- 执行方法- 返回:
- 操作结果
- 从以下版本开始:
- 3.3.1
-
executeBatch
protected <E> boolean executeBatch(java.util.Collection<E> list, java.util.function.BiConsumer<org.apache.ibatis.session.SqlSession,E> consumer)执行批量操作(默认批次提交数量IService.DEFAULT_BATCH_SIZE)- 类型参数:
E- 泛型- 参数:
list- 数据集合consumer- 执行方法- 返回:
- 操作结果
- 从以下版本开始:
- 3.3.1
-
removeById
public boolean removeById(java.io.Serializable id)
从接口复制的说明: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(java.util.Collection<?> list)
从接口复制的说明:IService删除(根据ID 批量删除)- 指定者:
removeByIds在接口中IService<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
list- 主键ID或实体列表
-
removeById
public boolean removeById(java.io.Serializable id, boolean useFill)从接口复制的说明: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(java.util.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(java.util.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删除)- 返回:
- 删除结果
-
-