传入list 返回map
//通过MapKey 指定返回map的 key值
@MapKey("keyId")
Map<String, XXXDto> getInvoiceByItems(@Param("XXXDto") List<XXXDto> XXXDtos);
mapper.xml
<resultMap id="BaseResultMap" type="com.xxx.dto.xxxxDto"> <result column="keyId" property="keyId"/> <result column="xxx" property="xxx"/> </resultMap> <select id="getInvoiceByItems" resultMap="BaseResultMap"> select CONCAT(d.xxx,'_',d.xxx)as keyId, -- 根据需求确定key xxx from a left join b on a.id = b.id where <foreach item="xxxDto" index="index" collection="xxxDtos" separator="or"> (a.xxx= #{xxxDto.xxx}) </foreach> </select>