|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
2
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
3
|
+<mapper namespace="com.bjtdba.userCenter.dao.UserDao">
|
|
|
4
|
+
|
|
|
5
|
+ <!-- 使用 autoMapping 自动映射未显式声明的字段 -->
|
|
|
6
|
+ <resultMap id="userResultMap" type="com.bjtdba.userCenter.entity.UserEntity" autoMapping="true">
|
|
|
7
|
+ <id column="uid" property="uid" />
|
|
|
8
|
+ <!-- 显式声明需要下划线转驼峰的字段 -->
|
|
|
9
|
+ <result column="real_name" property="realName" />
|
|
|
10
|
+ <result column="spread_uid" property="spreadUid" />
|
|
|
11
|
+ <result column="brokerage_price" property="brokeragePrice" />
|
|
|
12
|
+ <result column="repurchase_price" property="repurchasePrice" />
|
|
|
13
|
+ <result column="create_time" property="createTime" />
|
|
|
14
|
+ <result column="external_id" property="externalId" />
|
|
|
15
|
+ <result column="level_id" property="levelId" />
|
|
|
16
|
+ <result column="user_group" property="userGroup" />
|
|
|
17
|
+ </resultMap>
|
|
|
18
|
+
|
|
|
19
|
+ <sql id="baseColumn">
|
|
|
20
|
+ uid, account, real_name, nickname, spread_uid, avatar, phone, score,
|
|
|
21
|
+ brokerage_price, repurchase_price, status, create_time, external, external_id,
|
|
|
22
|
+ level_id, user_group, contribute, jingdou, vr, pv
|
|
|
23
|
+ </sql>
|
|
|
24
|
+
|
|
|
25
|
+ <sql id="queryCondition">
|
|
|
26
|
+ <where>
|
|
|
27
|
+ is_del = 0
|
|
|
28
|
+ <if test="account != null and account != ''">
|
|
|
29
|
+ AND account = #{account}
|
|
|
30
|
+ </if>
|
|
|
31
|
+ <if test="nickname != null and nickname != ''">
|
|
|
32
|
+ AND nickname LIKE CONCAT('%', #{nickname}, '%')
|
|
|
33
|
+ </if>
|
|
|
34
|
+ <if test="uid != null">
|
|
|
35
|
+ AND uid = #{uid}
|
|
|
36
|
+ </if>
|
|
|
37
|
+ <if test="status != null">
|
|
|
38
|
+ AND status = #{status}
|
|
|
39
|
+ </if>
|
|
|
40
|
+ </where>
|
|
|
41
|
+ </sql>
|
|
|
42
|
+
|
|
|
43
|
+ <!-- 关键修改:使用 resultMap 而不是 resultType -->
|
|
|
44
|
+ <select id="getUserList" resultMap="userResultMap">
|
|
|
45
|
+ SELECT <include refid="baseColumn"/>
|
|
|
46
|
+ FROM rrx_user
|
|
|
47
|
+ <include refid="queryCondition"/>
|
|
|
48
|
+ ORDER BY create_time DESC
|
|
|
49
|
+ LIMIT #{offset}, #{pageSize}
|
|
|
50
|
+ </select>
|
|
|
51
|
+
|
|
|
52
|
+ <select id="getUserListCount" resultType="long">
|
|
|
53
|
+ SELECT COUNT(uid)
|
|
|
54
|
+ FROM rrx_user
|
|
|
55
|
+ <include refid="queryCondition"/>
|
|
|
56
|
+ </select>
|
|
|
57
|
+</mapper>
|