update 项目管理

This commit is contained in:
2021-05-11 18:22:31 +08:00
parent 82e7ac70bd
commit 5cb9791fbd
6 changed files with 40 additions and 14 deletions

View File

@@ -37,7 +37,7 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Ewide.Application.Service.HouseProjectInfo.HouseProjectInfoService.QueryProjectPageList(Ewide.Application.Service.HouseProjectInfo.Dto.HouseProjectInfoInput)">
<member name="M:Ewide.Application.Service.HouseProjectInfo.HouseProjectInfoService.QueryProjectPageList(Ewide.Application.Service.HouseProjectInfo.Dto.PageProjectInput)">
<summary>
分页查询
</summary>

View File

@@ -36,4 +36,9 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto
{
}
public class PageProjectInput: HouseProjectInfoInput
{
public string pid { get; set; }
}
}

View File

@@ -6,6 +6,7 @@ using Furion.DatabaseAccessor;
using Furion.DatabaseAccessor.Extensions;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -83,13 +84,13 @@ namespace Ewide.Application.Service.HouseProjectInfo
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/houseProjectInfo/page")]
public async Task<dynamic> QueryProjectPageList([FromBody] HouseProjectInfoInput input)
public async Task<dynamic> QueryProjectPageList([FromBody] PageProjectInput input)
{
var areaID = !string.IsNullOrEmpty(input.AreaCode);
var areaCodeRep = Db.GetRepository<SysAreaCode>();
var projects = await _houseProjectInfoRep.DetachedEntities
.Join(areaCodeRep.DetachedEntities, p => p.AreaCode, a => a.Code, (p, a) => new { p, AreaName = a.Name })
.Where(areaID, x => x.p.AreaCode == input.AreaCode)
.Where(!string.IsNullOrEmpty(input.AreaCode), x => x.p.AreaCode == input.AreaCode)
.Where(!string.IsNullOrEmpty(input.pid) , x=> x.p.AreaCode.Contains(input.pid))
.Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaCode, x.AreaName, x.p.Type }.Adapt<HouseProjectOutput>()).ToPagedListAsync(input.PageNo, input.PageSize);
return XnPageResult<HouseProjectOutput>.PageResult(projects);
}
@@ -107,5 +108,24 @@ namespace Ewide.Application.Service.HouseProjectInfo
return userDto;
}
[HttpGet("/houseProjectInfo/nextSort")]
public async Task<int> GetNextProjectSortByAreaCode([FromQuery] HouseProjectInfoInput input)
{
//var projects = await _houseProjectInfoRep.DetachedEntities
// .Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
// .Select(p => p.Sort)
// .DefaultIfEmpty()
// .MaxAsync();
if (input.Type > 2 || input.Type < 1)
{
throw Oops.Oh("类型参数异常");
}
var p = await _houseProjectInfoRep.DetachedEntities
.Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
.MaxAsync(p => (int?)p.Sort);
return p.GetValueOrDefault(0) + 1;
}
}
}

View File

@@ -16,6 +16,8 @@ namespace Ewide.Application.Service.HouseProjectInfo
Task UpdateProject(UpdateProjectInput input);
Task<BsHouseProjectInfo> GetProjectById([FromRoute] string id);
Task<dynamic> GetProject([FromQuery] QueryProjectInput input);
Task<dynamic> QueryProjectPageList([FromQuery] HouseProjectInfoInput input);
Task<dynamic> QueryProjectPageList([FromQuery] PageProjectInput input);
Task<int> GetNextProjectSortByAreaCode([FromQuery] HouseProjectInfoInput input);
}
}