From 334809922a5e887a5d496ccbeca2511cdff8014e Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 26 Mar 2024 23:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB=E5=9F=BA?= =?UTF-8?q?=E8=AE=A2=E8=88=B1=E5=8F=B0=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingMSKAPIService.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs index 8f45c343..b4b10f48 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs @@ -990,7 +990,14 @@ namespace Myshipping.Application.Service.BookingOrder //菜单375504048771141=我的任务台账 List userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuMSKApi); - if (userlist.Count > 0) + bool isAdmin = false; + + if(userlist == null) + { + isAdmin = true; + userlist = new List(); + } + else if (userlist != null && userlist.Count > 0) { userlist.Add(UserManager.UserId); userlist = userlist.Distinct().ToList(); @@ -999,7 +1006,7 @@ namespace Myshipping.Application.Service.BookingOrder _logger.LogInformation("任务台账权限范围 {list}", userlist); var entities = await _bookingDeliveryRecordRep.AsQueryable() - .Where(t => userlist == null || (userlist.Count > 0 && userlist.Contains(t.CreatedUserId.Value))) + .Where(t => isAdmin || userlist.Contains(t.CreatedUserId.Value)) .WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin) .WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd) .WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin)