xin
2025-06-04 9931d6f56816aecb09333cef2d12777c08793547
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
<?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.oying.modules.system.mapper.MenuMapper">
    <resultMap id="BaseResultMap" type="com.oying.modules.system.domain.Menu">
        <id column="menu_id" property="id"/>
        <result column="title" property="title"/>
        <result column="name" property="componentName"/>
        <result column="menu_sort" property="menuSort"/>
        <result column="component" property="component"/>
        <result column="path" property="path"/>
        <result column="type" property="type"/>
        <result column="permission" property="permission"/>
        <result column="icon" property="icon"/>
        <result column="cache" property="cache"/>
        <result column="hidden" property="hidden"/>
        <result column="pid" property="pid"/>
        <result column="sub_count" property="subCount"/>
        <result column="i_frame" property="iFrame"/>
        <result column="create_by" property="createBy"/>
        <result column="update_by" property="updateBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        menu_id, title, name, menu_sort, component, path, type, permission, icon, cache, hidden, pid, sub_count, i_frame, create_by, update_by, create_time, update_time
    </sql>
 
    <select id="findAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from sys_menu
        <where>
            <if test="criteria.blurry != null and criteria.blurry != ''">
                and (
                    title like concat('%',#{criteria.blurry},'%')
                    or name like concat('%',#{criteria.blurry},'%')
                    or permission like concat('%',#{criteria.blurry},'%')
                )
            </if>
            <if test="criteria.pidIsNull != null">
                and pid is null
            </if>
            <if test="criteria.pid != null">
                and pid = #{criteria.pid}
            </if>
            <if test="criteria.createTime != null and criteria.createTime.size() != 0">
                and create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
            </if>
        </where>
        order by menu_sort
    </select>
 
    <select id="findByRoleIdsAndTypeNot" resultMap="BaseResultMap">
        SELECT m.* FROM sys_menu m, sys_roles_menus r
        WHERE m.menu_id = r.menu_id AND r.role_id IN
        <foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
            #{roleId}
        </foreach>
        AND type != #{type}
        order by m.menu_sort
    </select>
 
    <select id="findByPidOrderByMenuSort" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        from sys_menu
        WHERE pid = #{pid}
        ORDER BY menu_sort
    </select>
 
    <select id="findByPidIsNullOrderByMenuSort" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        from sys_menu
        where pid is null
        order by menu_sort
    </select>
</mapper>