using Infrastructure.Attribute; using Microsoft.AspNetCore.Http; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Infrastructure; using ARW.Model; using ARW.Repository; using ARW.Repository.Business.OrderManage.OrderCustomerAddreses; using ARW.Service.Business.IBusinessService.OrderManage.OrderCustomerAddreses; using ARW.Model.Dto.Business.OrderManage.OrderCustomerAddreses; using ARW.Model.Models.Business.OrderManage.OrderCustomerAddreses; using ARW.Model.Vo.Business.OrderManage.OrderCustomerAddreses; namespace ARW.Service.Business.BusinessService.OrderManage.OrderCustomerAddreses { /// /// 订单收货地址记录接口实现类 /// /// @author lwh /// @date 2023-08-29 /// [AppService(ServiceType = typeof(IOrderCustomerAddressService), ServiceLifetime = LifeTime.Transient)] public class OrderCustomerAddressServiceImpl : BaseService, IOrderCustomerAddressService { private readonly OrderCustomerAddressRepository _OrderCustomerAddressRepository; public OrderCustomerAddressServiceImpl(OrderCustomerAddressRepository OrderCustomerAddressRepository) { this._OrderCustomerAddressRepository = OrderCustomerAddressRepository; } #region 业务逻辑代码 /// /// 查询订单收货地址记录分页列表 /// public async Task> GetOrderCustomerAddressList(OrderCustomerAddressQueryDto parm) { //开始拼装查询条件d var predicate = Expressionable.Create(); var query = _OrderCustomerAddressRepository .Queryable() .Where(predicate.ToExpression()) .OrderBy(s => s.Update_time,OrderByType.Desc) .Select(s => new OrderCustomerAddressVo { OrderCustomerAddressId = s.OrderCustomerAddressId, OrderCustomerAddressGuid = s.OrderCustomerAddressGuid, OrderGuid = s.OrderGuid, CustomerGuid = s.CustomerGuid, CustomerAddressGuid = s.CustomerAddressGuid, ConsigneeName = s.ConsigneeName, Phont = s.Phont, ProvinceId = s.ProvinceId, CityId = s.CityId, RegionId = s.RegionId, Detail = s.Detail, }); return await query.ToPageAsync(parm); } /// /// 添加或修改订单收货地址记录 /// public async Task AddOrUpdateOrderCustomerAddress(OrderCustomerAddress model) { if (model.OrderCustomerAddressId != 0) { var response = await _OrderCustomerAddressRepository.UpdateAsync(model); return "修改成功!"; } else { var response = await _OrderCustomerAddressRepository.InsertReturnSnowflakeIdAsync(model); return "添加成功!"; } } #region Excel处理 #endregion #endregion } }