mybatis之foreach标签与limit分页设置

  • Post author:
  • Post category:其他


<update id="deleteCartByMultiGoodsId" parameterType="java.util.HashMap">
   delete from ecs_cart where  user_id=#{userId}
    and  goods_id in  
    <foreach collection="goodsIdList" item="goodsIdList" index="index" open="(" separator="," close=")">  
         #{goodsIdList}  
      </foreach> 
</update>

错误的原因在于:

"你可以传递一个 List 实例或者数组作为参数对象传给 MyBatis。当你这么做的时候,
MyBatis 会自动将它包装在一个 Map 中,用名称在作为键。List 实例将会以“list” 作为键,
而数组实例将会以“array”作为键。"

参考自: https://blog.csdn.net/gufachongyang02/article/details/27186823 
#MyBatis limit分页设置
#正确的写法一:
<select id="queryMyApplicationRecord" parameterType="MyApplicationRequest" resultMap="myApplicationMap">
    SELECT
    a.*,
    FROM
    tb_user a
    WHERE