93 lines
2.9 KiB
C#
93 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.Model.Dto.Business.GoodsManager.GoodsServicess.GoodsServicesRels;
|
|
using ARW.Model.Models.Business.GoodsManager.GoodsServicess.GoodsServicesRels;
|
|
using ARW.Model.Vo.Business.GoodsManager.GoodsServicess.GoodsServicesRels;
|
|
using ARW.Repository.Business.GoodsManager.GoodsServicess.GoodsServicesRels;
|
|
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsServicess.GoodsServicesRels;
|
|
|
|
namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsServicess.GoodsServicesRels
|
|
{
|
|
/// <summary>
|
|
/// 商品服务与承诺关系表接口实现类
|
|
///
|
|
/// @author 黎文豪
|
|
/// @date 2023-06-18
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IGoodsServicesRelService), ServiceLifetime = LifeTime.Transient)]
|
|
public class GoodsServicesRelServiceImpl : BaseService<GoodsServicesRel>, IGoodsServicesRelService
|
|
{
|
|
private readonly GoodsServicesRelRepository _GoodsServicesRelRepository;
|
|
|
|
public GoodsServicesRelServiceImpl(GoodsServicesRelRepository GoodsServicesRelRepository)
|
|
{
|
|
_GoodsServicesRelRepository = GoodsServicesRelRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询商品服务与承诺关系表分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<GoodsServicesRelVo>> GetGoodsServicesRelList(GoodsServicesRelQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<GoodsServicesRel>();
|
|
|
|
var query = _GoodsServicesRelRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
|
.Select(s => new GoodsServicesRelVo
|
|
{
|
|
Id = s.Id,
|
|
Guid = s.Guid,
|
|
ShopGuid = s.ShopGuid,
|
|
GoodsGuid = s.GoodsGuid,
|
|
ServiceGuid = s.ServiceGuid,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改商品服务与承诺关系表
|
|
/// </summary>
|
|
public async Task<string> AddOrUpdateGoodsServicesRel(GoodsServicesRel model)
|
|
{
|
|
if (model.Id != 0)
|
|
{
|
|
var response = await _GoodsServicesRelRepository.UpdateAsync(model);
|
|
return "修改成功!";
|
|
}
|
|
else
|
|
{
|
|
|
|
var response = await _GoodsServicesRelRepository.InsertReturnSnowflakeIdAsync(model);
|
|
return "添加成功!";
|
|
}
|
|
}
|
|
|
|
#region Excel处理
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|