版权声明:转发请标明出处,谢谢! https://blog.csdn.net/Myuhua/article/details/85047955
错误信息: 结果com.jd.ecodd.param.concat.client.vo.QuerySceneTypeVo结果集不包含值
java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.jd.ecodd.param.concat.client.vo.QuerySceneTypeVo
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:888)
at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:640)
at org.apache.ibatis.builder.MapperBuilderAssistant.getStatementResultMaps(MapperBuilderAssistant.java:344)
at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:290)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
错误原因:因为我在mapper.xml文件上面定义了resultMap:
<resultMap id="QuerySceneTypeVo" type="com.jd.ecodd.param.concat.client.vo.QuerySceneTypeVo">
<result column="id" property="id"/>
<result column="source_type" property="sourceType"/>
<result column="source_type_code" property="sourceTypeCode"/>
</resultMap>
而我在下面写select方法的使用引用的非已经定义好的结果集,而引用的是原包:
<select id="get"
parameterType="java.lang.String"
resultMap="com.jd.ecodd.param.concat.client.vo.QuerySceneTypeVo">
SELECT
<include refid="baseColum"/>
FROM t_tableName
<where>
<if test="source!=null and source!=''">
and source LIKE CONCAT ('%',#{source},'%')
</if>
</where>
</select>
以上两种方式冲突,所以报了这个错误。
解决方法:使用其中一种返回方式就可以了。