|
@@ -17,7 +17,7 @@ using ZhonTai.Admin.Domain.Project;
|
|
using ZhonTai.Admin.Services.Project.Dto;
|
|
using ZhonTai.Admin.Services.Project.Dto;
|
|
|
|
|
|
namespace ZhonTai.Admin.Services.Project
|
|
namespace ZhonTai.Admin.Services.Project
|
|
-{
|
|
|
|
|
|
+{
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 项目服务
|
|
/// 项目服务
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -25,9 +25,13 @@ namespace ZhonTai.Admin.Services.Project
|
|
[DynamicApi(Area = AdminConsts.AreaName)]
|
|
[DynamicApi(Area = AdminConsts.AreaName)]
|
|
public partial class ProjectService : BaseService, IProjectService, IDynamicApi
|
|
public partial class ProjectService : BaseService, IProjectService, IDynamicApi
|
|
{
|
|
{
|
|
- private IProjectRepository _projectRepository => LazyGetRequiredService<IProjectRepository>();
|
|
|
|
- public ProjectService()
|
|
|
|
|
|
+ private readonly IProjectRepository _projectRepository ;
|
|
|
|
+ private readonly IProjectPriceRepository _projectPriceRepository;
|
|
|
|
+
|
|
|
|
+ public ProjectService(IProjectRepository projectRepository, IProjectPriceRepository projectPriceRepository)
|
|
{
|
|
{
|
|
|
|
+ _projectRepository = projectRepository;
|
|
|
|
+ _projectPriceRepository = projectPriceRepository;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 查询分页
|
|
/// 查询分页
|
|
@@ -36,27 +40,16 @@ namespace ZhonTai.Admin.Services.Project
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[HttpPost]
|
|
public async Task<PageOutput<ProjectGetPageOutput>> GetPageAsync(PageInput<ProjectGetPageInput> input)
|
|
public async Task<PageOutput<ProjectGetPageOutput>> GetPageAsync(PageInput<ProjectGetPageInput> input)
|
|
- {
|
|
|
|
- var list = await _projectRepository.Select
|
|
|
|
|
|
+ {
|
|
|
|
+ string keywords = input?.Filter.Keywrods;
|
|
|
|
+ int? status = input?.Filter?.Status;
|
|
|
|
+ var list = await _projectRepository.Select
|
|
|
|
+ .WhereIf(keywords.NotNull(), (m) => m.Name.Contains(keywords))
|
|
|
|
+ .WhereIf(status != null && status > 0, (m) => m.Status == status)
|
|
.Count(out var total)
|
|
.Count(out var total)
|
|
- .OrderByDescending(true, a => a.Id)
|
|
|
|
|
|
+ .OrderByDescending(true, a => a.Id)
|
|
.Page(input.CurrentPage, input.PageSize)
|
|
.Page(input.CurrentPage, input.PageSize)
|
|
- .ToListAsync(a => new ProjectGetPageOutput { name = a.name });
|
|
|
|
-
|
|
|
|
- //if (orgId.HasValue && orgId > 0)
|
|
|
|
- //{
|
|
|
|
- // var managerUserIds = await _userOrgRepository.Select
|
|
|
|
- // .Where(a => a.OrgId == orgId && a.IsManager == true).ToListAsync(a => a.UserId);
|
|
|
|
-
|
|
|
|
- // if (managerUserIds.Any())
|
|
|
|
- // {
|
|
|
|
- // var managerUsers = list.Where(a => managerUserIds.Contains(a.Id));
|
|
|
|
- // foreach (var managerUser in managerUsers)
|
|
|
|
- // {
|
|
|
|
- // managerUser.IsManager = true;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
+ .ToListAsync<ProjectGetPageOutput>();
|
|
|
|
|
|
var data = new PageOutput<ProjectGetPageOutput>()
|
|
var data = new PageOutput<ProjectGetPageOutput>()
|
|
{
|
|
{
|
|
@@ -66,5 +59,20 @@ namespace ZhonTai.Admin.Services.Project
|
|
|
|
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 添加项目
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="input"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpPost]
|
|
|
|
+ public async Task<long> AddAsync(ProjectGetPageInput input)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ //添加项目
|
|
|
|
+
|
|
|
|
+ //添加项目价格
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|