emoticon_api/ARW.Service/Business/BusinessService/OrderManage/OrderCustomerAddreses/OrderCustomerAddressService.cs

99 lines
3.2 KiB
C#

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
{
/// <summary>
/// 订单收货地址记录接口实现类
///
/// @author lwh
/// @date 2023-08-29
/// </summary>
[AppService(ServiceType = typeof(IOrderCustomerAddressService), ServiceLifetime = LifeTime.Transient)]
public class OrderCustomerAddressServiceImpl : BaseService<OrderCustomerAddress>, IOrderCustomerAddressService
{
private readonly OrderCustomerAddressRepository _OrderCustomerAddressRepository;
public OrderCustomerAddressServiceImpl(OrderCustomerAddressRepository OrderCustomerAddressRepository)
{
this._OrderCustomerAddressRepository = OrderCustomerAddressRepository;
}
#region
/// <summary>
/// 查询订单收货地址记录分页列表
/// </summary>
public async Task<PagedInfo<OrderCustomerAddressVo>> GetOrderCustomerAddressList(OrderCustomerAddressQueryDto parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<OrderCustomerAddress>();
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);
}
/// <summary>
/// 添加或修改订单收货地址记录
/// </summary>
public async Task<string> 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
}
}