wanggang
1 year ago
2 changed files with 83 additions and 0 deletions
@ -0,0 +1,82 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Dynamic.Core; |
||||
|
using System.Threading.Tasks; |
||||
|
using EFCore.BulkExtensions; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Omu.ValueInjecter; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
||||
|
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
||||
|
using Win.Sfs.SettleAccount.Entities.Materials; |
||||
|
using Win.Sfs.Shared.RepositoryBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ; |
||||
|
|
||||
|
[Route("api/settleaccount/[controller]/[action]")]
|
||||
|
public class JobItemAppService : SettleAccountApplicationBase<Material> |
||||
|
{ |
||||
|
private readonly INormalEfCoreRepository<JobItem, Guid> _repository; |
||||
|
|
||||
|
public JobItemAppService(INormalEfCoreRepository<JobItem, Guid> repository) |
||||
|
{ |
||||
|
this._repository = repository; |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
public async Task<PagedResultDto<JobItem>> GetListAsync(RequestDto input) |
||||
|
{ |
||||
|
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, |
||||
|
input.SkipCount, true).ConfigureAwait(false); |
||||
|
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); |
||||
|
return new PagedResultDto<JobItem>(totalCount, entities); |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
public async Task<JobItem> CreateAsync(JobItem input) |
||||
|
{ |
||||
|
await _repository.InsertAsync(input).ConfigureAwait(false); |
||||
|
return input; |
||||
|
} |
||||
|
|
||||
|
[HttpPost("{id}")] |
||||
|
public async Task<JobItem> UpdateAsync(Guid id, JobItem input) |
||||
|
{ |
||||
|
var entity = await _repository.FindAsync(id).ConfigureAwait(false); |
||||
|
if (entity != null) |
||||
|
{ |
||||
|
entity.InjectFrom(input); |
||||
|
} |
||||
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
||||
|
return input; |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
public async Task<bool> DeleteListAsync(List<Guid> ids) |
||||
|
{ |
||||
|
var _query = _repository.Where(p => ids.Contains(p.Id)); |
||||
|
int i = await _query.BatchDeleteAsync().ConfigureAwait(false); |
||||
|
return i == 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
[Route("api/settleaccount/[controller]/[action]")]
|
||||
|
public class JobLogAppService : SettleAccountApplicationBase<Material> |
||||
|
{ |
||||
|
private readonly INormalEfCoreRepository<JobLog, Guid> _repository; |
||||
|
|
||||
|
public JobLogAppService(INormalEfCoreRepository<JobLog, Guid> repository) |
||||
|
{ |
||||
|
this._repository = repository; |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
public async Task<PagedResultDto<JobLog>> GetListAsync(RequestDto input) |
||||
|
{ |
||||
|
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, |
||||
|
input.SkipCount, true).ConfigureAwait(false); |
||||
|
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); |
||||
|
return new PagedResultDto<JobLog>(totalCount, entities); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue