package xiaozhi.common.service; import java.io.Serializable; import java.util.Collection; import com.baomidou.mybatisplus.core.conditions.Wrapper; /** * 基础服务接口,所有Service接口都要继承 * Copyright (c) 人人开源 All rights reserved. * Website: https://www.renren.io */ public interface BaseService { Class currentModelClass(); /** *

* 插入一条记录(选择字段,策略插入) *

* * @param entity 实体对象 */ boolean insert(T entity); /** *

* 插入(批量),该方法不支持 Oracle、SQL Server *

* * @param entityList 实体对象集合 */ boolean insertBatch(Collection entityList); /** *

* 插入(批量),该方法不支持 Oracle、SQL Server *

* * @param entityList 实体对象集合 * @param batchSize 插入批次数量 */ boolean insertBatch(Collection entityList, int batchSize); /** *

* 根据 ID 选择修改 *

* * @param entity 实体对象 */ boolean updateById(T entity); /** *

* 根据 whereEntity 条件,更新记录 *

* * @param entity 实体对象 * @param updateWrapper 实体对象封装操作类 * {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper} */ boolean update(T entity, Wrapper updateWrapper); /** *

* 根据ID 批量更新 *

* * @param entityList 实体对象集合 */ boolean updateBatchById(Collection entityList); /** *

* 根据ID 批量更新 *

* * @param entityList 实体对象集合 * @param batchSize 更新批次数量 */ boolean updateBatchById(Collection entityList, int batchSize); /** *

* 根据 ID 查询 *

* * @param id 主键ID */ T selectById(Serializable id); /** *

* 根据 ID 删除 *

* * @param id 主键ID */ boolean deleteById(Serializable id); /** *

* 删除(根据ID 批量删除) *

* * @param idList 主键ID列表 */ boolean deleteBatchIds(Collection idList); }