self_mall_api/ARW.Service/Business/BusinessService/GoodsManager/GoodsSpecs/Specs/SpecService.cs
2023-06-24 23:21:02 +08:00

86 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 lwh
/// @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>
/// <param name="sepcList">规格组列表</param>
public async Task InsertSpecAsync(List<Spec> sepcList)
{
await _SpecRepository.InsertRangeAsync(sepcList);
}
/// <summary>
/// 更新规格组
/// </summary>
/// <param name="sepcList">规格组列表</param>
/// <returns></returns>
public async Task UpdateSpecAsync(List<Spec> sepcList)
{
await _SpecRepository.UpdateRangeAsync(sepcList);
}
#endregion
}
}