类 AbstractRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>,T>
java.lang.Object
com.baomidou.mybatisplus.extension.repository.AbstractRepository<M,T>
- 所有已实现的接口:
IRepository<T>
public abstract class AbstractRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>,T>
extends Object
implements IRepository<T>
-
字段概要
字段从接口继承的字段 com.baomidou.mybatisplus.extension.repository.IRepository
DEFAULT_BATCH_SIZE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected <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) 执行批量操作(默认批次提交数量IRepository.DEFAULT_BATCH_SIZE)获取 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.SqlSessionFactorybooleanremoveById(Serializable id, boolean useFill) 根据 ID 删除booleansaveOrUpdate(T entity) TableId 注解存在更新记录,否插入一条记录从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 com.baomidou.mybatisplus.extension.repository.IRepository
count, count, exists, getBaseMapper, 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, removeById, removeById, removeByIds, removeByIds, removeByMap, save, saveBatch, saveOrUpdateBatch, update, update, update, updateBatchById, updateById
-
字段详细资料
-
log
protected final org.apache.ibatis.logging.Log log
-
-
构造器详细资料
-
AbstractRepository
public AbstractRepository()
-
-
方法详细资料
-
getEntityClass
从接口复制的说明:IRepository获取 entity 的 class- 指定者:
getEntityClass在接口中IRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 返回:
Class<T>
-
getSqlSessionFactory
protected org.apache.ibatis.session.SqlSessionFactory getSqlSessionFactory() -
getMapperClass
- 返回:
- baseMapper 真实类型
- 从以下版本开始:
- 3.5.7
-
saveOrUpdate
TableId 注解存在更新记录,否插入一条记录- 指定者:
saveOrUpdate在接口中IRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
entity- 实体对象- 返回:
- boolean
-
getOne
从接口复制的说明:IRepository根据 Wrapper,查询一条记录- 指定者:
getOne在接口中IRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
queryWrapper- 实体对象封装操作类QueryWrapperthrowEx- 有多个 result 是否抛出异常
-
getOneOpt
public Optional<T> getOneOpt(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, boolean throwEx) 从接口复制的说明:IRepository根据 Wrapper,查询一条记录- 指定者:
getOneOpt在接口中IRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
queryWrapper- 实体对象封装操作类QueryWrapperthrowEx- 有多个 result 是否抛出异常- 返回:
Optional返回一个Optional对象
-
getMap
从接口复制的说明:IRepository根据 Wrapper,查询一条记录- 指定者:
getMap在接口中IRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
queryWrapper- 实体对象封装操作类QueryWrapper
-
getObj
public <V> V getObj(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper, Function<? super Object, V> mapper) 从接口复制的说明:IRepository根据 Wrapper,查询一条记录- 指定者:
getObj在接口中IRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
queryWrapper- 实体对象封装操作类QueryWrappermapper- 转换函数
-
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) 执行批量操作(默认批次提交数量IRepository.DEFAULT_BATCH_SIZE)- 类型参数:
E- 泛型- 参数:
list- 数据集合consumer- 执行方法- 返回:
- 操作结果
- 从以下版本开始:
- 3.3.1
-
removeById
从接口复制的说明:IRepository根据 ID 删除- 指定者:
removeById在接口中IRepository<M extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T>>- 参数:
id- 主键(类型必须与实体类型字段保持一致)useFill- 是否启用填充(为true的情况,会将入参转换实体进行delete删除)- 返回:
- 删除结果
-