inleft
2022-02-09 9bcb19959eeb9da9bde2561e7278f6d0a55eb151
commit | author | age
9bcb19 1 /*
I 2 Copyright [2020] [https://www.xiaonuo.vip]
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8   http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
17
18 1.请不要删除和修改根目录下的LICENSE文件。
19 2.请不要删除和修改Snowy源码头部的版权声明。
20 3.请保留源码和相关描述文件的项目出处,作者声明等。
21 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
22 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
23 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
24  */
25 package vip.xiaonuo.core.context.system;
26
27 import cn.hutool.core.lang.Dict;
28 import vip.xiaonuo.core.pojo.base.validate.UniqueValidateParam;
29 import vip.xiaonuo.core.pojo.login.SysLoginUser;
30
31 import java.util.List;
32
33 /**
34  * 系统相关上下文接口,在system模块实现,用于某些模块不能引用system模块时,通过此方式调用system相关功能
35  *
36  * @author xuyuxiang
37  * @date 2020/5/6 14:52
38  */
39 public interface SystemContext {
40
41     /**
42      * 根据用户id获取姓名
43      *
44      * @param userId 用户id
45      * @return 用户姓名
46      * @author xuyuxiang
47      * @date 2020/5/6 14:57
48      */
49     String getNameByUserId(Long userId);
50
51     /**
52      * 根据角色id获取角色名称
53      *
54      * @param roleId 角色id
55      * @return 角色名称
56      * @author xuyuxiang
57      * @date 2020/5/22 15:55
58      */
59     String getNameByRoleId(Long roleId);
60
61     /**
62      * 根据token获取登录用户信息
63      *
64      * @param token token
65      * @return 登录用户信息
66      * @author xuyuxiang
67      * @date 2020/3/13 11:59
68      */
69     SysLoginUser getLoginUserByToken(String token);
70
71     /**
72      * 根据用户账号模糊搜索系统用户列表
73      *
74      * @param account 账号
75      * @return 增强版hashMap,格式:[{"id:":123, "firstName":"张三"}]
76      * @author xuyuxiang
77      * @date 2020/6/1 15:12
78      */
79     List<Dict> listUser(String account);
80
81     /**
82      * 根据角色名模糊搜索系统角色列表
83      *
84      * @param name 角色名
85      * @return 增强版hashMap,格式:[{"id:":123, "name":"总经理"}]
86      * @author xuyuxiang
87      * @date 2020/6/1 15:13
88      */
89     List<Dict> listRole(String name);
90
91     /**
92      * 根据id判断是否是用户
93      *
94      * @param userOrRoleId 用户或角色id
95      * @return true是 false否
96      * @author xuyuxiang
97      * @date 2020/8/4 20:56
98      */
99     boolean isUser(Long userOrRoleId);
100
101     /**
102      * 根据id判断是否是角色
103      *
104      * @param userOrRoleId 用户或角色id
105      * @return true是 false否
106      * @author xuyuxiang
107      * @date 2020/8/4 20:56
108      */
109     boolean isRole(Long userOrRoleId);
110
111     /**
112      * 根据字典类型获取字典的code值
113      *
114      * @param dictTypeCodes 字典类型编码值
115      * @return 字典的code值
116      * @author xuyuxiang
117      * @date 2020/8/9 14:18
118      */
119     List<String> getDictCodesByDictTypeCode(String... dictTypeCodes);
120
121     /**
122      * 校验某个表中,某一列是否存在重复的值
123      * <p>
124      * 一般用于唯一code校验
125      *
126      * @param uniqueValidateParam 被校验的参数
127      * @return true-是唯一的值,false-不是唯一的
128      * @author xuyuxiang
129      * @date 2020/8/9 21:41
130      */
131     boolean tableUniValueFlag(UniqueValidateParam uniqueValidateParam);
132
133     /**
134      * 获取系统用户id集合
135      *
136      * @return 用户id集合
137      * @author xuyuxiang
138      * @date 2020/9/11 17:53
139      **/
140     List<Long> getAllUserIdList();
141
142 }