解决mybatis报错Result Maps collection does not contain value for java.lang.Integer

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决mybatis报错Result Maps collection does not contain value for java.lang.Integer相关的知识,希望对你有一定的参考价值。

 

解决办法:
1.检查mybatis的xml配置

2.在某处肯定有配错了的,如"resultMap" -->"resultType"

[html] view plain copy
<select id="getNumDayMoney" resultMap="java.lang.Integer" parameterType="java.lang.Integer">
<![CDATA[
select sum(money) from dw_account_recharge where user_id = #{userId}
AND addtime < UNIX_TIMESTAMP(
date_sub(curdate(), INTERVAL - 1 DAY)
)
AND addtime > UNIX_TIMESTAMP(
date_sub(curdate(), INTERVAL 1 DAY)
)
]]>
</select>
修改为:
[html] view plain copy
<select id="getNumDayMoney" resultType="java.lang.Integer" parameterType="java.lang.Integer">
<![CDATA[
select sum(money) from dw_account_recharge where user_id = #{userId}
AND addtime < UNIX_TIMESTAMP(
date_sub(curdate(), INTERVAL - 1 DAY)
)
AND addtime > UNIX_TIMESTAMP(
date_sub(curdate(), INTERVAL 1 DAY)
)
]]>
</select>

以上是关于解决mybatis报错Result Maps collection does not contain value for java.lang.Integer的主要内容,如果未能解决你的问题,请参考以下文章

mybatis报错:A query was run and no Result Maps were found for the Mapped StatementProperty [login_ip(代

mybatis 报错Result Maps collection does not contain value for java.lang.Integer

Result Maps collection already contains value for 问题总结

Spring Boot Mybatis Result Maps collection already contains value for *.BaseResultMap

MyBatis报错:A query was run and no Result Maps were found for the Mapped Statement

MyBatis报错:A query was run and no Result Maps were found for the Mapped Statement