update HouseCodeList

This commit is contained in:
2021-05-20 13:55:45 +08:00
parent 16b3688edb
commit 6cbb663e97
5 changed files with 65 additions and 25 deletions

View File

@@ -41,9 +41,18 @@ namespace Ewide.Application.Service.HouseCode.Dto
public string Id { get; set; }
}
public class DeleteProjectInput
public class DeleteHouseCodeInput
{
[Required(ErrorMessage = "房屋编码ID不可为空")]
public string Id { get; set; }
}
public class QueryHouseCodeInput : PageInputBase
{
public string HouseCode { get; set; }
public string Address { get; set; }
public string ProjectId { get; set; }
public string ZoonId { get; set; }
public int Type { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using Ewide.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application.Service.HouseCode.Dto
{
public class HouseCodeOutput : PageInputBase
{
public string HouseCode { get; set; }
public string Address { get; set; }
public string ProjectId { get; set; }
public string ZoonId { get; set; }
public int Type { get; set; }
public int ProjectFullName { get; set; }
public int ProjectName { get; set; }
public int AreaName { get; set; }
public int RoadName { get; set; }
public int CommName { get; set; }
}
}

View File

@@ -9,10 +9,6 @@ using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using Ewide.Core.Extension;
@@ -51,26 +47,21 @@ namespace Ewide.Application.Service.HouseCode
}
[HttpPost("/houseCode/delete")]
public async Task DeleteHouseCode(DeleteProjectInput input)
public async Task DeleteHouseCode(DeleteHouseCodeInput input)
{
var houseCode = _houseCodeRep.FirstOrDefault(p => p.Id == input.Id);
await houseCode.DeleteNowAsync();
}
//public async Task<dynamic> QueryHouseCodePageList([FromBody] AddHouseCodeInput input)
//{
// var areaCodeRep = Db.GetRepository<SysAreaCode>();
// var projectCodeRep = Db.GetRepository<BsHouseProjectInfo>();
// var houseCodes = await _houseCodeRep.DetachedEntities
// .Join(projectCodeRep.DetachedEntities, c => c.ProjectId, p => p.Id, (c, p) => new { c, p })
// .Join(areaCodeRep.DetachedEntities, cp => cp.p.AreaCode, a => a.Code, (cp, a) => new { cp, a })
// .Where(!string.IsNullOrEmpty(input.HouseCode), cpa => cpa.cp.c.HouseCode.Contains(input.HouseCode))
//}
public async Task<dynamic> QueryPage()
[HttpPost("/houseCode/page")]
public async Task<dynamic> QueryPage([FromBody] QueryHouseCodeInput input)
{
var sql = "SELECT * FROM bs_house_code";
return await _dapperRepository.QueryPageData(sql, new PageInputBase());
var sql = @"SELECT HC.*,HP.Note,AA.Name AreaName,RA.Name RoadName,CA.Name CommName FROM bs_house_code HC
LEFT JOIN bs_house_projectinfo HP ON HP.Id=HC.ProjectId
LEFT JOIN sys_area_code CA ON CA.Code = HP.AreaCode
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6) WHERE HC.Address like @Address";
return await _dapperRepository.QueryPageData(sql, input, param: new { Address = '%' + input.Address + '%' });
}
}
}