zhangherong
2025-06-26 5ef91f20d4e0f9c3a2838719220fbb2c9d63fad0
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
package org.jeecg.modules.system.mapper;
 
import java.util.List;
import java.util.Map;
 
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.system.entity.SysPermission;
import org.jeecg.modules.system.model.TreeModel;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
/**
 * <p>
 * 菜单权限表 Mapper 接口
 * </p>
 *
 * @Author scott
 * @since 2018-12-21
 */
public interface SysPermissionMapper extends BaseMapper<SysPermission> {
    /**
       * 通过父菜单ID查询子菜单
     * @param parentId
     * @return
     */
    public List<TreeModel> queryListByParentId(@Param("parentId") String parentId);
 
    /**
     * 根据用户查询用户权限
     * @param username 用户账户名称
     * @return List<SysPermission>
     */
    public List<SysPermission> queryByUser(@Param("username") String username);
 
    /**
     * 修改菜单状态字段: 是否子节点
     * @param id 菜单id
     * @param leaf 叶子节点
     * @return int
     */
    @Update("update sys_permission set is_leaf=#{leaf} where id = #{id}")
    public int setMenuLeaf(@Param("id") String id,@Param("leaf") int leaf);
 
    /**
     * 切换vue3菜单
     */
    @Update("alter table sys_permission rename to sys_permission_v2")
    public void backupVue2Menu();
    @Update("alter table sys_permission_v3 rename to sys_permission")
    public void changeVue3Menu();
 
    /**
     * 获取模糊匹配规则的数据权限URL
     * @return List<String>
     */
    @Select("SELECT url FROM sys_permission WHERE del_flag = 0 and menu_type = 2 and url like '%*%'")
    public List<String> queryPermissionUrlWithStar();
 
 
    /**
     * 根据用户账号查询菜单权限
     * @param sysPermission
     * @param username
     * @return
     */
    public int queryCountByUsername(@Param("username") String username, @Param("permission") SysPermission sysPermission);
 
 
    /**
     * 查询部门权限数据
     * @param departId
     * @return
     */
    List<SysPermission> queryDepartPermissionList(@Param("departId") String departId);
    /**
     * 秘密查
     * @param sql
     * @return
     */
    List<Map<String,Object>>secretOfSelect(@Param("sql") String sql);
    /**
     * 秘密增
     * @param sql
     * @return
     */
    boolean secretOfInsert(@Param("sql")String sql);
    /**
     * 秘密改
     * @param sql
     * @return
     */
    boolean secretOfUpdate(@Param("sql")String sql);
    /**
     * 秘密删
     * @param sql
     * @return
     */
    boolean secretOfDelete(@Param("sql")String sql);
}