zoukankan      html  css  js  c++  java
  • 批量

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
    <mapper namespace="com.project714.dao.ImageManageDao">
    <resultMap id="BaseResultMap" type="com.project714.dto.ProductImageUrlDTO">
    <!-- WARNING - @mbg.generated This element is automatically generated by
    MyBatis Generator, do not modify. This element was generated on Mon May 22
    15:25:15 CST 2017. -->
    <result column="product_id" jdbcType="INTEGER" property="productID" />
    <result column="product_color" jdbcType="VARCHAR" property="color" />
    <result column="product_color_url" jdbcType="VARCHAR" property="imageUrl" />
    </resultMap>
    <sql id="Base_Column_List">
    product_id,product_color,product_color_url
    </sql>
    <insert id="saveImageUrl" parameterType="com.project714.dto.ProductImageUrlDTO">
    insert into `t_product_color_img_mapping`
    <trim>
    <if test="productID != null">
    product_id,
    </if>
    <if test="color != null">
    product_color,
    </if>
    <if test="imageUrl != null">
    product_color_url,
    </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
    <if test="productID != null">
    #{productID,jdbcType=Integer},
    </if>
    <if test="color != null">
    #{color,jdbcType=VERCHAR},
    </if>
    <if test="imageUrl != null">
    #{imageUrl,jdbcType=VERCHAR},
    </if>
    </trim>
    </insert>

    <select id="queryImageUrl" resultMap="BaseResultMap"
    parameterType="java.lang.String">
    select
    <include refid="Base_Column_List" />
    from t_product_color_img_mapping t
    where t.product_id=#{productID}
    </select>
    <update id="updateImageUrl" parameterType="com.project714.dto.ProductImageUrlDTO">
    update t_product_color_img_mapping
    <set>
    <if test="color != null">
    product_color = #{color,jdbcType=VERCHAR},
    </if>
    <if test="imageUrl != null">
    product_color_url = #{imageUrl,jdbcType=VERCHAR},
    </if>
    </set>
    where
    product_id=#{productID,jdbcType=INTEGER}
    </update>

    <update id="updateImageUrlList" parameterType="java.util.List">
    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
    update t_product_color_img_mapping
    <set>
    <if test="item.color != null">
    product_color = #{item.color,jdbcType=VERCHAR},
    </if>
    <if test="item.imageUrl != null">
    product_color_url = #{item.imageUrl,jdbcType=VERCHAR},
    </if>
    </set>
    where
    product_id=#{item.productID,jdbcType=INTEGER}
    </foreach>
    </update>
    <delete id="deleteImage" parameterType="java.lang.String">
    delete from t_product_color_img_mapping t where
    product_id=#{productID,jdbcType=INTEGER}
    </delete>
    <insert id="saveImageUrlByList" parameterType="java.util.List">
    insert into
    t_product_color_img_mapping(product_id,product_color,img_url)values
    <foreach collection="list" item="item" index="index"
    separator=",">
    (#{item.productID,jdbcType=VARCHAR},#{item.color,jdbcType=VARCHAR},#{item.imageUrl,jdbcType=VARCHAR})
    </foreach>
    </insert>
    </mapper>

  • 相关阅读:
    Windows Server2016环境中安装Oracle12c数据库
    centos7 安装Oracle19C 数据库
    centos7 磁盘分区以及磁盘挂载
    PHP日常开发技巧散记
    代码压缩工具 webpack安装与入门使用【初级】
    程序员修炼之道系列 | 使用曳光弹找到目标
    程序员修炼之道系列 | 不要冲出前灯范围
    程序员修炼之道系列 | 敏捷估算
    程序员修炼之道系列 | “豆腐渣“工程竟然也能做原型
    官宣!禅道与极狐(GitLab)达成深度合作,携手推进开源开放DevOps生态
  • 原文地址:https://www.cnblogs.com/panxuejun/p/7501101.html
Copyright © 2011-2022 走看看