Service

Service

  • 通用的 Service SRUD 封装了 IService 接口,进一步封装了 CRUD 操作,为了和 Mapper 区分,Service 采用 get 查询单行,remove 删除、list 查询集合,page 分页前缀命名的方式。

  • 泛型 T 为任意实体对象

  • 对象 Wrapper 为条件构造器。

Save

// 插入一条记录
boolean save(T entity);

// 批量插入
boolean saveBatch(Coolection<T> entityList);

// 批量插入,batchSize 插入批次数量
boolean saveBatch(Coolection<T> entityList, int batchSize)

SaveOrUpdate

// TableId 注解属性存在则更新记录,否则插入一条新记录
boolean saveOrUpdate(T entity);

// 根据 updateWrapper 尝试更新,否则继续执行 saveOrUpdate(T) 方法
boolean saveOrUpdate(T entity, Wrapper<T> updateWrapper);

// 批量修改插入
boolean saveOrUpdateBatch(Collection<T> entityList);

// 批量修改插入,batchSize 插入批次数量
boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize);

Remove

Update

Get

List

Page

Count

最后更新于