chenlu
2024-05-11 1e34724c27ca0f5c3ab66ebb223bfc138a548e0b
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
<?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.example.erp.mapper.userInfo.PermissionBasicMapper">
    <select id="getPermission">
        select a.*,
               CASE
                   WHEN b.id IS NULL THEN 0
                   ELSE 1
                END
        from permission_basic as a
        left join permission_role as b
        on a.id = b.permission_id
        left join user_role as c
        on b.role_id = c.role_id
        left join user as d
        on c.user_id = d.id
        and d.id = #{userId}
        where a.id!=1 and a.state=1
        group by a.id
    </select>
    
    <select id="selectOneLevel">
        select *
        from permission_basic
        where id!=1 and state=1
        group by  menu
 
    </select>
 
    <select id="selectTowLevel">
        select
            id as value,
            page as label
        from permission_basic
        where id!=1 and state=1
        group by  menu
 
    </select>
 
</mapper>