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 = "BookingCtnDetail", Order = 1)] public class BookingCtnDetailService : IBookingCtnDetailService, IDynamicApiController, ITransient { private readonly SqlSugarRepository _rep; public BookingCtnDetailService(SqlSugarRepository rep) { _rep = rep; } /// /// 分页查询多品名 /// /// /// [HttpGet("/BookingCtnDetail/page")] public async Task Page([FromQuery] QueryBookingCtnDetailInput input) { var entities = await _rep.AsQueryable() .WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS) .WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE == input.HSCODE) .WhereIF(!string.IsNullOrWhiteSpace(input.MARKS), u => u.MARKS == input.MARKS) .WhereIF(!string.IsNullOrWhiteSpace(input.DESCRIPTION), u => u.DESCRIPTION == input.DESCRIPTION) .WhereIF(!string.IsNullOrWhiteSpace(input.REMARK), u => u.REMARK == input.REMARK) .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } /// /// 增加多品名 /// /// /// [HttpPost("/BookingCtnDetail/add")] public async Task Add(AddBookingCtnDetailInput input) { var entity = input.Adapt(); await _rep.InsertAsync(entity); } /// /// 更新多品名 /// /// /// [HttpPost("/BookingCtnDetail/edit")] public async Task Update(UpdateBookingCtnDetailInput input) { var entity = input.Adapt(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync(); } /// /// 删除多品名 /// /// /// [HttpPost("/BookingCtnDetail/delete")] public async Task Delete(GetBookingCtnDetailInput input) { var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); await _rep.DeleteAsync(entity); } /// /// 获取多品名 /// /// /// [HttpGet("/BookingCtnDetail/detail")] public async Task Get([FromQuery] GetBookingCtnDetailInput input) { return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); } ///// ///// 获取多品名列表 ///// ///// ///// //[HttpGet("/BookingCtnDetail/list")] //public async Task List([FromQuery] QueryBookingCtnDetailInput input) //{ // return await _rep.ToListAsync(); //} } }