init 初始化商品规格表
This commit is contained in:
parent
88e0b69c5a
commit
deb0903339
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
|
||||
namespace ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.GoodsSkus
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格输入对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsSkuDto
|
||||
{
|
||||
|
||||
public int GoodsSkuId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "商品guid不能为空")]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "规格值ID不能为空")]
|
||||
public int SpecValueId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "图片不能为空")]
|
||||
public string GoodsSkuImg { get; set; }
|
||||
|
||||
public string GoodsSkuSkuCode { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "价格不能为空")]
|
||||
public decimal GoodsSkuPrice { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "划线价格不能为空")]
|
||||
public decimal GoodsSkuLinePrice { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "当前库存数量不能为空")]
|
||||
public int GoodsSkuStockNum { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "商品重量(Kg)不能为空")]
|
||||
public decimal GoodsSkuWeight { get; set; }
|
||||
|
||||
public string GoodsSkuProps { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品规格查询对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsSkuQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
|
||||
namespace ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.GoodsSpecRels
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品与规格值关系记录输入对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsSpecRelDto
|
||||
{
|
||||
|
||||
public int GoodsSpecRelId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "商品Guid不能为空")]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "规格组ID不能为空")]
|
||||
public int SpecId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "规格值ID不能为空")]
|
||||
public int SpecValueId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品与规格值关系记录查询对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsSpecRelQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格,数据实体对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[SugarTable("tb_goods_sku")]
|
||||
public class GoodsSku : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_sku_id")]
|
||||
public int GoodsSkuId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "goods_guid")]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :规格值ID
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "spec_value_id")]
|
||||
public int SpecValueId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :图片
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "goods_sku_img")]
|
||||
public string GoodsSkuImg { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :sku编码
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "goods_sku_sku_code")]
|
||||
public string GoodsSkuSkuCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :价格
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "goods_sku_price")]
|
||||
public decimal GoodsSkuPrice { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :划线价格
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "goods_sku_line_price")]
|
||||
public decimal GoodsSkuLinePrice { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :当前库存数量
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "goods_sku_stock_num")]
|
||||
public int GoodsSkuStockNum { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品重量(Kg)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "goods_sku_weight")]
|
||||
public decimal GoodsSkuWeight { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :SKU的规格属性(json格式)
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "goods_sku_props")]
|
||||
public string GoodsSkuProps { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSpecRels
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品与规格值关系记录,数据实体对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[SugarTable("tb_goods_spec_rel")]
|
||||
public class GoodsSpecRel : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_spec_rel_id")]
|
||||
public int GoodsSpecRelId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品Guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "goods_guid")]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :规格组ID
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "spec_id")]
|
||||
public int SpecId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :规格值ID
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "spec_value_id")]
|
||||
public int SpecValueId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSkus
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格展示对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsSkuVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
public int GoodsSkuId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :规格值ID
|
||||
/// </summary>
|
||||
public int SpecValueId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :图片
|
||||
/// </summary>
|
||||
public string GoodsSkuImg { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :sku编码
|
||||
/// </summary>
|
||||
public string GoodsSkuSkuCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :价格
|
||||
/// </summary>
|
||||
public decimal GoodsSkuPrice { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :划线价格
|
||||
/// </summary>
|
||||
public decimal GoodsSkuLinePrice { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :当前库存数量
|
||||
/// </summary>
|
||||
public int GoodsSkuStockNum { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品重量(Kg)
|
||||
/// </summary>
|
||||
public decimal GoodsSkuWeight { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :SKU的规格属性(json格式)
|
||||
/// </summary>
|
||||
public string GoodsSkuProps { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSpecRels
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品与规格值关系记录展示对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsSpecRelVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
public int GoodsSpecRelId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品Guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :规格组ID
|
||||
/// </summary>
|
||||
public int SpecId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :规格值ID
|
||||
/// </summary>
|
||||
public int SpecValueId { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
|
||||
namespace ARW.Repository.Business.GoodsManager.GoodsSpecs.GoodsSkus
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格仓储
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class GoodsSkuRepository : BaseRepository<GoodsSku>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
|
||||
namespace ARW.Repository.Business.GoodsManager.GoodsSpecs.GoodsSpecRels
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品与规格值关系记录仓储
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class GoodsSpecRelRepository : BaseRepository<GoodsSpecRel>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
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.GoodsSkus;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
using ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsSpecs.GoodsSkus
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格接口实现类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IGoodsSkuService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class GoodsSkuServiceImpl : BaseService<GoodsSku>, IGoodsSkuService
|
||||
{
|
||||
private readonly GoodsSkuRepository _GoodsSkuRepository;
|
||||
|
||||
public GoodsSkuServiceImpl(GoodsSkuRepository GoodsSkuRepository)
|
||||
{
|
||||
this._GoodsSkuRepository = GoodsSkuRepository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询商品规格分页列表
|
||||
/// </summary>
|
||||
public async Task<PagedInfo<GoodsSkuVo>> GetGoodsSkuList(GoodsSkuQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<GoodsSku>();
|
||||
|
||||
var query = _GoodsSkuRepository
|
||||
.Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.Create_time,OrderByType.Asc)
|
||||
.Select(s => new GoodsSkuVo
|
||||
{
|
||||
GoodsSkuId = s.GoodsSkuId,
|
||||
GoodsGuid = s.GoodsGuid,
|
||||
SpecValueId = s.SpecValueId,
|
||||
GoodsSkuImg = s.GoodsSkuImg,
|
||||
GoodsSkuSkuCode = s.GoodsSkuSkuCode,
|
||||
GoodsSkuPrice = s.GoodsSkuPrice,
|
||||
GoodsSkuLinePrice = s.GoodsSkuLinePrice,
|
||||
GoodsSkuStockNum = s.GoodsSkuStockNum,
|
||||
GoodsSkuWeight = s.GoodsSkuWeight,
|
||||
GoodsSkuProps = s.GoodsSkuProps,
|
||||
});
|
||||
|
||||
|
||||
return await query.ToPageAsync(parm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品规格
|
||||
/// </summary>
|
||||
public async Task<string> AddOrUpdateGoodsSku(GoodsSku model)
|
||||
{
|
||||
if (model.GoodsSkuId != 0)
|
||||
{
|
||||
var response = await _GoodsSkuRepository.UpdateAsync(model);
|
||||
return "修改成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var response = await _GoodsSkuRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
return "添加成功!";
|
||||
}
|
||||
}
|
||||
|
||||
#region Excel处理
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
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.GoodsSpecRels;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
using ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsSpecs.GoodsSpecRels
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品与规格值关系记录接口实现类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IGoodsSpecRelService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class GoodsSpecRelServiceImpl : BaseService<GoodsSpecRel>, IGoodsSpecRelService
|
||||
{
|
||||
private readonly GoodsSpecRelRepository _GoodsSpecRelRepository;
|
||||
|
||||
public GoodsSpecRelServiceImpl(GoodsSpecRelRepository GoodsSpecRelRepository)
|
||||
{
|
||||
this._GoodsSpecRelRepository = GoodsSpecRelRepository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询商品与规格值关系记录分页列表
|
||||
/// </summary>
|
||||
public async Task<PagedInfo<GoodsSpecRelVo>> GetGoodsSpecRelList(GoodsSpecRelQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<GoodsSpecRel>();
|
||||
|
||||
var query = _GoodsSpecRelRepository
|
||||
.Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.Create_time,OrderByType.Desc)
|
||||
.Select(s => new GoodsSpecRelVo
|
||||
{
|
||||
GoodsSpecRelId = s.GoodsSpecRelId,
|
||||
GoodsGuid = s.GoodsGuid,
|
||||
SpecId = s.SpecId,
|
||||
SpecValueId = s.SpecValueId,
|
||||
});
|
||||
|
||||
|
||||
return await query.ToPageAsync(parm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品与规格值关系记录
|
||||
/// </summary>
|
||||
public async Task<string> AddOrUpdateGoodsSpecRel(GoodsSpecRel model)
|
||||
{
|
||||
if (model.GoodsSpecRelId != 0)
|
||||
{
|
||||
var response = await _GoodsSpecRelRepository.UpdateAsync(model);
|
||||
return "修改成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var response = await _GoodsSpecRelRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
return "添加成功!";
|
||||
}
|
||||
}
|
||||
|
||||
#region Excel处理
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -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.GoodsSpecs.GoodsSkus;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.GoodsSkus
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格接口类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public interface IGoodsSkuService : IBaseService<GoodsSku>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取商品规格分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<GoodsSkuVo>> GetGoodsSkuList(GoodsSkuQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品规格
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateGoodsSku(GoodsSku parm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -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.GoodsSpecs.GoodsSpecRels;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSpecRels;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.GoodsSpecRels
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品与规格值关系记录接口类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public interface IGoodsSpecRelService : IBaseService<GoodsSpecRel>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取商品与规格值关系记录分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<GoodsSpecRelVo>> GetGoodsSpecRelList(GoodsSpecRelQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品与规格值关系记录
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateGoodsSpecRel(GoodsSpecRel parm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.SpecValues;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.SpecValues;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.SpecValues;
|
||||
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.SpecValues;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsSpecs.SpecValues
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格值控制器
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/[controller]")]
|
||||
public class SpecValueController : BaseController
|
||||
{
|
||||
private readonly ISpecValueService _SpecValueService;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="SpecValueService">商品规格值服务</param>
|
||||
public SpecValueController(ISpecValueService SpecValueService)
|
||||
{
|
||||
_SpecValueService = SpecValueService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品规格值列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getSpecValueList")]
|
||||
[ActionPermissionFilter(Permission = "business:specvalue:list")]
|
||||
public async Task<IActionResult> GetSpecValueList([FromQuery] SpecValueQueryDto parm)
|
||||
{
|
||||
var res = await _SpecValueService.GetSpecValueList(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品规格值
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addOrUpdateSpecValue")]
|
||||
[ActionPermissionFilter(Permission = "business:specvalue:addOrUpdate")]
|
||||
[Log(Title = "添加或修改商品规格值", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public async Task<IActionResult> AddOrUpdateSpecValue([FromBody] SpecValueDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var modal = new SpecValue();
|
||||
if (parm.SpecValueId != 0) modal = parm.Adapt<SpecValue>().ToUpdate(HttpContext);
|
||||
else modal = parm.Adapt<SpecValue>().ToCreate(HttpContext);
|
||||
|
||||
var res = await _SpecValueService.AddOrUpdateSpecValue(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除商品规格值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:specvalue:delete")]
|
||||
[Log(Title = "商品规格值删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
var response = _SpecValueService.Delete(idsArr);
|
||||
return SUCCESS("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.GoodsManager.GoodsSpecs.Specs;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsSpecs.Specs;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.Specs;
|
||||
using ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.Specs;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsSpecs.Specs
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品规格组控制器
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/[controller]")]
|
||||
public class SpecController : BaseController
|
||||
{
|
||||
private readonly ISpecService _SpecService;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="SpecService">商品规格组服务</param>
|
||||
public SpecController(ISpecService SpecService)
|
||||
{
|
||||
_SpecService = SpecService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品规格组列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getSpecList")]
|
||||
[ActionPermissionFilter(Permission = "business:spec:list")]
|
||||
public async Task<IActionResult> GetSpecList([FromQuery] SpecQueryDto parm)
|
||||
{
|
||||
var res = await _SpecService.GetSpecList(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品规格组
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addOrUpdateSpec")]
|
||||
[ActionPermissionFilter(Permission = "business:spec:addOrUpdate")]
|
||||
[Log(Title = "添加或修改商品规格组", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public async Task<IActionResult> AddOrUpdateSpec([FromBody] SpecDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var modal = new Spec();
|
||||
if (parm.SpecId != 0) modal = parm.Adapt<Spec>().ToUpdate(HttpContext);
|
||||
else modal = parm.Adapt<Spec>().ToCreate(HttpContext);
|
||||
|
||||
var res = await _SpecService.AddOrUpdateSpec(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除商品规格组
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:spec:delete")]
|
||||
[Log(Title = "商品规格组删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
var response = _SpecService.Delete(idsArr);
|
||||
return SUCCESS("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user