Result Maps collection does not contain value for java.util.HashMap

前言

查询报错

Result Maps collection does not contain value for java.util.HashMap

原因

SQL XML中包含此返回类型

解决

第一个错误是resultMap 应改为resultType

注意:就算你查询其他方法,XML也会因为有此段代码而报错
参考文章:【Result Maps collection does not contain value for java.util.HashMap】解决
参考文章:【Mybatis】resultType与resultMap

resultMap="java.util.HashMap"
     <select id="queryCertCodeByInfo" resultMap="java.util.HashMap">
        select fi_cert_code,counteract_cert_code
        from zd_fi_gl.fi_cert_title  where t_year=#{tYear}
        and company_code=#{companyCode}
        and fi_cert_code in (
        <foreach collection="certCodes" item="item" index="index" separator=",">
            #{item}
        </foreach>
        )
    </select>

使用合适的类型

posted @ 2025-06-18 09:41  HezhezhiyuLe  阅读(118)  评论(0)    收藏  举报