SknFlowMapper.xml 3.99 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.SknFlowMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.SknFlow" >
    <id column="product_skn" property="productSkn" jdbcType="INTEGER" />
    <result column="date_id" property="dateId" jdbcType="VARCHAR" />
    <result column="flow_type" property="flowType" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    product_skn, date_id, flow_type, create_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from skn_flow
    where product_skn = #{productSkn,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from skn_flow
    where product_skn = #{productSkn,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.search.dal.model.SknFlow" >
    insert into skn_flow (product_skn, date_id, flow_type, 
      create_time)
    values (#{productSkn,jdbcType=INTEGER}, #{dateId,jdbcType=VARCHAR}, #{flowType,jdbcType=INTEGER}, 
      #{createTime,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.yoho.search.dal.model.SknFlow" >
    insert into skn_flow
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="productSkn != null" >
        product_skn,
      </if>
      <if test="dateId != null" >
        date_id,
      </if>
      <if test="flowType != null" >
        flow_type,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="productSkn != null" >
        #{productSkn,jdbcType=INTEGER},
      </if>
      <if test="dateId != null" >
        #{dateId,jdbcType=VARCHAR},
      </if>
      <if test="flowType != null" >
        #{flowType,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.SknFlow" >
    update skn_flow
    <set >
      <if test="dateId != null" >
        date_id = #{dateId,jdbcType=VARCHAR},
      </if>
      <if test="flowType != null" >
        flow_type = #{flowType,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=INTEGER},
      </if>
    </set>
    where product_skn = #{productSkn,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.SknFlow" >
    update skn_flow
    set date_id = #{dateId,jdbcType=VARCHAR},
      flow_type = #{flowType,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=INTEGER}
    where product_skn = #{productSkn,jdbcType=INTEGER}
  </update>
    <select id="selectLatestDateId" resultType="java.lang.Integer">
        select max(date_id) from skn_flow
    </select>
    <select id="selectLatestDateBySkn" resultMap="BaseResultMap" timeout="20000">
        <![CDATA[
		select * from skn_flow s
		where
		date_id = #{dateId}
		and
		s.product_skn in
		]]>
        <foreach item="item" index="index" collection="sknList"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="selectSknByDate" resultType="java.lang.Long" timeout="20000">
        SELECT product_skn FROM skn_flow where date_id = #{dateId,jdbcType=VARCHAR} limit #{pageSize}
    </select>
    <delete id="deleteBatch">
        <![CDATA[
        DELETE FROM skn_flow
        WHERE
        date_id = #{dateId,jdbcType=VARCHAR}
        AND
        ]]>
        product_skn in
        <foreach item="item" index="index" collection="sknList" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
</mapper>