“mitao”
2025-12-23 ae80fa80a5131f4dd9c04d82b07da8fe3c607f1e
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
<?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.ruoyi.system.mapper.TAppUserMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TAppUser">
        <id column="id" property="id" />
        <result column="nick_name" property="nickName" />
        <result column="avatar" property="avatar" />
        <result column="phone_number" property="phoneNumber" />
        <result column="gender" property="gender" />
        <result column="birth_date" property="birthDate" />
        <result column="status" property="status" />
        <result column="open_id" property="openId" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="create_by" property="createBy" />
        <result column="update_by" property="updateBy" />
        <result column="disabled" property="disabled" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, nick_name, avatar, phone_number, gender, birth_date, status, open_id, create_time, update_time, create_by, update_by, disabled
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.model.TAppUser">
        select t1.* from t_app_user t1
        where    t1.status != 3
        <if test="query.nickName != null and query.nickName != ''">
            and t1.name like concat('%',#{query.nickName},'%')
        </if>
 
        <if test="query.phoneNumber != null and query.phoneNumber != ''">
            and t1.phone like concat('%',#{query.phoneNumber},'%')
        </if>
        <if test="query.status != null">
            and t1.status = #{query.status}
        </if>
        <if test="query.promotionStatus != null">
            and t1.promotion_status =1
        </if>
 
        order by t1.create_time desc
    </select>
 
 
    <select id="promotionPageList" resultType="com.ruoyi.system.vo.PromotionPageListVo">
        select t1.id userId,t1.name userName,t1.phone phone,t1.profile_photo avatar,t1.user_type roleName,t1.status status,
 
        t2.id lastUserId,t2.name lastUserName,t2.phone lastPhone,t2.profile_photo lastAvatar,t2.user_type lastRoleName
        from t_app_user t1
        left join t_app_user t2 on t1.referrer_user_id =t2.id
        where t1.company_id = #{query.companyId} and t1.status !=3
        <if test="query.userName != null and query.userName != ''">
            and t1.name like concat('%',#{query.userName},'%')
        </if>
        <if test="query.phone != null and query.phone != ''">
            and t1.phone like concat('%',#{query.phone},'%')
        </if>
        <if test="query.lastUserName != null and query.lastUserName != ''">
            and t2.name like concat('%',#{query.lastUserName},'%')
        </if>
        <if test="query.lastPhone != null and query.lastPhone != ''">
            and t2.phone like concat('%',#{query.lastPhone},'%')
        </if>
        order by t1.create_time desc
    </select>
    <select id="promotionPageListExport" resultType="com.ruoyi.system.vo.PromotionPageListVo">
        select t1.id userId,t1.name userName,t1.phone phone,t1.profile_photo avatar,t1.user_type roleName,t1.status status,
 
        t2.id lastUserId,t2.name lastUserName,t2.phone lastPhone,t2.profile_photo lastAvatar,t2.user_type lastRoleName
        from t_app_user t1
        left join t_app_user t2 on t1.referrer_user_id =t2.id
        where t1.company_id = #{query.companyId} and t1.status !=3
        <if test="query.userName != null and query.userName != ''">
            and t1.name like concat('%',#{query.userName},'%')
        </if>
        <if test="query.phone != null and query.phone != ''">
            and t1.phone like concat('%',#{query.phone},'%')
        </if>
        <if test="query.lastUserName != null and query.lastUserName != ''">
            and t2.name like concat('%',#{query.lastUserName},'%')
        </if>
        <if test="query.lastPhone != null and query.lastPhone != ''">
            and t2.phone like concat('%',#{query.lastPhone},'%')
        </if>
        order by t1.create_time desc
    </select>
    <select id="exportAppUser" resultType="com.ruoyi.system.model.TAppUser">
        select t1.* from t_app_user t1
        where    t1.status != 3
        <if test="query.nickName != null and query.nickName != ''">
            and t1.name like concat('%',#{query.nickName},'%')
        </if>
 
        <if test="query.phoneNumber != null and query.phoneNumber != ''">
            and t1.phone like concat('%',#{query.phoneNumber},'%')
        </if>
        <if test="query.status != null">
            and t1.status = #{query.status}
        </if>
 
        order by t1.create_time desc
    </select>
    <select id="transferPageUserList" resultType="com.ruoyi.system.model.TAppUser">
        select t1.* from t_app_user t1
        where    t1.status != 3
        <if test="query.nickName != null and query.nickName != ''">
            and t1.name like concat('%',#{query.nickName},'%')
        </if>
 
        <if test="query.phoneNumber != null and query.phoneNumber != ''">
            and( t1.phone like concat('%',#{query.phoneNumber},'%') or t1.code like concat('%',#{query.phoneNumber},'%') )
        </if>
        <if test="query.status != null">
            and t1.status = #{query.status}
        </if>
 
        order by t1.create_time desc
    </select>
 
    <select id="userPromotionPageList" resultType="com.ruoyi.system.vo.UserPromotionPageListVo">
        select t1.id userId,t1.name userName,t1.phone phone,t1.gender,t1.profile_photo avatar,t1.user_type roleName,t1.status status
        from t_app_user t1
        where t1.referrer_user_id = #{query.userId} and t1.status !=3 and  t1.referrer_status =2
        <if test="query.userName != null and query.userName != ''">
            and t1.name like concat('%',#{query.userName},'%')
        </if>
        <if test="query.phone != null and query.phone != ''">
            and t1.phone like concat('%',#{query.phone},'%')
        </if>
        order by t1.create_time desc
    </select>
    <select id="userPromotionPageListExport" resultType="com.ruoyi.system.vo.UserPromotionPageListVo">
        select t1.id userId,t1.name userName,t1.phone phone,t1.gender,t1.profile_photo avatar,t1.user_type roleName,t1.status status
        from t_app_user t1
        where t1.referrer_user_id = #{query.userId} and t1.status !=3 and  t1.referrer_status =2
        <if test="query.userName != null and query.userName != ''">
            and t1.name like concat('%',#{query.userName},'%')
        </if>
        <if test="query.phone != null and query.phone != ''">
            and t1.phone like concat('%',#{query.phone},'%')
        </if>
        order by t1.create_time desc
    </select>
 
</mapper>