96 lines
2.8 KiB
C#
96 lines
2.8 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.OrderGoodss;
|
|
using ARW.Service.Business.IBusinessService.OrderManage.OrderGoodss;
|
|
using ARW.Model.Dto.Business.OrderManage.OrderGoodss;
|
|
using ARW.Model.Models.Business.OrderManage.OrderGoodss;
|
|
using ARW.Model.Vo.Business.OrderManage.OrderGoodss;
|
|
|
|
namespace ARW.Service.Business.BusinessService.OrderManage.OrderGoodss
|
|
{
|
|
/// <summary>
|
|
/// 订单商品记录接口实现类
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-09-01
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IOrderGoodsService), ServiceLifetime = LifeTime.Transient)]
|
|
public class OrderGoodsServiceImpl : BaseService<OrderGoods>, IOrderGoodsService
|
|
{
|
|
private readonly OrderGoodsRepository _OrderGoodsRepository;
|
|
|
|
public OrderGoodsServiceImpl(OrderGoodsRepository OrderGoodsRepository)
|
|
{
|
|
this._OrderGoodsRepository = OrderGoodsRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询订单商品记录分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<OrderGoodsVo>> GetOrderGoodsList(OrderGoodsQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<OrderGoods>();
|
|
|
|
var query = _OrderGoodsRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Update_time,OrderByType.Desc)
|
|
.Select(s => new OrderGoodsVo
|
|
{
|
|
OrderGoodsId = s.OrderGoodsId,
|
|
OrderGoodsGuid = s.OrderGoodsGuid,
|
|
OrderGuid = s.OrderGuid,
|
|
GoodsGuid = s.GoodsGuid,
|
|
GoodsSkuId = s.GoodsSkuId,
|
|
GoodsPrice = s.GoodsPrice,
|
|
GoodsTotalNum = s.GoodsTotalNum,
|
|
GoodsTotalAmoun = s.GoodsTotalAmoun,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改订单商品记录
|
|
/// </summary>
|
|
public async Task<string> AddOrUpdateOrderGoods(OrderGoods model)
|
|
{
|
|
if (model.OrderGoodsId != 0)
|
|
{
|
|
var response = await _OrderGoodsRepository.UpdateAsync(model);
|
|
return "修改成功!";
|
|
}
|
|
else
|
|
{
|
|
|
|
var response = await _OrderGoodsRepository.InsertReturnSnowflakeIdAsync(model);
|
|
return "添加成功!";
|
|
}
|
|
}
|
|
|
|
#region Excel处理
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|