admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?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>
    
    <delete id="deleteBySubId" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_class_mapper where tm_system_sub_cid = #{0}
    </delete>
    
    <delete id="deleteByCid" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_class_mapper where tm_system_cid = #{0}
    </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>
 
    <select id="getByLocalCid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        SELECT
        <include refid="Base_Column_List" />
        FROM `yeshi_ec_taobao_class_mapper`
        WHERE tm_taobao_cid = #{localCid,jdbcType=BIGINT}
        LIMIT 1
    </select>
 
    <delete id="deleteRelationByLocalCid" parameterType="java.lang.Long">
        delete from yeshi_ec_taobao_class_mapper
        where tm_taobao_cid = #{localCid,jdbcType=BIGINT}
    </delete>
 
 
    <select id="getClassIdByTaoBaoCid" parameterType="java.lang.Long" resultType="java.lang.Long">
        SELECT    tm.tm_system_cid 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} 
        LIMIT 1
     </select>
 
</mapper>