错误信息: 结果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. . StatementBuilder.parseStatementNode( StatementBuilder.java:109)

错误原因:因为我在mapper. 文件上面定义了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=\" Colum\"/>
        FROM t_tableName
        <where>
            <if test=\"source!=null and source!=\'\'\">
                and source LIKE CONCAT (\'%\',#{source},\'%\')
            </if>
        </where>
    </select>

以上两种方式冲突,所以报了这个错误。

解决方法:使用其中一种返回方式就可以了。

收藏 打印