1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <update id="updateByListPrimaryKey" parameterType="java.util.List"> <foreach collection="productList" index="index" item="item" separator=";" > update mall_product <set> <if test="item.categoryId != null"> category_id = #{item.categoryId,jdbcType=INTEGER}, </if> <if test="item.name != null"> name = #{item.name,jdbcType=VARCHAR}, </if> <if test="item.subtitle != null"> subtitle = #{item.subtitle,jdbcType=VARCHAR}, </if> <if test="item.mainImage != null"> main_image = #{item.mainImage,jdbcType=VARCHAR}, </if> <if test="item.subImages != null"> sub_images = #{item.subImages,jdbcType=VARCHAR}, </if> <if test="item.detail != null"> detail = #{item.detail,jdbcType=VARCHAR}, </if> <if test="item.price != null"> price = #{item.price,jdbcType=DECIMAL}, </if> <if test="item.stock != null"> stock = #{item.stock,jdbcType=INTEGER}, </if> <if test="item.status != null"> status = #{item.status,jdbcType=INTEGER}, </if>
</set> where id = #{item.id,jdbcType=INTEGER} </foreach> </update>
|