diff --git a/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs index 33dfdc4..a67025a 100644 --- a/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs @@ -7,6 +7,7 @@ namespace Shentun.Peis.ReportFormatTemplates public class UpdateReportFormatTemplateDto { + public string Id { get; set; } public string ReportFormatId { get; set; } public string DisplayName { get; set; } diff --git a/src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs b/src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs index 31d4c39..d651703 100644 --- a/src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs +++ b/src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs @@ -24,7 +24,7 @@ namespace Shentun.Peis.ReportFormatTemplates private readonly IRepository _userRepository; private readonly IRepository _reportRepository; private readonly IRepository _reportFormatRepository; - private readonly IRepository _reportFormatTemplateRepository; + private readonly IRepository _repository; private readonly ReportFormatTemplateManager _manager; public ReportFormatTemplateAppService( IRepository repository, @@ -33,19 +33,19 @@ namespace Shentun.Peis.ReportFormatTemplates IRepository reportFormatRepository, ReportFormatTemplateManager manager) { + _repository = repository; _userRepository = userRepository; _manager = manager; - _reportFormatTemplateRepository = repository; _reportFormatRepository = reportFormatRepository; _reportRepository = reportRepository; } - [HttpPost("api/app/ReportFormatTemplate/GetReportTemplate")] - public async Task> GetReportTemplateAsync() + [HttpPost("api/app/ReportFormatTemplate/GetDefalutReportTemplates")] + public async Task> GetDefalutReportTemplateAsync() { var query = from a in await _reportFormatRepository.GetQueryableAsync() join b in await _reportRepository.GetQueryableAsync() on a.ReportId equals b.Id into bb from ab in bb.DefaultIfEmpty() - join c in await _reportFormatTemplateRepository.GetQueryableAsync() on a.Id equals c.ReportFormatId into cc + join c in await _repository.GetQueryableAsync() on a.Id equals c.ReportFormatId into cc from ac in cc.DefaultIfEmpty() where (a.IsDefault=='Y' &&ab.IsActive=='Y'&&ac.IsDefault== 'Y') select new @@ -75,12 +75,12 @@ namespace Shentun.Peis.ReportFormatTemplates /// /// 获取通过主键 /// - /// + /// /// [HttpPost("api/app/ReportFormatTemplate/GetById")] public async Task GetByIdAsync(ReportFormatTemplateIdDto input) { - var entity= await _reportFormatTemplateRepository.GetAsync(input.Id); + var entity= await _repository.GetAsync(input.Id); var aEntity = ObjectMapper.Map(entity); var userList = await _userRepository.GetListAsync(); aEntity.IsDefaulted = entity.IsDefault.Equals('Y'); @@ -92,7 +92,7 @@ namespace Shentun.Peis.ReportFormatTemplates [HttpPost("api/app/ReportFormatTemplate/GetMaxId")] public async Task GetMaxIdAsync() { - var ent = (await _reportFormatTemplateRepository.GetListAsync()).Max(x => x.Id); + var ent = (await _repository.GetListAsync()).Max(x => x.Id); var entdto = new ReportFormatTemplateDto { Id = !string.IsNullOrEmpty(ent)?ent:"0001" @@ -100,9 +100,9 @@ namespace Shentun.Peis.ReportFormatTemplates return entdto; } [HttpPost("api/app/ReportFormatTemplate/GetDefault")] - public async Task GetDefaultAsync(string formatId) + public async Task GetDefaultAsync(ReportFormatIdInputDto input) { - var ent = await _manager.GetDefaultAsync(formatId); + var ent = await _manager.GetDefaultAsync(input.Id); if (ent != null) { @@ -143,7 +143,7 @@ namespace Shentun.Peis.ReportFormatTemplates [HttpPost("api/app/ReportFormatTemplate/GetList")] public async Task> GetListAsync(PagedAndSortedResultRequestDto input) { - var reportList = await _reportFormatTemplateRepository.GetListAsync(); + var reportList = await _repository.GetListAsync(); List templates = new List(); @@ -170,7 +170,7 @@ namespace Shentun.Peis.ReportFormatTemplates public async Task> GetListByReportFormatIdAsync(ReportFormatIdInputDto input) { int totalCount = 0; - var entlist = (await _reportFormatTemplateRepository.GetListAsync()).Where(m => m.ReportFormatId == input.Id); + var entlist = (await _repository.GetListAsync()).Where(m => m.ReportFormatId == input.Id); totalCount = entlist.Count(); var userList = await _userRepository.GetListAsync(); @@ -208,7 +208,7 @@ namespace Shentun.Peis.ReportFormatTemplates { var createEntity = ObjectMapper.Map(input); var entity = await _manager.CreateAsync(createEntity); - entity = await _reportFormatTemplateRepository.InsertAsync(entity); + entity = await _repository.InsertAsync(entity); var dto = ObjectMapper.Map(entity); return dto; } @@ -216,7 +216,7 @@ namespace Shentun.Peis.ReportFormatTemplates public async Task CopyCreateAsync(CopyCreateReportFormatTemplateDto input) { var entity = await _manager.CopyCreateAsync(input.Id, input.NewId); - entity = await _reportFormatTemplateRepository.InsertAsync(entity); + entity = await _repository.InsertAsync(entity); var dto = ObjectMapper.Map(entity); return dto; } @@ -228,13 +228,13 @@ namespace Shentun.Peis.ReportFormatTemplates /// /// [HttpPost("api/app/ReportFormatTemplate/Update")] - public async Task UpdateAsync(string id, UpdateReportFormatTemplateDto input) + public async Task UpdateAsync(UpdateReportFormatTemplateDto input) { - var entity = await _reportFormatTemplateRepository.GetAsync(id); + var entity = await _repository.GetAsync(input.Id); var userList = await _userRepository.GetListAsync(); var sourceEntity = ObjectMapper.Map(input); await _manager.UpdateAsync(sourceEntity, entity); - entity = await _reportFormatTemplateRepository.UpdateAsync(entity); + entity = await _repository.UpdateAsync(entity); var dto= ObjectMapper.Map(entity); dto.IsDefaulted = entity.IsDefault.Equals('Y'); dto.IsSystemed= entity.IsSystem.Equals('Y'); @@ -250,10 +250,10 @@ namespace Shentun.Peis.ReportFormatTemplates [HttpPost("api/app/ReportFormatTemplate/Delete")] public Task DeleteAsync(ReportFormatIdInputDto input) { - return _reportFormatTemplateRepository.DeleteAsync(input.Id); + return _repository.DeleteAsync(input.Id); } - [HttpPut("api/app/reportfomattemplate/updatedefault")] + [HttpPost("api/app/reportfomattemplate/UpdateDefault")] public async Task UpdateDefaultAsync(ReportFormatIdInputDto input) { await _manager.UpdateDefaultAsync(input.Id); diff --git a/src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs b/src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs index 5eb668d..d5eeb53 100644 --- a/src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs +++ b/src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs @@ -61,9 +61,9 @@ namespace Shentun.Peis.ReportFormats return entdto; } [HttpPost("api/app/ReportFormat/GetDefault")] - public async Task GetDefaultAsync(string reportId) + public async Task GetDefaultAsync(ReportIdInputDto input) { - var ent = await _manager.GetDefaultAsync(reportId); + var ent = await _manager.GetDefaultAsync(input.Id); if (ent!=null) { @@ -196,7 +196,7 @@ namespace Shentun.Peis.ReportFormats return _repository.DeleteAsync(input.Id); } - [HttpPut("api/app/ReportFormat/UpdateDefault")] + [HttpPost("api/app/ReportFormat/UpdateDefault")] public async Task UpdateDefaultAsync(ReportFormatIdInputDto input) { await _manager.UpdateDefaultAsync(input.Id);