|
@@ -10,6 +10,7 @@ using Hotline.Share.Enums.Order;
|
|
|
using Hotline.Share.Enums.Settings;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using SqlSugar;
|
|
|
using StackExchange.Redis;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
@@ -45,10 +46,20 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpGet("children")]
|
|
|
public async Task<IReadOnlyList<Hotspot>> GetChildren([FromQuery] string? id)
|
|
|
{
|
|
|
- return await _hotspotTypeRepository.Queryable()
|
|
|
+ var list = await _hotspotTypeRepository.Queryable()
|
|
|
.Where(x => x.ParentId == id)
|
|
|
.OrderBy(d => d.HotSpotName)
|
|
|
- .ToListAsync();
|
|
|
+ .Select(x=> new Hotspot
|
|
|
+ {
|
|
|
+ Id = x.Id,
|
|
|
+ HotSpotName = x.HotSpotName,
|
|
|
+ ParentId = x.ParentId,
|
|
|
+ HotSpotFullName = x.HotSpotFullName,
|
|
|
+ ProvinceCode = x.ProvinceCode,
|
|
|
+ HasChild = SqlFunc.Subqueryable<Hotspot>().Where(d=>d.ParentId == x.Id).Any()
|
|
|
+ }).ToListAsync();
|
|
|
+
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|