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>

  • 相关阅读:
    (转)Epoll模型详解
    (转)彻底学会使用epoll(一)——ET模式实现分析
    (转)Linux内核 TCP/IP、Socket参数调优
    Nodejs RESTFul架构实践之api篇(转)
    创业笔记-Node.js入门之阻塞与非阻塞
    创业笔记-Node.js入门之基于事件驱动的回调
    创业笔记-Node.js入门之一个完整的基于Node.js的web应用
    创业笔记-Node.js入门之JavaScript与Node.js
    在CentOS6.5下配置安装LVS
    zend studio 添加xdebug调试php代码
  • 原文地址:https://www.cnblogs.com/panxuejun/p/7501101.html
Copyright © 2011-2022 走看看