yujian
2019-01-22 88b54772dbcf5ecab1e2316e4e4626ac901b8908
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?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.yeshi.fanli.dao.mybatis.TaoBaoClassRelationMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation">
    <id column="tm_id" property="id" jdbcType="BIGINT"/>
    <result column="tm_system_cid" property="cid" jdbcType="BIGINT"/>
    <result column="tm_system_sub_cid" property="subId" jdbcType="BIGINT"/>
    <result column="tm_taobao_cid" property="taobaoCid" jdbcType="TIMESTAMP"/>
    <result column="tm_weight" property="weight" jdbcType="DOUBLE"/>
    <result column="tm_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="tm_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">tm_id,tm_system_cid,tm_system_sub_cid,tm_taobao_cid,tm_weight,tm_createtime,tm_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_taobao_class_mapper where tm_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_taobao_class_mapper where tm_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_class_mapper (tm_id,tm_system_cid,tm_system_sub_cid,tm_taobao_cid,tm_weight,tm_createtime,tm_updatetime) values (#{id,jdbcType=BIGINT},#{cid,jdbcType=BIGINT},#{subId,jdbcType=BIGINT},#{taobaoCid,jdbcType=BIGINT},#{weight,jdbcType=DOUBLE},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_class_mapper
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tm_id,</if>
      <if test="cid != null">tm_system_cid,</if>
      <if test="subId != null">tm_system_sub_cid,</if>
      <if test="taobaoCid != null">tm_taobao_cid,</if>
      <if test="weight != null">tm_weight,</if>
      <if test="createtime != null">tm_createtime,</if>
      <if test="updatetime != null">tm_updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="cid != null">#{cid,jdbcType=BIGINT},</if>
      <if test="subId != null">#{subId,jdbcType=BIGINT},</if>
      <if test="taobaoCid != null">#{taobaoCid,jdbcType=BIGINT},</if>
      <if test="weight != null">#{weight,jdbcType=DOUBLE},</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.bus.clazz.TaoBaoClassRelation">update yeshi_ec_taobao_class_mapper set tm_system_cid = #{cid,jdbcType=BIGINT},tm_system_sub_cid = #{subId,jdbcType=BIGINT},tm_taobao_cid = #{taobaoCid,jdbcType=BIGINT},tm_weight = #{weight,jdbcType=DOUBLE},tm_createtime = #{createtime,jdbcType=TIMESTAMP},tm_updatetime = #{updatetime,jdbcType=TIMESTAMP} where tm_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation">update yeshi_ec_taobao_class_mapper
    <set>
      <if test="cid != null">tm_system_cid=#{cid,jdbcType=BIGINT},</if>
      <if test="subId != null">tm_system_sub_cid=#{subId,jdbcType=BIGINT},</if>
      <if test="taobaoCid != null">tm_taobao_cid=#{taobaoCid,jdbcType=BIGINT},</if>
      <if test="weight != null">tm_weight=#{weight,jdbcType=DOUBLE},</if>
      <if test="createtime != null">tm_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updatetime != null">tm_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
    </set> where tm_id = #{id,jdbcType=BIGINT}
  </update>
  
   <select id="listByTaoBaoCid" resultMap="BaseResultMap" parameterType="java.lang.Long">
         SELECT <include refid="Base_Column_List"/> FROM `yeshi_ec_taobao_class_mapper` tm 
         LEFT JOIN `yeshi_ec_taobao_class` tc ON tc.`tc_id` = tm.`tm_taobao_cid` 
         WHERE tc.`tc_category_id`= #{taobaoCid,jdbcType=BIGINT}  ORDER BY tm.`tm_weight` DESC LIMIT 0,10
  </select>
  
</mapper>