92 lines
2.7 KiB
C#
92 lines
2.7 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.Custom.GoodsCollections;
|
|
using ARW.Service.Business.IBusinessService.Custom.GoodsCollections;
|
|
using ARW.Model.Dto.Business.Custom.GoodsCollections;
|
|
using ARW.Model.Models.Business.Custom.GoodsCollections;
|
|
using ARW.Model.Vo.Business.Custom.GoodsCollections;
|
|
|
|
namespace ARW.Service.Business.BusinessService.Custom.GoodsCollections
|
|
{
|
|
/// <summary>
|
|
/// 商品收藏接口实现类
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-22
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IGoodsCollectionService), ServiceLifetime = LifeTime.Transient)]
|
|
public class GoodsCollectionServiceImpl : BaseService<GoodsCollection>, IGoodsCollectionService
|
|
{
|
|
private readonly GoodsCollectionRepository _GoodsCollectionRepository;
|
|
|
|
public GoodsCollectionServiceImpl(GoodsCollectionRepository GoodsCollectionRepository)
|
|
{
|
|
this._GoodsCollectionRepository = GoodsCollectionRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询商品收藏分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<GoodsCollectionVo>> GetGoodsCollectionList(GoodsCollectionQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<GoodsCollection>();
|
|
|
|
var query = _GoodsCollectionRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Create_time,OrderByType.Desc)
|
|
.Select(s => new GoodsCollectionVo
|
|
{
|
|
GoodsCollectionId = s.GoodsCollectionId,
|
|
GoodsCollectionGuid = s.GoodsCollectionGuid,
|
|
CustomerGuid = s.CustomerGuid,
|
|
GoodsGuid = s.GoodsGuid,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改商品收藏
|
|
/// </summary>
|
|
public async Task<string> AddOrUpdateGoodsCollection(GoodsCollection model)
|
|
{
|
|
if (model.GoodsCollectionId != 0)
|
|
{
|
|
var response = await _GoodsCollectionRepository.UpdateAsync(model);
|
|
return "修改成功!";
|
|
}
|
|
else
|
|
{
|
|
|
|
var response = await _GoodsCollectionRepository.InsertReturnSnowflakeIdAsync(model);
|
|
return "添加成功!";
|
|
}
|
|
}
|
|
|
|
#region Excel处理
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|