首页 > 技术文章 > 在MyBatis中,前台传数组批量传id处理数据方式

waves-a 2017-12-13 16:26 原文

<update id = "dishBatchSaleOrDown">
    <if test="ids != null">
         <if test="isDelete != null">
         update dishData set isDelete = #{isDelete} 
             where id IN 
          <foreach collection="ids" item="id" open="(" close="(" separator=",">
                #{ids}
         </foreach>
    </if>
         AND merchantId = #{merchantId}
</update>

 

推荐阅读