diff --git a/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs b/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs index 2f5aa59d..92a02c9b 100644 --- a/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs +++ b/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs @@ -78,4 +78,12 @@ public interface IOrganizeService /// /// Task> GetChildOrgId(string id); + + /// + /// 根据工位id获取其任意上级 + /// + /// + /// + /// + Task GetAnyParentByWorkstationId(string id,string type); } \ No newline at end of file diff --git a/system/Tnb.Systems/Permission/OrganizeService.cs b/system/Tnb.Systems/Permission/OrganizeService.cs index fd02a5a2..e2a7bf88 100644 --- a/system/Tnb.Systems/Permission/OrganizeService.cs +++ b/system/Tnb.Systems/Permission/OrganizeService.cs @@ -19,6 +19,7 @@ using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; +using Tnb.BasicData; using Yitter.IdGenerator; namespace JNPF.Systems; @@ -835,6 +836,14 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie return (await _repository.GetListAsync(x => x.OrganizeIdTree.Contains(id) && x.EnabledMark == 1 && x.DeleteMark == null)).Select(x => x.Id).ToList(); } + public async Task GetAnyParentByWorkstationId(string id, string type) + { + return await _repository.AsQueryable() + .LeftJoin((a,b)=>a.OrganizeIdTree.Contains(b.Id) && b.Category==type) + .Where((a,b)=>a.Id==id) + .Select((a,b)=>b).FirstAsync(); + } + /// /// 处理组织树 名称. ///