1
dengjunjie
2025-01-15 68a2cc40b6d7f438267f9dc74bb2f6045cf4f01d
´úÂë¹ÜÀí/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,7 +119,14 @@
            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)
@@ -323,7 +333,7 @@
                    x.AuthValue = "";
                });
                //将取消的权限设置为""
                _RoleAuthRepository.UpdateData(delAuths);
                _RoleAuthRepository.DeleteData(delAuths);
                int addCount = updateAuths.Where(x => x.AuthId <= 0).Count();
                int updateCount = updateAuths.Where(x => x.AuthId > 0).Count();