This commit is contained in:
alex
2023-09-07 18:17:12 +08:00
3 changed files with 19 additions and 1 deletions

View File

@@ -78,4 +78,12 @@ public interface IOrganizeService
/// <param name="id"></param>
/// <returns></returns>
Task<List<string>> GetChildOrgId(string id);
/// <summary>
/// 根据工位id获取其任意上级
/// </summary>
/// <param name="id"></param>
/// <param name="type"></param>
/// <returns></returns>
Task<OrganizeEntity> GetAnyParentByWorkstationId(string id,string type);
}

View File

@@ -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<OrganizeEntity> GetAnyParentByWorkstationId(string id, string type)
{
return await _repository.AsQueryable()
.LeftJoin<OrganizeEntity>((a,b)=>a.OrganizeIdTree.Contains(b.Id) && b.Category==type)
.Where((a,b)=>a.Id==id)
.Select((a,b)=>b).FirstAsync();
}
/// <summary>
/// 处理组织树 名称.
/// </summary>

View File

@@ -1,4 +1,5 @@
using System.Text.RegularExpressions;
using JNPF.Common.Configuration;
using Tnb.Core;
namespace Tnb.Vengine;
@@ -26,7 +27,7 @@ public class TemplateContext
#if DEBUG
BasePath = CodeHelper.GetSolutionDirectoryPath(false)!;
#else
BasePath = EApp.Options.App.AcmenBasePath;
BasePath = FileVariable.GenerateCodePath;
#endif
ModuleCode = moduleCode;
}