|
@@ -6,6 +6,7 @@ using WingInterfaceLibrary.Request.DBVitalRequest;
|
|
|
using WingInterfaceLibrary.DTO.Vital;
|
|
|
using WingInterfaceLibrary.Request;
|
|
|
using WingInterfaceLibrary.Interface.DBVitalInterface;
|
|
|
+using WingInterfaceLibrary.DTO.Region;
|
|
|
|
|
|
namespace VitalService.Service
|
|
|
{
|
|
@@ -124,6 +125,37 @@ namespace VitalService.Service
|
|
|
return result.MappingTo<List<FacturyUserDTO>>();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 获取所有厂商数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<List<RegionDataItemDTO>> GetFacturyTreeDBAsync(GetFacturyTreeDBDBRequest request)
|
|
|
+ {
|
|
|
+ var resultData = new List<RegionDataItemDTO>();
|
|
|
+ var filter = Builders<FacturyUserEntity>.Filter.Where(f => f.IsDelete == false);
|
|
|
+ var entities = await _facturyUserDBRepository.FindAllAsync(filter);
|
|
|
+ if (entities?.Any() ?? false)
|
|
|
+ {
|
|
|
+ var orgEntities = entities.Where(x => string.IsNullOrWhiteSpace(x.FatherCode))?.ToList() ?? new List<FacturyUserEntity>();
|
|
|
+ foreach (var org in orgEntities)
|
|
|
+ {
|
|
|
+ var orgInfo = new RegionDataItemDTO
|
|
|
+ {
|
|
|
+ Key = org.Code,
|
|
|
+ Value = org.FacturyName,
|
|
|
+ };
|
|
|
+ var userEntities = entities.Where(x => x.FatherCode == org.Code)?.ToList() ?? new List<FacturyUserEntity>();
|
|
|
+ orgInfo.Children = userEntities.Select(u => new WingInterfaceLibrary.DTO.Common.DataItemDTO
|
|
|
+ {
|
|
|
+ Key = u.Code,
|
|
|
+ Value = u.FacturyName,
|
|
|
+ }).ToList();
|
|
|
+ resultData.Add(orgInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return resultData;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 删除数据
|
|
|
/// </summary>
|