Pu Zhibing
2025-02-27 b380c7e0d061b5502114ab1214c2a217f7f6ee92
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
<?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.panzhihua.sangeshenbian.dao.SystemUserMapper">
 
    
    <select id="list" resultType="com.panzhihua.sangeshenbian.warpper.SystemUserListVo">
        select
            a.id,
            a.name,
            a.phone,
            IF(a.four_department_id is not null, e.`name`, IF(a.three_department_id is not null, d.`name`, IF(a.two_department_id is not null, c.`name`, b.`name`))) as departmentName,
            f.`name` as systemPostName,
            g.`name` as systemRoleName,
            a.account_level as accountLevel,
            a.`status`
        from sgsb_system_user a
        left join sgsb_department b on (a.one_department_id = b.id)
        left join sgsb_department c on (a.two_department_id = c.id)
        left join sgsb_department d on (a.three_department_id = d.id)
        left join sgsb_department e on (a.four_department_id = e.id)
        left join sgsb_system_post f on (a.system_post_id = f.id)
        left join sgsb_system_role g on (a.system_role_id = g.id)
        where a.`status` != 3
        <if test="1 != accountLevel or 5 != accountLevel">
            and a.account_level &lt;= #{accountLevel}
        </if>
        <if test="5 == accountLevel">
            and a.id = 0
        </if>
        <if test="null != query.name and '' != query.name">
            and a.name like CONCAT('%', #{query.name}, '%')
        </if>
        <if test="null != query.phone and '' != query.phone">
            and a.phone like CONCAT('%', #{query.phone}, '%')
        </if>
        <if test="null != query.departmentId">
            and (a.one_department_id = #{query.departmentId} or a.two_department_id = #{query.departmentId} or a.three_department_id = #{query.departmentId} or a.four_department_id = #{query.departmentId})
        </if>
        <if test="null != query.systemRoleId">
            and a.system_role_id = #{query.systemRoleId}
        </if>
        <if test="null != query.accountLevel">
            and a.account_level = #{query.accountLevel}
        </if>
        order by a.create_time desc
    </select>
    
    
    
    <select id="getRegion" resultType="map">
        select region_code as id, region_name as name from bc_region where parent_id = #{pcode}
    </select>
    
    
    <select id="getStreet" resultType="map">
        select street_id as id, name as name from com_street where area_code = #{pcode}
    </select>
    
    
    <select id="getCommunity" resultType="map">
        select community_id as id, name as name from com_act where street_id = #{streetId}
    </select>
</mapper>