From 5a86f69ecfaaaf745a33b6c5d2252ac8e1b3471e Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 13 Mar 2026 20:39:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90=E8=8E=B7=E5=8F=96=E6=96=B9=E6=B3=95=E5=8F=8A?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/youlai_admin.sql | 2 +- sql/mysql/youlai_admin_template.sql | 2 +- .../com/youlai/boot/security/util/SecurityUtils.java | 10 ++++++++++ src/main/resources/application-dev.yml | 6 +++--- src/main/resources/application-prod.yml | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/sql/mysql/youlai_admin.sql b/sql/mysql/youlai_admin.sql index 6b39cbbd..e123baa8 100644 --- a/sql/mysql/youlai_admin.sql +++ b/sql/mysql/youlai_admin.sql @@ -313,7 +313,7 @@ INSERT INTO `sys_role_menu` VALUES (2, 230), (2, 2301), (2, 2302), (2, 2303), (2 INSERT INTO `sys_role_menu` VALUES (2, 240), (2, 2401), (2, 2402), (2, 2403), (2, 2404); INSERT INTO `sys_role_menu` VALUES (2, 250), (2, 2501), (2, 2502), (2, 2503), (2, 2504); INSERT INTO `sys_role_menu` VALUES (2, 251), (2, 2511), (2, 2512), (2, 2513), (2, 2514); -INSERT INTO `sys_role_menu` VALUES (2, 260); +INSERT INTO `sys_role_menu` VALUES (2, 260), (2, 2601); INSERT INTO `sys_role_menu` VALUES (2, 270), (2, 2701), (2, 2702), (2, 2703), (2, 2704), (2, 2705); INSERT INTO `sys_role_menu` VALUES (2, 280), (2, 2801), (2, 2802), (2, 2803), (2, 2804), (2, 2805), (2, 2806); diff --git a/sql/mysql/youlai_admin_template.sql b/sql/mysql/youlai_admin_template.sql index ab691bd8..c1764792 100644 --- a/sql/mysql/youlai_admin_template.sql +++ b/sql/mysql/youlai_admin_template.sql @@ -280,7 +280,7 @@ INSERT INTO `sys_role_menu` VALUES (2, 230), (2, 2301), (2, 2302), (2, 2303), (2 INSERT INTO `sys_role_menu` VALUES (2, 240), (2, 2401), (2, 2402), (2, 2403), (2, 2404); INSERT INTO `sys_role_menu` VALUES (2, 250), (2, 2501), (2, 2502), (2, 2503), (2, 2504); INSERT INTO `sys_role_menu` VALUES (2, 251), (2, 2511), (2, 2512), (2, 2513), (2, 2514); -INSERT INTO `sys_role_menu` VALUES (2, 260); +INSERT INTO `sys_role_menu` VALUES (2, 260), (2, 2601); INSERT INTO `sys_role_menu` VALUES (2, 270), (2, 2701), (2, 2702), (2, 2703), (2, 2704), (2, 2705); INSERT INTO `sys_role_menu` VALUES (2, 280), (2, 2801), (2, 2802), (2, 2803), (2, 2804), (2, 2805), (2, 2806); diff --git a/src/main/java/com/youlai/boot/security/util/SecurityUtils.java b/src/main/java/com/youlai/boot/security/util/SecurityUtils.java index cbe21b20..5a723cd0 100644 --- a/src/main/java/com/youlai/boot/security/util/SecurityUtils.java +++ b/src/main/java/com/youlai/boot/security/util/SecurityUtils.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import com.youlai.boot.common.constant.SecurityConstants; import com.youlai.boot.common.constant.SystemConstants; +import com.youlai.boot.security.model.RoleDataScope; import com.youlai.boot.security.model.SysUserDetails; import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.HttpHeaders; @@ -70,6 +71,15 @@ public class SecurityUtils { return getUser().map(SysUserDetails::getDeptId).orElse(null); } + /** + * 获取数据权限列表 + * + * @return 数据权限列表 + */ + public static List getDataScopes() { + return getUser().map(SysUserDetails::getDataScopes).orElse(List.of()); + } + /** * 获取角色集合 * diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index f50ab8de..e6ce16d2 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -10,7 +10,7 @@ spring: password: 123456 data: redis: - database: 11 + database: 12 host: www.youlai.tech port: 6379 password: 123456 @@ -216,5 +216,5 @@ captcha: # 微信小程序配置 wx: miniapp: - appid: xxxxxxx - secret: xxxxxxx + appid: Your_AppId + secret: Your_AppSecret diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index de79b370..30a680db 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -214,5 +214,5 @@ captcha: # 微信小程配置 wx: miniapp: - app-id: xxxxxx - app-secret: xxxxxx + app-id: Your_AppId + app-secret: Your_AppSecret