puzhibing
2023-10-08 22199bbdda579861736420fe26c2873ab0f5d21c
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
<?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.sinata.shop.modular.member.dao.MemUserMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.sinata.shop.modular.member.model.MemUser">
        <id column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="show_id" property="showId" />
        <result column="phone" property="phone" />
        <result column="nick_name" property="nickName" />
        <result column="password" property="password" />
        <result column="avatar" property="avatar" />
        <result column="is_lock" property="isLock" />
        <result column="is_delete" property="isDelete" />
        <result column="apply_time" property="applyTime" />
        <result column="audit_state" property="auditState" />
        <result column="audit_time" property="auditTime" />
        <result column="is_leave_office" property="isLeaveOffice" />
        <result column="leave_office_time" property="leaveOfficeTime" />
        <result column="card_type" property="cardType" />
        <result column="real_name" property="realName" />
        <result column="id_card" property="idCard" />
        <result column="city_code" property="cityCode" />
        <result column="member_grade_id" property="memberGradeId" />
        <result column="sex" property="sex" />
        <result column="birthday" property="birthday" />
        <result column="signature" property="signature" />
        <result column="address" property="address" />
        <result column="check_time" property="checkTime" />
        <result column="check_num" property="checkNum" />
        <result column="integral" property="integral" />
        <result column="balance" property="balance" />
        <result column="balance_freeze" property="balanceFreeze" />
        <result column="credit_score" property="creditScore" />
        <result column="bank_name" property="bankName" />
        <result column="bank_open" property="bankOpen" />
        <result column="bank_number" property="bankNumber" />
        <result column="id_card_front_image" property="idCardFrontImage" />
        <result column="id_card_back_image" property="idCardBackImage" />
        <result column="sign_image" property="signImage" />
        <result column="equity_user_id" property="equityUserId" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, create_time, show_id, phone, nick_name, password, avatar, is_lock, is_delete, is_leave_office, leave_office_time, real_name, id_card, city_code, member_grade_id, sex, birthday, signature, address, check_time, check_num,
        apply_time, audit_state, audit_time, card_type, integral, balance, balance_freeze, credit_score, bank_name, bank_open, bank_number, id_card_front_image, id_card_back_image, sign_image, equity_user_id
    </sql>
 
    <select id="getListPage" resultType="java.util.Map">
        SELECT
            o.id, o.create_time, o.show_id, o.nick_name, o.phone, o.avatar, o.id_card, o.sex, o.birthday, o.city_code, o.member_grade_id,
            IFNULL(SUM(goods_money),0) orderMoney
        FROM
            mem_user o
            LEFT JOIN mall_order mo ON mo.user_id = o.id
        <where>
            AND member_grade_id <![CDATA[ <= ]]> 2
            <if test="beginTime != null and beginTime != ''">
              AND o.create_time <![CDATA[ >= ]]> #{beginTime,jdbcType=VARCHAR}
            </if>
            <if test="endTime != null and endTime != ''">
              AND o.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
            </if>
            <if test="nickName != null and nickName != ''">
              AND o.nick_name LIKE CONCAT('%',#{nickName},'%')
            </if>
            <if test="phone != null and phone != ''">
              AND o.phone LIKE CONCAT('%',#{phone},'%')
            </if>
            <if test="idCard != null and idCard != ''">
                AND o.id_card = #{idCard}
            </if>
            <if test="merchantId != null and merchantId != '-1'">
              AND mo.merchant_id = #{merchantId}
            </if>
            <if test="isLock != null and isLock != '-1'">
              AND o.is_lock = #{isLock}
            </if>
        </where>
        GROUP BY mo.user_id
        ORDER BY o.id DESC
    </select>
 
</mapper>