package com.kcim.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 通用批量插入接口，继承BaseMapper保留原有CRUD功能
 * @param <T> 实体类泛型
 */
public interface GenericBatchMapper<T> extends BaseMapper<T> {

    /**
     * 通用批量插入方法
     * @param list 实体列表
     * @return 插入成功的记录数
     */
    @InsertProvider(type = BatchInsertProvider.class, method = "insertBatch")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertBatch(@Param("list") List<T> list);
}