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
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
<?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_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    
    <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_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    
    <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>
  
  <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_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_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},#{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="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="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_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="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="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>
    
 
</mapper>