mybatisplus-Service CRUD 接口
通用 Service CRUD 封装IService (opens new window)接口,进一步封装 CRUD 采用 get 查询单行 remove 删除 list 查询集合 page 分页 前缀命名方式
Save
// 插入一条记录(选择字段,策略插入)
boolean save(T entity);
// 插入(批量)
boolean saveBatch(Collection
// 插入(批量)
boolean saveBatch(Collection
SaveOrUpdate
// TableId 注解存在更新记录,否插入一条记录
boolean saveOrUpdate(T entity);
// 根据updateWrapper尝试更新,否继续执行saveOrUpdate(T)方法
boolean saveOrUpdate(T entity, Wrapper
// 批量修改插入
boolean saveOrUpdateBatch(Collection
// 批量修改插入
boolean saveOrUpdateBatch(Collection
Remove
// 根据 entity 条件,删除记录
boolean remove(Wrapper
// 根据 ID 删除
boolean removeById(Serializable id);
// 根据 columnMap 条件,删除记录
boolean removeByMap(Map<String, Object> columnMap);
// 删除(根据ID 批量删除)
boolean removeByIds(Collection<? extends Serializable> idList);
Update
// 根据 UpdateWrapper 条件,更新记录 需要设置sqlset
boolean update(Wrapper
// 根据 whereWrapper 条件,更新记录
boolean update(T updateEntity, Wrapper
// 根据 ID 选择修改
boolean updateById(T entity);
// 根据ID 批量更新
boolean updateBatchById(Collection
// 根据ID 批量更新
boolean updateBatchById(Collection
Get
// 根据 ID 查询
T getById(Serializable id);
// 根据 Wrapper,查询一条记录。结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")
T getOne(Wrapper
// 根据 Wrapper,查询一条记录
T getOne(Wrapper
// 根据 Wrapper,查询一条记录
Map<String, Object> getMap(Wrapper
// 根据 Wrapper,查询一条记录
List
// 查询所有
List
// 查询列表
List
// 查询(根据ID 批量查询)
Collection
// 查询(根据 columnMap 条件)
Collection
// 查询所有列表
List<Map<String, Object>> listMaps();
// 查询列表
List<Map<String, Object>> listMaps(Wrapper
// 查询全部记录
List