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
90
91
92
93
94
95
96
97
98
99
<?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.TaoBaoUnionAuthRecordMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord">
        <id column="tuar_id" property="id" jdbcType="BIGINT" />
        <result column="tuar_taobao_user_nick" property="taoBaoUserNick"
            jdbcType="VARCHAR" />
        <result column="tuar_taobao_open_uid" property="taoBaoOpenUid"
            jdbcType="VARCHAR" />
        <result column="tuar_taobao_user_id" property="taoBaoUserId"
            jdbcType="VARCHAR" />
        <result column="tuar_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="tuar_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
 
        <association property="user" column="tuar_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="tuar_uid" property="id" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">tuar_id,tuar_uid,tuar_taobao_user_nick,tuar_taobao_open_uid,tuar_taobao_user_id,tuar_create_time,tuar_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_taobao_union_auth_record where tuar_id =
        #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_union_auth_record where tuar_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_taobao_union_auth_record
        (tuar_id,tuar_uid,tuar_taobao_user_nick,tuar_taobao_open_uid,tuar_taobao_user_id,tuar_create_time,tuar_update_time)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{taoBaoUserNick,jdbcType=VARCHAR},#{taoBaoOpenUid,jdbcType=VARCHAR},#{taoBaoUserId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_taobao_union_auth_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">tuar_id,</if>
            <if test="user != null">tuar_uid,</if>
            <if test="taoBaoUserNick != null">tuar_taobao_user_nick,</if>
            <if test="taoBaoOpenUid != null">tuar_taobao_open_uid,</if>
            <if test="taoBaoUserId != null">tuar_taobao_user_id,</if>
            <if test="createTime != null">tuar_create_time,</if>
            <if test="updateTime != null">tuar_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="taoBaoUserNick != null">#{taoBaoUserNick,jdbcType=VARCHAR},</if>
            <if test="taoBaoOpenUid != null">#{taoBaoOpenUid,jdbcType=VARCHAR},</if>
            <if test="taoBaoUserId != null">#{taoBaoUserId,jdbcType=VARCHAR},</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.taobao.TaoBaoUnionAuthRecord">update
        yeshi_ec_taobao_union_auth_record set tuar_uid =
        #{user.id,jdbcType=BIGINT},tuar_taobao_user_nick =
        #{taoBaoUserNick,jdbcType=VARCHAR},tuar_taobao_open_uid =
        #{taoBaoOpenUid,jdbcType=VARCHAR},tuar_taobao_user_id =
        #{taoBaoUserId,jdbcType=VARCHAR},tuar_create_time =
        #{createTime,jdbcType=TIMESTAMP},tuar_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where tuar_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord">
        update yeshi_ec_taobao_union_auth_record
        <set>
            <if test="user != null">tuar_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="taoBaoUserNick != null">tuar_taobao_user_nick=#{taoBaoUserNick,jdbcType=VARCHAR},
            </if>
            <if test="taoBaoOpenUid != null">tuar_taobao_open_uid=#{taoBaoOpenUid,jdbcType=VARCHAR},
            </if>
            <if test="taoBaoUserId != null">tuar_taobao_user_id=#{taoBaoUserId,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">tuar_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">tuar_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where tuar_id = #{id,jdbcType=BIGINT}
    </update>
    
    
    <select id="getTaoBaoUserNick" resultType="java.lang.String">
        SELECT u.`tuar_taobao_user_nick` FROM `yeshi_ec_taobao_union_auth_record` u 
        WHERE u.`tuar_uid` = #{uid}
        ORDER BY u.`tuar_create_time` DESC
        LIMIT 1
    </select>
</mapper>