update&add 增加了选房及片区service

This commit is contained in:
2021-05-28 21:16:19 +08:00
parent 34c47e78b2
commit 7cef14c7fd
49 changed files with 2034 additions and 110 deletions

View File

@@ -0,0 +1,39 @@
using Ewide.Core;
using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Ewide.Application.Service
{
/// <summary>
/// 片区相关
/// </summary>
[ApiDescriptionSettings(Name = "HouseZone", Order = 180)]
public class HouseZoneService : IHouseZoneService, IDynamicApiController, ITransient
{
[HttpGet("/houseZone/list")]
public async Task<dynamic> GetHouseZoneList([FromQuery] HouseZoneInput input)
{
var areaCode = input.AreaCode.Substring(0, 9);
var _sysOrgRep = Db.GetRepository<SysOrg>();
var road = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.AreaCode == areaCode);
if (road == null) throw Oops.Oh("街道编码错误");
return await _sysOrgRep.DetachedEntities
.Where(p => p.Pid == road.Id)
.Where(p => p.Type == (int)OrgType.)
.OrderBy(p => p.Sort)
.Select(p => new
{
p.Id,
p.Name
})
.ToListAsync();
}
}
}