通用mapper接口已经写好的 根据 list 集合查询 相应数据
package tk.mybatis.mapper.additional.idlist;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
/**
* 通用Mapper接口,根据ids查询
*
* @param <T> 不能为空
* @author liuzh
*/
@tk.mybatis.mapper.annotation.RegisterMapper
public interface SelectByIdListMapper<T, PK> {
/**
* 根据主键字符串进行查询,类中只有存在一个带有@Id注解的字段
*
* @param idList
* @return
*/
@SelectProvider(type = IdListProvider.class, method = "dynamicSQL")
List<T> selectByIdList(@Param("idList") List<PK> idList);
}
接口名称
SelectByIdListMapper<T,pk>
参数 返回的对应 pojo 字段名
pk 查询的list字段 的数据类型 LONG INT等

浙公网安备 33010602011771号