init 初始化商品服务与承诺关系

This commit is contained in:
lwh 2023-06-18 17:11:01 +08:00
parent 494238f351
commit d92eafb858
6 changed files with 325 additions and 0 deletions

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using ARW.Model.Models.Business.GoodsManager.GoodsServicesRels;
namespace ARW.Model.Dto.Business.GoodsManager.GoodsServicesRels
{
/// <summary>
/// 商品服务与承诺关系表输入对象
///
/// @author 黎文豪
/// @date 2023-06-18
/// </summary>
public class GoodsServicesRelDto
{
public int Id { get; set; }
public long Guid { get; set; }
[Required(ErrorMessage = "店铺guid不能为空")]
public long ShopGuid { get; set; }
[Required(ErrorMessage = "商品guid不能为空")]
public long GoodsGuid { get; set; }
[Required(ErrorMessage = "服务与承诺guid不能为空")]
public long ServiceGuid { get; set; }
}
/// <summary>
/// 商品服务与承诺关系表查询对象
///
/// @author 黎文豪
/// @date 2023-06-18
/// </summary>
public class GoodsServicesRelQueryDto : PagerInfo
{
public string ids { get; set; }
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using OfficeOpenXml.Attributes;
using Newtonsoft.Json;
namespace ARW.Model.Models.Business.GoodsManager.GoodsServicesRels
{
/// <summary>
/// 商品服务与承诺关系表,数据实体对象
///
/// @author 黎文豪
/// @date 2023-06-18
/// </summary>
[SugarTable("tb_goods_services_rel")]
public class GoodsServicesRel : BusinessBase
{
/// <summary>
/// 描述 :
/// 空值 : false
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 描述 :
/// 空值 : false
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
public long Guid { get; set; }
/// <summary>
/// 描述 :店铺guid
/// 空值 : false
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName = "shop_guid")]
public long ShopGuid { get; set; }
/// <summary>
/// 描述 :商品guid
/// 空值 : false
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName = "goods_guid")]
public long GoodsGuid { get; set; }
/// <summary>
/// 描述 :服务与承诺guid
/// 空值 : false
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName = "service_guid")]
public long ServiceGuid { get; set; }
}
}

View File

@ -0,0 +1,52 @@
using Newtonsoft.Json;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
namespace ARW.Model.Vo.Business.GoodsManager.GoodsServicesRels
{
/// <summary>
/// 商品服务与承诺关系表展示对象
///
/// @author 黎文豪
/// @date 2023-06-18
/// </summary>
public class GoodsServicesRelVo
{
/// <summary>
/// 描述 :
/// </summary>
public int Id { get; set; }
/// <summary>
/// 描述 :
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
public long Guid { get; set; }
/// <summary>
/// 描述 :店铺guid
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
public long ShopGuid { get; set; }
/// <summary>
/// 描述 :商品guid
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
public long GoodsGuid { get; set; }
/// <summary>
/// 描述 :服务与承诺guid
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
public long ServiceGuid { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using System;
using Infrastructure.Attribute;
using ARW.Repository.System;
using ARW.Model.Models.Business.GoodsManager.GoodsServicesRels;
namespace ARW.Repository.Business.GoodsManager.GoodsServicesRels
{
/// <summary>
/// 商品服务与承诺关系表仓储
///
/// @author 黎文豪
/// @date 2023-06-18
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class GoodsServicesRelRepository : BaseRepository<GoodsServicesRel>
{
#region
#endregion
}
}

View File

@ -0,0 +1,92 @@
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.GoodsServicesRels;
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsServicesRels;
using ARW.Model.Dto.Business.GoodsManager.GoodsServicesRels;
using ARW.Model.Models.Business.GoodsManager.GoodsServicesRels;
using ARW.Model.Vo.Business.GoodsManager.GoodsServicesRels;
namespace ARW.Service.Business.BusinessService.GoodsManager.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)
{
this._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.GoodsServicesRelId != 0)
{
var response = await _GoodsServicesRelRepository.UpdateAsync(model);
return "修改成功!";
}
else
{
var response = await _GoodsServicesRelRepository.InsertReturnSnowflakeIdAsync(model);
return "添加成功!";
}
}
#region Excel处理
#endregion
#endregion
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ARW.Model;
using ARW.Model.Dto.Business.GoodsManager.GoodsServicesRels;
using ARW.Model.Models.Business.GoodsManager.GoodsServicesRels;
using ARW.Model.Vo.Business.GoodsManager.GoodsServicesRels;
namespace ARW.Service.Business.IBusinessService.GoodsManager.GoodsServicesRels
{
/// <summary>
/// 商品服务与承诺关系表接口类
///
/// @author 黎文豪
/// @date 2023-06-18
/// </summary>
public interface IGoodsServicesRelService : IBaseService<GoodsServicesRel>
{
/// <summary>
/// 获取商品服务与承诺关系表分页列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
Task<PagedInfo<GoodsServicesRelVo>> GetGoodsServicesRelList(GoodsServicesRelQueryDto parm);
/// <summary>
/// 添加或修改商品服务与承诺关系表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
Task<string> AddOrUpdateGoodsServicesRel(GoodsServicesRel parm);
}
}