mybatis返回list<Integer>时resultType写Integer问题
mybatis返回list<Integer>时resultType写Integer

查询出的结果可能有好多条记录,返回类型即是list。
但resultType还是写成resultType="user"(user为集合list中的实体类),而不是写成resultType="java.util.List"
mybatis返回list<Integer>时resultType写java.lang.Integer而不是java.util.List
如果写成java.util.List时会报错
error querying database.the error occurred while handling results.
mybatis forEach List<Integer>
DAO内容:
List<ItEquipmentHeadersCustom> selectByListLocationId(@Param("locationIdList")List<Integer> locationIdList);XML文件内容:
<select id="selectByListLocationId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM IT.IT_EQUIPMENT_HEADERS ieh
where LOCATION_ID in
<foreach item="item" index="index" open="(" separator="," close=")" collection="locationIdList">
#{item}
</foreach>
</select>总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
redis redisson 限流器的实例(RRateLimiter)
这篇文章主要介绍了redis redisson 限流器的实例(RRateLimiter),具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2021-07-07
java中 String和StringBuffer的区别实例详解
这篇文章主要介绍了java中 String和StringBuffer的区别实例详解的相关资料,一个小的例子,来测试String和StringBuffer在时间和空间使用上的差别,需要的朋友可以参考下2017-04-04
SpringCloudGateway网关处拦截并修改请求的操作方法
这篇文章主要介绍了SpringCloudGateway网关处拦截并修改请求的操作方法,本文通过示例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧2023-12-12


最新评论