From f59357fc08c067e166918199033e657a2ab58fd3 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 12 Sep 2024 16:05:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=88=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Sys/Entity/SysFieldSet.cs | 8 +++++- .../DS.WMS.Core/Sys/Method/CommonService.cs | 27 ++++++++++--------- .../DS.WMS.OpApi/DS.WMS.OpApi.csproj.user | 2 +- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysFieldSet.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysFieldSet.cs index b2024bf4..2f36c291 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysFieldSet.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysFieldSet.cs @@ -32,6 +32,12 @@ public class SysFieldSet /// /// 字段设置 /// - [SugarColumn(ColumnDescription = "字段设置", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)] + [SugarColumn(ColumnDescription = "字段设置", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] public string Content { get; set; } + + /// + /// 租户Id + /// + [SugarColumn(ColumnDescription = "租户Id", IsNullable = true)] + public long? TenantId { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs index 2370b1b3..aee297a0 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs @@ -386,7 +386,7 @@ public class CommonService : ICommonService { return await Task.FromResult(DataResult.Failed("账号不存在或账号禁用,请检查!")); } - + if (userInfo.MD5Password != model.Password) { @@ -864,7 +864,7 @@ public class CommonService : ICommonService #region 客户端通用 - + /// /// 获取权限树列表-客户端 /// @@ -1450,10 +1450,10 @@ public class CommonService : ICommonService return db.Queryable(); //超级管理员特权 } - var moduleName = typeof(T).Name.ToLower(); + var moduleName = typeof(T).Name.ToLower(); var rule = tenantDb.Queryable() - .First(u => u.UserId == long.Parse(user.UserId) && u.PermissionEntity.ToLower() == moduleName && u.Status == StatusEnum.Enable); + .First(u => u.UserId == long.Parse(user.UserId) && u.PermissionEntity.ToLower() == moduleName && u.Status == StatusEnum.Enable); if (rule == null) return db.Queryable(); //没有设置数据规则,那么视为该资源允许被任何主体查看 @@ -1613,9 +1613,10 @@ public class CommonService : ICommonService } } } + var tenantId = long.Parse(user.TenantId); var tagNoList = tagNoDic.Select(x => x.Key); var infoList = await db.Queryable() - .Where(x => x.PermissionId == long.Parse(query.PermissionId) && tagNoList.Contains(x.TagNo)) + .Where(x => x.PermissionId == long.Parse(query.PermissionId) && x.TenantId == tenantId && tagNoList.Contains(x.TagNo)) .WhereIF(query.IsGetDefault, x => x.UserId == 0) .WhereIF(!query.IsGetDefault, x => (x.UserId == userId || x.UserId == 0)) .Select(x => new SysFieldSetTaskPlatResultDto(), true) @@ -1695,21 +1696,23 @@ public class CommonService : ICommonService { throw new Exception(nameof(req.TaskTypeCode) + "取值有误:" + req.TaskTypeCode); } - + var tenantId = long.Parse(user.TenantId); + var userId = long.Parse(user.UserId); var info = await db.Queryable() - .Where(x => x.PermissionId == req.PermissionId && x.TagNo == tagNo) + .Where(x => x.PermissionId == req.PermissionId && x.TenantId == tenantId && x.TagNo == tagNo) .WhereIF(req.IsSetDefault, x => x.UserId == 0) - .WhereIF(!req.IsSetDefault, x => x.UserId == long.Parse(user.UserId)) + .WhereIF(!req.IsSetDefault, x => x.UserId == userId) .FirstAsync(); if (info.IsNull()) { var entity = new SysFieldSet { - UserId = req.IsSetDefault ? 0 : long.Parse(user.UserId), - TagNo = tagNo, + UserId = req.IsSetDefault ? 0 : userId, PermissionId = req.PermissionId, - Content = req.Content + Content = req.Content, + TenantId = tenantId, + TagNo = tagNo, }; await db.Insertable(entity).ExecuteCommandAsync(); } @@ -2127,7 +2130,7 @@ public class CommonService : ICommonService /// 获取最新业务单据编码 /// /// - public async Task> GetSequenceNextAsync(SqlSugarScopeProvider tenantDb, IUser user,long saleId = 0) + public async Task> GetSequenceNextAsync(SqlSugarScopeProvider tenantDb, IUser user, long saleId = 0) { //生成编号 string sequenceNewNo = ""; diff --git a/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user b/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user index fb7be066..21e5222f 100644 --- a/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user +++ b/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user @@ -1,7 +1,7 @@  - D:\Source\Repos\DS8\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml + D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml MvcControllerEmptyScaffolder root/Common/MVC/Controller