using Myshipping.Core; using Furion.DependencyInjection; using Furion.DynamicApiController; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; using System.Linq; using System.Threading.Tasks; using Myshipping.Application.Entity; namespace Myshipping.Application { /// /// 箱信息服务 /// [ApiDescriptionSettings("Application",Name = "BookingCtn", Order = 1)] public class BookingCtnService : IBookingCtnService, IDynamicApiController, ITransient { private readonly SqlSugarRepository _rep; public BookingCtnService(SqlSugarRepository rep) { _rep = rep; } /// /// 分页查询箱信息 /// /// /// [HttpGet("/BookingCtn/page")] public async Task Page([FromQuery] QueryBookingCtnInput input) { var entities = await _rep.AsQueryable() .WhereIF(!string.IsNullOrWhiteSpace(input.CTNALL), u => u.CTNALL == input.CTNALL) .WhereIF(!string.IsNullOrWhiteSpace(input.CNTRNO), u => u.CNTRNO == input.CNTRNO) .WhereIF(!string.IsNullOrWhiteSpace(input.SEALNO), u => u.SEALNO == input.SEALNO) .WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS) .WhereIF(!string.IsNullOrWhiteSpace(input.CTNSTATUS), u => u.CTNSTATUS == input.CTNSTATUS) .WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHTYPE), u => u.WEIGHTYPE == input.WEIGHTYPE) .WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHATTN), u => u.WEIGHATTN == input.WEIGHATTN) .WhereIF(!string.IsNullOrWhiteSpace(input.VGMCONNCOM), u => u.VGMCONNCOM == input.VGMCONNCOM) .WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHTEL), u => u.WEIGHTEL == input.WEIGHTEL) .WhereIF(!string.IsNullOrWhiteSpace(input.WEIGHDATE), u => u.WEIGHDATE == input.WEIGHDATE) .WhereIF(!string.IsNullOrWhiteSpace(input.VGMADDR), u => u.VGMADDR == input.VGMADDR) .WhereIF(!string.IsNullOrWhiteSpace(input.VGMEMAIL), u => u.VGMEMAIL == input.VGMEMAIL) .WhereIF(!string.IsNullOrWhiteSpace(input.REMARK), u => u.REMARK == input.REMARK) .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } /// /// 增加箱信息 /// /// /// [HttpPost("/BookingCtn/add")] public async Task Add(AddBookingCtnInput input) { var entity = input.Adapt(); await _rep.InsertAsync(entity); } /// /// 更新箱信息 /// /// /// [HttpPost("/BookingCtn/edit")] public async Task Update(UpdateBookingCtnInput input) { var entity = input.Adapt(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync(); } /// /// 删除箱信息 /// /// /// [HttpPost("/BookingCtn/delete")] public async Task Delete(GetBookingCtnInput input) { var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); await _rep.DeleteAsync(entity); } /// /// 获取箱信息 /// /// /// [HttpGet("/BookingCtn/detail")] public async Task Get([FromQuery] GetBookingCtnInput input) { return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); } ///// ///// 获取箱信息列表 ///// ///// ///// //[HttpGet("/BookingCtn/list")] //public async Task List([FromQuery] QueryBookingCtnInput input) //{ // return await _rep.ToListAsync(); //} } }