Helius
2021-06-16 4e51778362c2130598a4c73ec4cebe6629dbc53f
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
<?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.xzx.gc.user.mapper.AccountLogMapper">
 
    <select id="queryAccountLogByAccount" resultType="com.xzx.gc.model.admin.AccountLogModel">
        select
        IFNULL(c.name, n.nick_name) as userName,
        a.*,
        IFNULL(c.mobile_phone, n.mobile_phone) as mobilePhone,
        IFNULL(c.user_type, '1') as userType
        from xzx_account_log a
        left join xzx_account_info d on a.account_id = d.account_id
        left join (select
        k.name,
        k.mobile_phone,
        k.user_type,
        k.user_id,
        k.partner_id
        from xzx_user_other_info k
        where k.del_flag = 0) c on a.create_user_id = c.user_id
        left join (select
        m.mobile_phone,
        m.nick_name,
        m.user_id
        from xzx_user_info m
        where m.del_flag = 0) n on a.create_user_id = n.user_id
        where d.del_flag = 0
 
        <if test="startTime != null and startTime != ''">
            and a.create_time >= #{startTime}
        </if>
        <if test="endTime != null and endTime != ''">
            and a.create_time &lt;= #{endTime}
        </if>
 
        <if test="type != null and type != ''">
            and a.type=#{type}
        </if>
 
        <if test="userName != null and userName != ''">
            and (c.name like concat("%",#{userName} ,"%") or c.mobile_phone like concat("%",#{userName},"%") or
            n.mobile_phone like concat("%",#{userName},"%"))
        </if>
 
 
        <if test="typeList != null and typeList.size() != 0">
            and a.channel_type in
            <foreach collection="typeList" index="index" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </if>
 
        <if test="channelType != null and channelType != ''">
            and a.channel_type=#{channelType}
        </if>
 
        <if test="accountId != null and accountId != ''">
            and a.account_id=#{accountId}
        </if>
 
        <if test=" partnerIds != null and partnerIds.size() != 0">
            and c.partner_id in
            <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </if>
        order by a.create_time desc
    </select>
</mapper>