yujian
2019-08-27 d8359ddb48dab5cc797a9d552e11fde571f4920c
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?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.user.UserInfoExtraMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
    <id column="uie_id" property="id" jdbcType="BIGINT"/>
    <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/>
    <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/>
    <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
    <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/>
    <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/>
    <result column="uie_synch_navbar" property="synchNavbar" jdbcType="VARCHAR"/>
    <result column="uie_first_login_time" property="firstLoginTime" jdbcType="TIMESTAMP"/>
    <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_sex" property="sex" jdbcType="INTEGER"/>
    <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR"/>
    <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
    
    <association property="userInfo" column="uie_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
        <id column="uie_uid" property="id" jdbcType="BIGINT" />
    </association>
    
      <association property="userRank" column="uie_rank_id" javaType="com.yeshi.fanli.entity.bus.user.UserRank">
        <id column="uie_rank_id" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  
   <resultMap id="VOResultMap" type="com.yeshi.fanli.vo.user.UserInfoExtraVO">
    <id column="uie_id" property="id" jdbcType="BIGINT"/>
    <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/>
    <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/>
    <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
    <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/>
    <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/>
    <result column="uie_synch_navbar" property="synchNavbar" jdbcType="VARCHAR"/>
    <result column="uie_first_login_time" property="firstLoginTime" jdbcType="TIMESTAMP"/>
    <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_sex" property="sex" jdbcType="INTEGER"/>
    <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR"/>
    <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
    
    <association property="userInfo" column="uie_uid" 
        resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/>
    
      <association property="userRank" column="uie_rank_id" 
          resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap"/>
          
  </resultMap>
  
  <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
  <id column="uie_id" property="id" jdbcType="BIGINT"/>
    <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/>
    <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/>
    <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
    <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/>
    <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/>
    <result column="uie_synch_navbar" property="synchNavbar" jdbcType="VARCHAR"/>
    <result column="uie_first_login_time" property="firstLoginTime" jdbcType="TIMESTAMP"/>
    <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_sex" property="sex" jdbcType="INTEGER"/>
    <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR"/>
    <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
    
    <association property="userInfo" column="uie_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
        <id column="uie_uid" property="id" jdbcType="BIGINT" />
    </association>
    
    <association property="userRank" column="uie_rank_id" 
         resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap"/>
  </resultMap>
  
  
  
  <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time</sql>
 
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}
  </select>
  
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}</delete>
  
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">uie_id,</if>
      <if test="userInfo != null">uie_uid,</if>
      <if test="userRank != null">uie_rank_id,</if>
      <if test="rankSource != null">uie_rank_source,</if>
      <if test="rankOrderNum != null">uie_rank_order_num,</if>
      <if test="rankUpdateTime != null">uie_rank_update_time,</if>
      <if test="inviteCode != null">uie_invite_code,</if>
      <if test="lotteryNewbies != null">uie_lottery_newbies,</if>
      <if test="couponNews != null">uie_coupon_news,</if>
      <if test="synchNavbar != null">uie_synch_navbar,</if>
      <if test="firstLoginTime != null">uie_first_login_time,</if>
      <if test="sex != null">uie_sex,</if>
      <if test="weiXin != null">uie_weixin,</if>
      <if test="goldCoin != null">uie_gold_coin,</if>
      <if test="createTime != null">uie_create_time,</if>
      <if test="updateTime != null">uie_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
      <if test="userRank != null">#{userRank.id,jdbcType=BIGINT},</if>
      <if test="rankSource != null">#{rankSource,jdbcType=INTEGER},</if>
      <if test="rankOrderNum != null">#{rankOrderNum,jdbcType=INTEGER},</if>
      <if test="rankUpdateTime != null">#{rankUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="inviteCode != null">#{inviteCode,jdbcType=VARCHAR},</if>
      <if test="lotteryNewbies != null">#{lotteryNewbies,jdbcType=INTEGER},</if>
      <if test="couponNews != null">#{couponNews,jdbcType=INTEGER},</if>
      <if test="synchNavbar != null">#{synchNavbar,jdbcType=VARCHAR},</if>
      <if test="firstLoginTime != null">#{firstLoginTime,jdbcType=TIMESTAMP},</if>
      <if test="sex != null">#{sex,jdbcType=INTEGER},</if>
      <if test="weiXin != null">#{weiXin,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">#{goldCoin,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.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code = #{inviteCode,jdbcType=VARCHAR},uie_lottery_newbies = #{lotteryNewbies,jdbcType=INTEGER},uie_coupon_news = #{couponNews,jdbcType=INTEGER},uie_synch_navbar = #{synchNavbar,jdbcType=VARCHAR},uie_first_login_time = #{firstLoginTime,jdbcType=TIMESTAMP},uie_sex = #{sex,jdbcType=INTEGER},uie_weixin = #{weiXin,jdbcType=VARCHAR},uie_gold_coin = #{goldCoin,jdbcType=INTEGER},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra
    <set>
      <if test="userInfo != null">uie_uid=#{userInfo.id,jdbcType=BIGINT},</if>
      <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if>
      <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if>
      <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if>
      <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if>
      <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if>
      <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
      <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
      <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},</if>
      <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
      <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
      <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uie_id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateInfoExtraByUid" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
      update yeshi_ec_user_info_extra
    <set>
      <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if>
      <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if>
      <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if>
      <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if>
      <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if>
      <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
      <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
      <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},</if>
      <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
      <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
      <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uie_uid = #{userInfo.id,jdbcType=BIGINT}
  </update>
    
  
   <select id="getInfoExtraByUid" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_user_info_extra
        WHERE uie_uid = #{uid}
   </select>
   
   <select id="getInfoExtraVOByUid" resultMap="VOResultMap">
        SELECT u.`id`,u.`nick_name`,u.`portrait`,ue.*,rk.*
        FROM yeshi_ec_user_info_extra ue
        LEFT JOIN yeshi_ec_user u ON ue.`uie_uid` = u.`id` 
        LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = ue.`uie_rank_id`
        WHERE u.id = #{uid}
   </select>
   
   <select id="countByRankId" parameterType="java.lang.Long" resultType="java.lang.Long" >
        SELECT IFNULL(COUNT(t.`uie_id`),0)  FROM `yeshi_ec_user_info_extra` t 
        WHERE  t.`uie_rank_id` = #{rankId}
   </select>
    
   <select id="gerUserRank" resultMap="AllResultMap">
        SELECT * FROM yeshi_ec_user_info_extra ue
        LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = ue.`uie_rank_id`
        WHERE ue.`uie_uid` = #{uid}
   </select>
</mapper>