admin
2020-04-13 dd5b15229cb15459fa7c31ccea77dac28cbfafbd
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
<?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.taobao.TaoBaoBuyRelationMapMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.taobao.TaoBaoBuyRelationMap">
        <id column="tbr_id" property="id" jdbcType="BIGINT" />
        <result column="tbr_uid" property="uid" jdbcType="BIGINT" />
        <result column="tbr_relation_id" property="relationId"
            jdbcType="VARCHAR" />
        <result column="tbr_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">tbr_id,tbr_uid,tbr_relation_id,tbr_create_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_taobao_buy_relation where tbr_id = #{id,jdbcType=BIGINT}
    </select>
 
    <select id="listValidRelaionId" resultType="java.lang.String">
        SELECT
        t.`uiet_relation_id` FROM `yeshi_ec_user_info_extra_taobao` t LEFT
        JOIN `yeshi_ec_taobao_buy_relation` r ON
        t.`uiet_relation_id`=r.`tbr_relation_id` WHERE t.`uiet_relation_id` IS
        NOT NULL AND r.`tbr_id` IS NULL AND t.`uiet_uid`!=#{uid} AND
        t.`uiet_relation_valid`=1 LIMIT #{count}
    </select>
 
 
    <select id="selectByRelationId" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_taobao_buy_relation where tbr_relation_id = #{0}
    </select>
 
 
    <select id="selectByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_taobao_buy_relation where tbr_uid = #{0}
    </select>
 
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_buy_relation where tbr_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoBuyRelationMap"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_taobao_buy_relation
        (tbr_id,tbr_uid,tbr_relation_id,tbr_create_time) values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{relationId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoBuyRelationMap"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_taobao_buy_relation
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">tbr_id,</if>
            <if test="uid != null">tbr_uid,</if>
            <if test="relationId != null">tbr_relation_id,</if>
            <if test="createTime != null">tbr_create_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="relationId != null">#{relationId,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoBuyRelationMap">update
        yeshi_ec_taobao_buy_relation set tbr_uid =
        #{uid,jdbcType=BIGINT},tbr_relation_id =
        #{relationId,jdbcType=VARCHAR},tbr_create_time =
        #{createTime,jdbcType=TIMESTAMP} where tbr_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoBuyRelationMap">
        update yeshi_ec_taobao_buy_relation
        <set>
            <if test="uid != null">tbr_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="relationId != null">tbr_relation_id=#{relationId,jdbcType=VARCHAR},</if>
            <if test="createTime != null">tbr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where tbr_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>