Result Maps collection already contains value for cn.itcast.ssm.mapper.CompetesMapperCustom.baseMap

在使用ssm时出现的错误:

org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.itcast.ssm.mapper.CompetesMapperCustom.baseMap

原因是,在自己写的mapper.xml文件中具有相同id的不同select标签引用了同一个resultMap

例如:

<select id="selectCompetesForInit" parameterType="CompetesQueryVo" resultMap="baseMap">

     <include refid="baseSql"/>
   group by c.compete_id limit #{jumpCount},#{selectCount}

</select>

 

<select id="selectCompetesForInit" parameterType="CompetesQueryVo" resultMap="baseMap">
        <include refid="baseSql"/>
        <where>
            <if test="competeTitle != null">
                and compete_title like #{competeTitle}
            </if>
        </where>
        group by c.compete_id limit #{jumpCount},#{selectCount}
</select>

 

以上两个select具有相同的id(select里面的内容请自动忽略),其实不应该存在相同id的select标签,因为我太懒了(懒就懒呗,还不仔细,emmmmmmm...),复制粘贴代码以后忘记修改id了,导致出现了这个错误!

 

posted @ 2018-06-07 22:14  空芯菜  阅读(446)  评论(0编辑  收藏  举报