From e9bfa1396ff47d171b3052a606e0931e6f93cc9c Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期四, 10 四月 2025 12:05:23 +0800 Subject: [PATCH] 还原framework代码 --- iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/common/service/BaseService.java | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 116 insertions(+), 0 deletions(-) diff --git a/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/common/service/BaseService.java b/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/common/service/BaseService.java new file mode 100644 index 0000000..686441d --- /dev/null +++ b/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/common/service/BaseService.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.iailab.framework.common.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; + +import java.io.Serializable; +import java.util.Collection; + +/** + * 基础服务接口,所有Service接口都要继承 + * + * @author Mark sunlightcs@gmail.com + */ +public interface BaseService<T> { + Class<T> currentModelClass(); + + /** + * <p> + * 插入一条记录(选择字段,策略插入) + * </p> + * + * @param entity 实体对象 + */ + boolean insert(T entity); + + /** + * <p> + * 插入(批量),该方法不支持 Oracle、SQL Server + * </p> + * + * @param entityList 实体对象集合 + */ + boolean insertBatch(Collection<T> entityList); + + /** + * <p> + * 插入(批量),该方法不支持 Oracle、SQL Server + * </p> + * + * @param entityList 实体对象集合 + * @param batchSize 插入批次数量 + */ + boolean insertBatch(Collection<T> entityList, int batchSize); + + /** + * <p> + * 根据 ID 选择修改 + * </p> + * + * @param entity 实体对象 + */ + boolean updateById(T entity); + + /** + * <p> + * 根据 whereEntity 条件,更新记录 + * </p> + * + * @param entity 实体对象 + * @param updateWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper} + */ + boolean update(T entity, Wrapper<T> updateWrapper); + + /** + * <p> + * 根据ID 批量更新 + * </p> + * + * @param entityList 实体对象集合 + */ + boolean updateBatchById(Collection<T> entityList); + + /** + * <p> + * 根据ID 批量更新 + * </p> + * + * @param entityList 实体对象集合 + * @param batchSize 更新批次数量 + */ + boolean updateBatchById(Collection<T> entityList, int batchSize); + + /** + * <p> + * 根据 ID 查询 + * </p> + * + * @param id 主键ID + */ + T selectById(Serializable id); + + /** + * <p> + * 根据 ID 删除 + * </p> + * + * @param id 主键ID + */ + boolean deleteById(Serializable id); + + /** + * <p> + * 删除(根据ID 批量删除) + * </p> + * + * @param idList 主键ID列表 + */ + boolean deleteBatchIds(Collection<? extends Serializable> idList); +} \ No newline at end of file -- Gitblit v1.9.3