From 951fa0201553702226dd87cfc249c4366bef08cc Mon Sep 17 00:00:00 2001
From: zhoukeda <1315948824@qq.com>
Date: Thu, 7 Sep 2023 11:43:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=B7=A5=E4=BD=8Did=E8=8E=B7?=
=?UTF-8?q?=E5=8F=96=E4=BB=BB=E6=84=8F=E4=B8=8A=E7=BA=A7=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Permission/IOrganizeService.cs | 8 ++++++++
system/Tnb.Systems/Permission/OrganizeService.cs | 9 +++++++++
2 files changed, 17 insertions(+)
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();
+ }
+
///
/// 处理组织树 名称.
///