diff --git a/src/Coldairarrow.Api/DependencyInjection/Operator.cs b/src/Coldairarrow.Api/DependencyInjection/Operator.cs index edc75d0..aa81a3a 100644 --- a/src/Coldairarrow.Api/DependencyInjection/Operator.cs +++ b/src/Coldairarrow.Api/DependencyInjection/Operator.cs @@ -7,6 +7,7 @@ using EFCore.Sharding; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -29,12 +30,25 @@ namespace Coldairarrow.Api TeamId = httpContextAccessor?.HttpContext?.User.Claims .Where(x => x.Type == "teamId").FirstOrDefault()?.Value; + + SonTeamList = httpContextAccessor?.HttpContext?.User.Claims + .Where(x => x.Type == "sonTeamIds").FirstOrDefault()?.Value?.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList(); + + if (SonTeamList == null) + SonTeamList = new List(); + + SonTeamList.Add(TeamId); + } private Base_UserDTO _property; private object _lockObj = new object(); public string TeamId { get; set; } + + + public List SonTeamList { get; set; } + /// /// 当前操作者UserId /// diff --git a/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs b/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs index 7e4172a..45040fa 100644 --- a/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs +++ b/src/Coldairarrow.Business/HuiYan/itemlabelsBusiness.cs @@ -99,7 +99,7 @@ namespace Coldairarrow.Business.HuiYan //查询这边还需要添加 (Teamid筛选,或者HasFilter=True) 的二选一查询 var where = LinqHelper.True().And(c => c.Platform == (int)platform && ids.Contains(c.GoodsId)); - where = where.And(c => c.TeamId == _operator.TeamId || c.HasFilter ==true); + where = where.And(c =>_operator.SonTeamList.Contains(c.TeamId) || c.HasFilter ==true); var list = q.Where(where).ToListAsync().Result; @@ -381,7 +381,7 @@ namespace Coldairarrow.Business.HuiYan from b in ab.DefaultIfEmpty() select @select.Invoke(a, b); - var where = LinqHelper.True().And(c => c.Platform == (int)ItemPlatform.Jd && c.TeamId == _operator.TeamId && c.IsCompeting == true); + var where = LinqHelper.True().And(c => c.Platform == (int)ItemPlatform.Jd && _operator.SonTeamList.Contains(c.TeamId) && c.IsCompeting == true); var list = q.Where(where).ToList(); diff --git a/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs b/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs index caf58dd..2b5f7f1 100644 --- a/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs +++ b/src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs @@ -78,7 +78,7 @@ namespace Coldairarrow.Business.HuiYan public AjaxResult GetTeamCount() { - var list= Db.GetIQueryable().Where(c => c.TeamId == _operator.TeamId).Select(c => c.State).ToList(); + var list= Db.GetIQueryable().Where(c => _operator.SonTeamList.Contains(c.TeamId)).Select(c => c.State).ToList(); return Success(list.GroupBy(c => c).Select(c => new { Id = c.Key, Count = c.Count() })); } @@ -147,7 +147,7 @@ namespace Coldairarrow.Business.HuiYan where = where.AndIf(!string.IsNullOrEmpty(keyWord), d => string.IsNullOrEmpty(d.CatName) ? true : d.CatName.Contains(keyWord)); - where = where.And(c => c.TeamId == _operator.TeamId); + where = where.And(c => _operator.SonTeamList.Contains(c.TeamId)); input.SortField = "CreateTime"; input.SortType = "desc"; @@ -334,7 +334,7 @@ namespace Coldairarrow.Business.HuiYan //团队 if (type == 0) { - where = where.And(c => c.TeamId == _operator.TeamId); + where = where.And(c => _operator.SonTeamList.Contains(c.TeamId)); } //比价 else diff --git a/src/Coldairarrow.IBusiness/IOperator.cs b/src/Coldairarrow.IBusiness/IOperator.cs index b2d43d4..683900f 100644 --- a/src/Coldairarrow.IBusiness/IOperator.cs +++ b/src/Coldairarrow.IBusiness/IOperator.cs @@ -1,5 +1,6 @@ using Coldairarrow.Entity; using Coldairarrow.Util; +using System.Collections.Generic; namespace Coldairarrow.IBusiness { @@ -12,6 +13,12 @@ namespace Coldairarrow.IBusiness /// 团队ID /// string TeamId { get; } + + /// + /// 子部门/团队列表 + /// + List SonTeamList { get; } + /// /// 当前操作者UserId ///