From 1bd3f5f39c102e40c74bd13bdb7ac751975c5561 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 15 一月 2025 10:12:12 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs"
index ff749a1..db45659 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs"
@@ -16,6 +16,7 @@
 using WIDESEA_Model.Models.System;
 using WIDESEA_SystemRepository;
 using WIDESEA_Core.Helper;
+using WIDESEA_Core.HostedService;
 
 namespace WIDESEA_SystemService
 {
@@ -38,7 +39,7 @@
 
         public override WebResponseContent AddData(SaveModel saveModel)
         {
-            string authorityScope = saveModel.MainData["authorityScope"].ToString();
+            string authorityScope = saveModel.MainData["authorityScope"].ToString() ?? "";
             Sys_Role role = saveModel.MainData.DicToModel<Sys_Role>();
             if (BaseDal.QueryFirst(x => x.RoleName == role.RoleName) != null)
             {
@@ -71,12 +72,14 @@
                 BaseDal.Db.Insertable(roleDataPermissions).ExecuteCommand();
             }
 
+            PermissionDataHostService.UserRoles = PermissionDataHostService.GetUserRoles(Db);
+
             return WebResponseContent.Instance.OK();
         }
 
         public override WebResponseContent UpdateData(SaveModel saveModel)
         {
-            string authorityScope = saveModel.MainData["authorityScope"].ToString();
+            string authorityScope = saveModel.MainData["authorityScope"].ToString() ?? "";
             Sys_Role role = saveModel.MainData.DicToModel<Sys_Role>();
             if (BaseDal.QueryFirst(x => x.RoleId == role.RoleId) == null)
             {
@@ -116,9 +119,16 @@
             BaseDal.Db.Insertable(roleDataPermissions).ExecuteCommand();
             BaseDal.Db.Deleteable(oldDatas).ExecuteCommand();
 
+            PermissionDataHostService.UserRoles = PermissionDataHostService.GetUserRoles(Db);
+
             return WebResponseContent.Instance.OK();
         }
 
+        public List<int> GetAllChildrenRoleId(int roleId)
+        {
+            return GetAllChildren(roleId).Select(x => x.Id).ToList();
+        }
+
         public List<RoleNodes> GetAllChildren(int roleId)
         {
             if (roleId <= 0) return new List<RoleNodes>() { };

--
Gitblit v1.9.3