98 lines
2.9 KiB
C#
98 lines
2.9 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.GoodsManager.GoodsSpecs.GoodsSkus;
|
|
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.GoodsSkus;
|
|
using ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
|
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
|
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
|
|
|
namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsSpecs.GoodsSkus
|
|
{
|
|
/// <summary>
|
|
/// 商品规格接口实现类
|
|
///
|
|
/// @author 黎文豪
|
|
/// @date 2023-06-19
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IGoodsSkuService), ServiceLifetime = LifeTime.Transient)]
|
|
public class GoodsSkuServiceImpl : BaseService<GoodsSku>, IGoodsSkuService
|
|
{
|
|
private readonly GoodsSkuRepository _GoodsSkuRepository;
|
|
|
|
public GoodsSkuServiceImpl(GoodsSkuRepository GoodsSkuRepository)
|
|
{
|
|
this._GoodsSkuRepository = GoodsSkuRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询商品规格分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<GoodsSkuVo>> GetGoodsSkuList(GoodsSkuQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<GoodsSku>();
|
|
|
|
var query = _GoodsSkuRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Create_time,OrderByType.Asc)
|
|
.Select(s => new GoodsSkuVo
|
|
{
|
|
GoodsSkuId = s.GoodsSkuId,
|
|
GoodsGuid = s.GoodsGuid,
|
|
SpecValueId = s.SpecValueId,
|
|
GoodsSkuImg = s.GoodsSkuImg,
|
|
GoodsSkuSkuCode = s.GoodsSkuSkuCode,
|
|
GoodsSkuPrice = s.GoodsSkuPrice,
|
|
GoodsSkuLinePrice = s.GoodsSkuLinePrice,
|
|
GoodsSkuStockNum = s.GoodsSkuStockNum,
|
|
GoodsSkuWeight = s.GoodsSkuWeight,
|
|
GoodsSkuProps = s.GoodsSkuProps,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改商品规格
|
|
/// </summary>
|
|
public async Task<string> AddOrUpdateGoodsSku(GoodsSku model)
|
|
{
|
|
if (model.GoodsSkuId != 0)
|
|
{
|
|
var response = await _GoodsSkuRepository.UpdateAsync(model);
|
|
return "修改成功!";
|
|
}
|
|
else
|
|
{
|
|
|
|
var response = await _GoodsSkuRepository.InsertReturnSnowflakeIdAsync(model);
|
|
return "添加成功!";
|
|
}
|
|
}
|
|
|
|
#region Excel处理
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|