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

时间:2022-03-17 19:37:18
各位   救个急     错误是  
         Caused by: java.lang.IllegalArgumentException: Result Maps collection does not contain value for java.util.Map

       
配置是
<resultMap id="BaseResultMap" type="com.upi.virtualcard.model.Users" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="username" property="username" jdbcType="VARCHAR" />
    <result column="password" property="password" jdbcType="VARCHAR" />
    <result column="company_code" property="companyCode" jdbcType="VARCHAR" />
    <result column="iss_code" property="issCode" jdbcType="VARCHAR" />
    <result column="user_level" property="userLevel" jdbcType="VARCHAR" />
    <result column="pwd_chg_time" property="pwdChgTime" jdbcType="TIMESTAMP" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="is_register" property="isRegister" jdbcType="VARCHAR" />
    <result column="rec_crt_time" property="recCrtTime" jdbcType="TIMESTAMP" />
    <result column="rec_updt_time" property="recUpdtTime" jdbcType="TIMESTAMP" />
  </resultMap>
  
  <resultMap id="UserGroup" type="com.upi.virtualcard.model.Users" extends="BaseResultMap">
   <collection property="groups" ofType="com.upi.virtualcard.model.Groups" javaType="java.util.ArrayList"> 
    <id column="gid" property="id" jdbcType="BIGINT" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="VARCHAR" />
    <result column="rec_crt_time" property="recCrtTime" jdbcType="TIMESTAMP" />
    <result column="rec_updt_time" property="recUpdtTime" jdbcType="TIMESTAMP" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
</collection>    
  </resultMap>
  
  <select id="findByUserNameAndCompanyCode" resultMap="UserGroup" parameterType="Map" >
    select 
    u.*,g.id gid , g.name,g.type,g.remark 
    from users u left join group_members gm on u.id=gm.user_id  
            left join groups g on gm.group_id=g.id 
    where username = #{userName,jdbcType=VARCHAR} and company_code = #{companyCode,jdbcType=VARCHAR}
  </select>

3 个解决方案

#1


之前是没有问题的是我自己调试好的    怎么现在报这个错误   resultMap根本没有包含map

#2


参考
https://blog.csdn.net/zengdeqing2012/article/details/50978682
https://www.cnblogs.com/hwd-cnblogs/archive/2012/11/26/2788869.html

#3


你说的 这个我网上找到了    不是这些原因   都试过

#1


之前是没有问题的是我自己调试好的    怎么现在报这个错误   resultMap根本没有包含map

#2


参考
https://blog.csdn.net/zengdeqing2012/article/details/50978682
https://www.cnblogs.com/hwd-cnblogs/archive/2012/11/26/2788869.html

#3


你说的 这个我网上找到了    不是这些原因   都试过