diff --git a/src/Shentun.Peis.Application.Contracts/CustomerOrgs/CustomerOrgBaseDto.cs b/src/Shentun.Peis.Application.Contracts/CustomerOrgs/CustomerOrgBaseDto.cs
new file mode 100644
index 0000000..7861b7f
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/CustomerOrgs/CustomerOrgBaseDto.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.CustomerOrgs
+{
+ public class CustomerOrgBaseDto
+ {
+ //单位Id
+ public Guid Id { get; set; }
+ //单位名称
+ public string DisplayName { get; set; }
+ //父节点Id
+ public Guid? ParentId { get; set; }
+
+
+ ///
+ /// 短名称
+ ///
+ public string ShortName { get; set; }
+
+ ///
+ /// 单位编码
+ ///
+ public string CustomerOrgCode { get; set; }
+
+ ///
+ /// 拼音简码
+ ///
+ public string SimpleCode { get; set; }
+
+ public int DisplayOrder { get; set; }
+
+ ///
+ /// 是否有下级
+ ///
+ public char IsChild { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/CustomerOrgs/ParentIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/CustomerOrgs/ParentIdInputDto.cs
new file mode 100644
index 0000000..4098139
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/CustomerOrgs/ParentIdInputDto.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.CustomerOrgs
+{
+ public class ParentIdInputDto
+ {
+ public Guid? ParentId { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs b/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs
index 0106e5e..f357ae3 100644
--- a/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs
+++ b/src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
+using NPOI.POIFS.Properties;
using Shentun.Peis.CustomerOrgRegisters;
using Shentun.Peis.Enums;
using Shentun.Peis.HelperDto;
@@ -271,6 +272,37 @@ namespace Shentun.Peis.CustomerOrgs
return dataList.OrderBy(o => o.DisplayOrder).ToList();
}
+ ///
+ /// 根据父ID获取单位列表 分级获取
+ ///
+ ///
+ ///
+ [HttpPost("api/app/CustomerOrg/GetCustomerOrgByParentId")]
+ public async Task> GetCustomerOrgByParentIdAsync(ParentIdInputDto input)
+ {
+
+ var parentIds = (await Repository.GetQueryableAsync()).Where(m => m.ParentId != null).Select(s => s.ParentId).ToList();
+
+ var query = await Repository.GetQueryableAsync();
+
+ query = query.Where(m => m.ParentId == input.ParentId);
+
+
+ var entListDto = query.ToList().Select(s => new CustomerOrgBaseDto
+ {
+ CustomerOrgCode = s.CustomerOrgCode,
+ ParentId = s.ParentId,
+ DisplayName = s.DisplayName,
+ DisplayOrder = s.DisplayOrder,
+ Id = s.Id,
+ ShortName = s.ShortName,
+ SimpleCode = s.SimpleCode,
+ IsChild = parentIds.Any() && parentIds.Contains(s.Id) ? 'Y' : 'N',
+ }).OrderBy(o => o.DisplayOrder).ToList();
+
+ return entListDto;
+ }
+
///
/// 获取单位树型结构
///
@@ -351,7 +383,7 @@ namespace Shentun.Peis.CustomerOrgs
//}
-
+
result.AddRange(customerOrgTreeChildList);