1
zj
2024-06-02 6f353ae65e9c9f117a9c1177aa5766fd6a3a161e
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
<?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.nq.dao.UserMapper">
    <resultMap id="BaseResultMap" type="com.nq.pojo.User">
        <id  column="id"  property="id"/>
        <result column="agent_id" property="agentId"/>
        <result column="agent_name" property="agentName"/>
        <result column="phone" property="phone"/>
        <result  column="user_pwd"  property="userPwd"/>
        <result column="with_pwd"  property="withPwd"/>
        <result column="nick_name"  property="nickName"/>
        <result column="real_name"  property="realName"/>
        <result column="id_card"  property="idCard"/>
        <result column="account_type"  property="accountType"/>
        <result column="is_lock"  property="isLock"/>
        <result column="is_login"  property="isLogin"/>
        <result column="reg_time"  property="regTime"/>
        <result column="reg_ip" property="regIp"/>
        <result column="reg_address" property="regAddress"/>
        <result column="img1_key" property="img1Key"/>
        <result column="img2_key" property="img2Key"/>
        <result column="img3_key" property="img3Key"/>
        <result column="is_active" property="isActive"/>
        <result column="auth_msg" property="authMsg"/>
        <result column="withdrawal_Pwd" property="withdrawalPwd"/>
        <result column="vaild_number"  property="vaildNumber"/>
        <result column="lever" property="lever"/>
        <result column="fund_ratio"  property="fundRatio"/>
 
    </resultMap>
    <sql id="Base_Column_List">
    id, agent_id, agent_name, phone, user_pwd, with_pwd, nick_name, real_name, id_card, 
    account_type, is_lock, is_login,
    reg_time, reg_ip, reg_address, img1_key, img2_key, img3_key, is_active, auth_msg,
    withdrawal_Pwd,vaild_number,lever,fund_ratio
  </sql>
 
 
    <select id="findByPhone" parameterType="string" resultType="com.nq.pojo.User">
        select * from user where phone= #{phone}
    </select>
 
    <select id="login" resultMap="BaseResultMap" parameterType="map">
        SELECT
        <include refid="Base_Column_List"/>
        FROM user
        WHERE phone = #{phone} and user_pwd = #{userPwd}
    </select>
 
    <select id="listByAgent" resultMap="BaseResultMap" parameterType="map">
        SELECT
        <include refid="Base_Column_List"/>
        FROM user
        <where>
            (agent_id = #{searchId} or
             agent_id in (select a.id FROM agent_user a left join agent_distribution_user d on a.id = d.agent_id WHERE d.parent_id = #{searchId})
            )
            <if test="realName != null and realName != '' ">
                and real_name like CONCAT('%','${realName}','%')
            </if>
            <if test="phone != null and phone != '' ">
                and phone like CONCAT('%','${phone}','%')
            </if>
            <if test="accountType != null ">
                and account_type = #{accountType}
            </if>
        </where>
        ORDER BY id DESC
    </select>
 
    <select id="querySumTodayRegCount"  resultType="int">
        select count(*) from user where TO_DAYS(reg_time) = TO_DAYS(NOW())
    </select>
 
 
    <select id="querySumTodayRegCount"  resultType="int" parameterType="integer">
        select count(*) from user where TO_DAYS(reg_time) = TO_DAYS(NOW()) and agent_id = #{id}
    </select>
 
 
    <select id="queryAgintSumTodayRegCount"  parameterType="integer"   resultType="int">
        select count(*) from user where agent_id =#{id}   TO_DAYS(reg_time) = TO_DAYS(NOW())
    </select>
 
    <select id="listByAdmin" resultMap="BaseResultMap" parameterType="map">
        SELECT
        <include refid="Base_Column_List"/>
        FROM user
        <where>
            <if test="searchId != null ">
                and agent_id = #{searchId}
            </if>
            <if test="realName != null and realName != '' ">
                and real_name like CONCAT('%','${realName}','%')
            </if>
            <if test="phone != null and phone != '' ">
                and phone like CONCAT('%','${phone}','%')
            </if>
            <if test="accountType != null ">
                and account_type = #{accountType}
            </if>
        </where>
        ORDER BY id DESC
    </select>
</mapper>