yujian
2019-04-26 553e4585a5ec8e2c22b50e33a27d14ead6fd034d
fanli/src/main/java/com/yeshi/fanli/mapping/brand/TaoBaoShopHistoryMapper.xml
@@ -6,24 +6,26 @@
    <id column="tsh_id" property="id" jdbcType="BIGINT"/>
    <result column="tsh_uid" property="uid" jdbcType="BIGINT"/>
    <result column="tsh_device" property="device" jdbcType="VARCHAR"/>
    <result column="tsh_state" property="state" jdbcType="INTEGER"/>
    <result column="tsh_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="tsh_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="tsh_shop_id" property="taoBaoShop" 
       resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper.BaseResultMap">
    </association>
  </resultMap>
  <sql id="Base_Column_List">tsh_id,tsh_shop_id,tsh_uid,tsh_device,tsh_create_time,tsh_update_time</sql>
  <sql id="Base_Column_List">tsh_id,tsh_shop_id,tsh_uid,tsh_device,tsh_state,tsh_create_time,tsh_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_taobao_shop_history where tsh_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_taobao_shop_history where tsh_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_shop_history (tsh_id,tsh_shop_id,tsh_uid,tsh_device,tsh_create_time,tsh_update_time) values (#{id,jdbcType=BIGINT},#{taoBaoShop.id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_shop_history (tsh_id,tsh_shop_id,tsh_uid,tsh_device,tsh_state,tsh_create_time,tsh_update_time) values (#{id,jdbcType=BIGINT},#{taoBaoShop.id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_shop_history
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tsh_id,</if>
      <if test="taoBaoShop != null">tsh_shop_id,</if>
      <if test="uid != null">tsh_uid,</if>
      <if test="device != null">tsh_device,</if>
      <if test="state != null">tsh_state,</if>
      <if test="createTime != null">tsh_create_time,</if>
      <if test="updateTime != null">tsh_update_time,</if>
    </trim>values
@@ -32,30 +34,32 @@
      <if test="taoBaoShop != null">#{taoBaoShop.id,jdbcType=BIGINT},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="device != null">#{device,jdbcType=VARCHAR},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory">update yeshi_ec_taobao_shop_history set tsh_shop_id = #{taoBaoShop.id,jdbcType=BIGINT},tsh_uid = #{uid,jdbcType=BIGINT},tsh_device = #{device,jdbcType=VARCHAR},tsh_create_time = #{createTime,jdbcType=TIMESTAMP},tsh_update_time = #{updateTime,jdbcType=TIMESTAMP} where tsh_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory">update yeshi_ec_taobao_shop_history set tsh_shop_id = #{taoBaoShop.id,jdbcType=BIGINT},tsh_uid = #{uid,jdbcType=BIGINT},tsh_device = #{device,jdbcType=VARCHAR},tsh_state = #{state,jdbcType=INTEGER},tsh_create_time = #{createTime,jdbcType=TIMESTAMP},tsh_update_time = #{updateTime,jdbcType=TIMESTAMP} where tsh_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory">update yeshi_ec_taobao_shop_history
    <set>
      <if test="taoBaoShop != null">tsh_shop_id=#{taoBaoShop.id,jdbcType=BIGINT},</if>
      <if test="uid != null">tsh_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="device != null">tsh_device=#{device,jdbcType=VARCHAR},</if>
      <if test="state != null">tsh_state=#{state,jdbcType=VARCHAR},</if>
      <if test="createTime != null">tsh_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">tsh_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where tsh_id = #{id,jdbcType=BIGINT}
  </update>
  
  <delete id="deleteByUid">
       delete from yeshi_ec_taobao_shop_history
  <update id="updateByUid">
       update yeshi_ec_taobao_shop_history set tsh_state = 1
       where  tsh_uid = #{uid} AND tsh_shop_id = #{shopId}
  </delete>
  </update>
    
  <delete id="deleteByDevice">
       delete from yeshi_ec_taobao_shop_history
  <update id="updateByDevice">
       update yeshi_ec_taobao_shop_history set tsh_state = 1
       where  tsh_device = #{device} AND tsh_shop_id = #{shopId}
  </delete>
  </update>
  
  
  <select id="getByUid" resultMap="BaseResultMap">
@@ -73,32 +77,32 @@
  <select id="listByUid" resultMap="BaseResultMap">
     SELECT * FROM yeshi_ec_taobao_shop_history h 
   LEFT JOIN `yeshi_ec_taobao_shop_info` p ON h.`tsh_shop_id` = p.`tsi_id`
   WHERE h.tsh_uid = #{uid}
   WHERE h.tsh_uid = #{uid} AND tsh_state = 0
   ORDER BY  h.tsh_update_time DESC
   LIMIT ${start},${count}
  </select>
  
  <select id="countByUid" resultType="Long">
     SELECT IFNULL(COUNT(tsh_id),0) FROM yeshi_ec_taobao_shop_history 
   WHERE tsh_uid = #{uid}
   WHERE tsh_uid = #{uid} AND tsh_state = 0
  </select>
  
   <select id="listByDevice" resultMap="BaseResultMap">
     SELECT * FROM yeshi_ec_taobao_shop_history h
     LEFT JOIN `yeshi_ec_taobao_shop_info` p ON h.`tsh_shop_id` = p.`tsi_id`
   WHERE h.tsh_device = #{device}
   WHERE h.tsh_device = #{device} AND tsh_state = 0
   ORDER BY h.tsh_update_time DESC
   LIMIT ${start},${count}
  </select>
  
   <select id="countByDevice" resultType="Long">
     SELECT IFNULL(COUNT(tsh_id),0) FROM yeshi_ec_taobao_shop_history 
   WHERE tsh_device = #{device}
   WHERE tsh_device = #{device} AND tsh_state = 0
  </select>
  
  <select id="countByShopId" resultType="Long">
     SELECT IFNULL(COUNT(tsh_id),0) FROM `yeshi_ec_taobao_shop_history`
   WHERE tsh_shop_id = #{shopId}
   WHERE tsh_shop_id = #{shopId}
  </select>
  
</mapper>