90 lines
2.4 KiB
C#
90 lines
2.4 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.Specs;
|
|
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.Specs;
|
|
using ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.Specs;
|
|
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.Specs;
|
|
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.Specs;
|
|
|
|
namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsSpecs.Specs
|
|
{
|
|
/// <summary>
|
|
/// 商品规格组接口实现类
|
|
///
|
|
/// @author 黎文豪
|
|
/// @date 2023-06-19
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(ISpecService), ServiceLifetime = LifeTime.Transient)]
|
|
public class SpecServiceImpl : BaseService<Spec>, ISpecService
|
|
{
|
|
private readonly SpecRepository _SpecRepository;
|
|
|
|
public SpecServiceImpl(SpecRepository SpecRepository)
|
|
{
|
|
this._SpecRepository = SpecRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询商品规格组分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<SpecVo>> GetSpecList(SpecQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<Spec>();
|
|
|
|
var query = _SpecRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Create_time,OrderByType.Desc)
|
|
.Select(s => new SpecVo
|
|
{
|
|
SpecId = s.SpecId,
|
|
SpecName = s.SpecName,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改商品规格组
|
|
/// </summary>
|
|
public async Task<string> AddOrUpdateSpec(Spec model)
|
|
{
|
|
if (model.SpecId != 0)
|
|
{
|
|
var response = await _SpecRepository.UpdateAsync(model);
|
|
return "修改成功!";
|
|
}
|
|
else
|
|
{
|
|
|
|
var response = await _SpecRepository.InsertReturnSnowflakeIdAsync(model);
|
|
return "添加成功!";
|
|
}
|
|
}
|
|
|
|
#region Excel处理
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|