ny
昨天 b6f169fe43a2b13f351aefc152374fc7f0bc8cb7
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
<?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="jnpf.permission.mapper.UserMapper">
 
    <select id="getListId" resultType="java.lang.String">
        SELECT F_Id from base_user WHERE F_Enabled_Mark = 1
    </select>
 
    <select id="query" resultType="java.lang.String">
        SELECT F_Id FROM
        (SELECT DISTINCT u.F_Id,u.F_Sort_Code,u.F_Creator_Time
        FROM base_user_relation ul1,base_user u
        WHERE u.F_Id = ul1.F_User_Id
        AND u.f_account != 'admin'
        <if test="enabledMark != null">
            AND u.f_enabled_mark = #{enabledMark}
        </if>
        <if test="gender != null and gender != ''">
            AND u.f_gender = #{gender}
        </if>
        <if test="account != null and account != ''">
            and (u.F_Account like #{account} or u.F_Real_Name like #{account} or u.F_Mobile_Phone like
            #{account})
        </if>
        <if test="orgIdList != null and orgIdList.size > 0">
            AND (ul1.F_Object_Id IN
            <trim suffixOverrides=" OR ul1.F_Object_Id IN()">
                <foreach collection="orgIdList" item="orgIds" index="index" open="(" close=")">
                    <if test="index != 0">
                        <choose>
                            <when test="index % 1000 == 999">) OR ul1.F_Object_Id IN (</when>
                            <otherwise>,</otherwise>
                        </choose>
                    </if>
                    #{orgIds}
                </foreach>
            </trim>
            )
        </if>
        ORDER BY u.F_Sort_Code ASC,u.F_Creator_Time DESC) uu
    </select>
 
    <select id="count" resultType="java.lang.Long">
        SELECT count(F_Id) FROM
        (SELECT DISTINCT u.F_Id,u.F_Sort_Code,u.F_Creator_Time
        FROM base_user_relation ul1,base_user u
        WHERE u.F_Id = ul1.F_User_Id
        AND u.F_Account != 'admin'
        <if test="enabledMark != null">
            AND u.f_enabled_mark = #{enabledMark}
        </if>
        <if test="gender != null and gender != ''">
            AND u.f_gender = #{gender}
        </if>
        <if test="account != null and account != ''">
            and (u.F_Account like #{account} or u.F_Real_Name like #{account} or u.F_Mobile_Phone like
            #{account})
        </if>
        <if test="orgIdList != null and orgIdList.size > 0">
            AND (ul1.F_Object_Id IN
            <trim suffixOverrides=" OR ul1.F_Object_Id IN()">
                <foreach collection="orgIdList" item="orgIds" index="index" open="(" close=")">
                    <if test="index != 0">
                        <choose>
                            <when test="index % 1000 == 999">) OR ul1.F_Object_Id IN (</when>
                            <otherwise>,</otherwise>
                        </choose>
                    </if>
                    #{orgIds}
                </foreach>
            </trim>
            )
        </if>) uu
    </select>
 
</mapper>