PromotionProductMapper.xml 3.14 KB
<?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.yoho.search.dal.PromotionProductMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.PromotionProduct" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="promotion_id" property="promotionId" jdbcType="INTEGER" />
    <result column="product_skn" property="productSkn" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, promotion_id, product_skn
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from promotion_product
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectListBySkns" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from promotion_product
    where product_skn in
	<foreach item="item" index="index" collection="list"
			 open="(" separator="," close=")">
		#{item}
	</foreach>
  </select>
  <select id="selectListBySkn" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    select 
    <include refid="Base_Column_List" />
    from promotion_product
    where product_skn = #{skn,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from promotion_product
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.search.dal.model.PromotionProduct" >
    insert into promotion_product (id, promotion_id, product_skn
      )
    values (#{id,jdbcType=INTEGER}, #{promotionId,jdbcType=INTEGER}, #{productSkn,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.yoho.search.dal.model.PromotionProduct" >
    insert into promotion_product
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="promotionId != null" >
        promotion_id,
      </if>
      <if test="productSkn != null" >
        product_skn,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="promotionId != null" >
        #{promotionId,jdbcType=INTEGER},
      </if>
      <if test="productSkn != null" >
        #{productSkn,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.PromotionProduct" >
    update promotion_product
    <set >
      <if test="promotionId != null" >
        promotion_id = #{promotionId,jdbcType=INTEGER},
      </if>
      <if test="productSkn != null" >
        product_skn = #{productSkn,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.PromotionProduct" >
    update promotion_product
    set promotion_id = #{promotionId,jdbcType=INTEGER},
      product_skn = #{productSkn,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>