diff --git a/ARW.Model/Dto/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuDto.cs b/ARW.Model/Dto/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuDto.cs new file mode 100644 index 0000000..075c02a --- /dev/null +++ b/ARW.Model/Dto/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuDto.cs @@ -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 +{ + /// + /// 商品规格输入对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + 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; } + + + + + + } + + + /// + /// 商品规格查询对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + public class GoodsSkuQueryDto : PagerInfo + { + + public string ids { get; set; } + } + + + + +} diff --git a/ARW.Model/Dto/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelDto.cs b/ARW.Model/Dto/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelDto.cs new file mode 100644 index 0000000..ddf4ecc --- /dev/null +++ b/ARW.Model/Dto/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelDto.cs @@ -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 +{ + /// + /// 商品与规格值关系记录输入对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + 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; } + + + + + + } + + + /// + /// 商品与规格值关系记录查询对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + public class GoodsSpecRelQueryDto : PagerInfo + { + + public string ids { get; set; } + } + + + + +} diff --git a/ARW.Model/Models/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSku.cs b/ARW.Model/Models/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSku.cs new file mode 100644 index 0000000..edf2428 --- /dev/null +++ b/ARW.Model/Models/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSku.cs @@ -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 +{ + /// + /// 商品规格,数据实体对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + [SugarTable("tb_goods_sku")] + public class GoodsSku : BusinessBase + { + + /// + /// 描述 : + /// 空值 : false + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_sku_id")] + public int GoodsSkuId { get; set; } + + + /// + /// 描述 :商品guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "goods_guid")] + public long GoodsGuid { get; set; } + + + /// + /// 描述 :规格值ID + /// 空值 : false + /// + [SugarColumn(ColumnName = "spec_value_id")] + public int SpecValueId { get; set; } + + + /// + /// 描述 :图片 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_sku_img")] + public string GoodsSkuImg { get; set; } + + + /// + /// 描述 :sku编码 + /// 空值 : true + /// + [SugarColumn(ColumnName = "goods_sku_sku_code")] + public string GoodsSkuSkuCode { get; set; } + + + /// + /// 描述 :价格 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_sku_price")] + public decimal GoodsSkuPrice { get; set; } + + + /// + /// 描述 :划线价格 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_sku_line_price")] + public decimal GoodsSkuLinePrice { get; set; } + + + /// + /// 描述 :当前库存数量 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_sku_stock_num")] + public int GoodsSkuStockNum { get; set; } + + + /// + /// 描述 :商品重量(Kg) + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_sku_weight")] + public decimal GoodsSkuWeight { get; set; } + + + /// + /// 描述 :SKU的规格属性(json格式) + /// 空值 : true + /// + [SugarColumn(ColumnName = "goods_sku_props")] + public string GoodsSkuProps { get; set; } + + + + + + + } +} \ No newline at end of file diff --git a/ARW.Model/Models/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRel.cs b/ARW.Model/Models/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRel.cs new file mode 100644 index 0000000..9c2af4d --- /dev/null +++ b/ARW.Model/Models/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRel.cs @@ -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 +{ + /// + /// 商品与规格值关系记录,数据实体对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + [SugarTable("tb_goods_spec_rel")] + public class GoodsSpecRel : BusinessBase + { + + /// + /// 描述 : + /// 空值 : false + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_spec_rel_id")] + public int GoodsSpecRelId { get; set; } + + + /// + /// 描述 :商品Guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "goods_guid")] + public long GoodsGuid { get; set; } + + + /// + /// 描述 :规格组ID + /// 空值 : false + /// + [SugarColumn(ColumnName = "spec_id")] + public int SpecId { get; set; } + + + /// + /// 描述 :规格值ID + /// 空值 : false + /// + [SugarColumn(ColumnName = "spec_value_id")] + public int SpecValueId { get; set; } + + + + + + + } +} \ No newline at end of file diff --git a/ARW.Model/Vo/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuVo.cs b/ARW.Model/Vo/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuVo.cs new file mode 100644 index 0000000..bc39143 --- /dev/null +++ b/ARW.Model/Vo/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuVo.cs @@ -0,0 +1,79 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSkus +{ + /// + /// 商品规格展示对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + public class GoodsSkuVo + { + + + /// + /// 描述 : + /// + public int GoodsSkuId { get; set; } + + + /// + /// 描述 :商品guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long GoodsGuid { get; set; } + + + /// + /// 描述 :规格值ID + /// + public int SpecValueId { get; set; } + + + /// + /// 描述 :图片 + /// + public string GoodsSkuImg { get; set; } + + + /// + /// 描述 :sku编码 + /// + public string GoodsSkuSkuCode { get; set; } + + + /// + /// 描述 :价格 + /// + public decimal GoodsSkuPrice { get; set; } + + + /// + /// 描述 :划线价格 + /// + public decimal GoodsSkuLinePrice { get; set; } + + + /// + /// 描述 :当前库存数量 + /// + public int GoodsSkuStockNum { get; set; } + + + /// + /// 描述 :商品重量(Kg) + /// + public decimal GoodsSkuWeight { get; set; } + + + /// + /// 描述 :SKU的规格属性(json格式) + /// + public string GoodsSkuProps { get; set; } + + } +} diff --git a/ARW.Model/Vo/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelVo.cs b/ARW.Model/Vo/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelVo.cs new file mode 100644 index 0000000..98fda09 --- /dev/null +++ b/ARW.Model/Vo/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelVo.cs @@ -0,0 +1,43 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Business.GoodsManager.GoodsSpecs.GoodsSpecRels +{ + /// + /// 商品与规格值关系记录展示对象 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + public class GoodsSpecRelVo + { + + + /// + /// 描述 : + /// + public int GoodsSpecRelId { get; set; } + + + /// + /// 描述 :商品Guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long GoodsGuid { get; set; } + + + /// + /// 描述 :规格组ID + /// + public int SpecId { get; set; } + + + /// + /// 描述 :规格值ID + /// + public int SpecValueId { get; set; } + + } +} diff --git a/ARW.Repository/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuRepository.cs b/ARW.Repository/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuRepository.cs new file mode 100644 index 0000000..d420d74 --- /dev/null +++ b/ARW.Repository/Business/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuRepository.cs @@ -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 +{ + /// + /// 商品规格仓储 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + [AppService(ServiceLifetime = LifeTime.Transient)] + public class GoodsSkuRepository : BaseRepository + { + #region 业务逻辑代码 + #endregion + } +} \ No newline at end of file diff --git a/ARW.Repository/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelRepository.cs b/ARW.Repository/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelRepository.cs new file mode 100644 index 0000000..0cc4d1a --- /dev/null +++ b/ARW.Repository/Business/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelRepository.cs @@ -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 +{ + /// + /// 商品与规格值关系记录仓储 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + [AppService(ServiceLifetime = LifeTime.Transient)] + public class GoodsSpecRelRepository : BaseRepository + { + #region 业务逻辑代码 + #endregion + } +} \ No newline at end of file diff --git a/ARW.Service/Business/BusinessService/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuService.cs b/ARW.Service/Business/BusinessService/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuService.cs new file mode 100644 index 0000000..cf11b24 --- /dev/null +++ b/ARW.Service/Business/BusinessService/GoodsManager/GoodsSpecs/GoodsSkus/GoodsSkuService.cs @@ -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 +{ + /// + /// 商品规格接口实现类 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + [AppService(ServiceType = typeof(IGoodsSkuService), ServiceLifetime = LifeTime.Transient)] + public class GoodsSkuServiceImpl : BaseService, IGoodsSkuService + { + private readonly GoodsSkuRepository _GoodsSkuRepository; + + public GoodsSkuServiceImpl(GoodsSkuRepository GoodsSkuRepository) + { + this._GoodsSkuRepository = GoodsSkuRepository; + } + + #region 业务逻辑代码 + + + /// + /// 查询商品规格分页列表 + /// + public async Task> GetGoodsSkuList(GoodsSkuQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + 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); + } + + /// + /// 添加或修改商品规格 + /// + public async Task 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 + + } +} diff --git a/ARW.Service/Business/BusinessService/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelService.cs b/ARW.Service/Business/BusinessService/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelService.cs new file mode 100644 index 0000000..0200cb6 --- /dev/null +++ b/ARW.Service/Business/BusinessService/GoodsManager/GoodsSpecs/GoodsSpecRels/GoodsSpecRelService.cs @@ -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 +{ + /// + /// 商品与规格值关系记录接口实现类 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + [AppService(ServiceType = typeof(IGoodsSpecRelService), ServiceLifetime = LifeTime.Transient)] + public class GoodsSpecRelServiceImpl : BaseService, IGoodsSpecRelService + { + private readonly GoodsSpecRelRepository _GoodsSpecRelRepository; + + public GoodsSpecRelServiceImpl(GoodsSpecRelRepository GoodsSpecRelRepository) + { + this._GoodsSpecRelRepository = GoodsSpecRelRepository; + } + + #region 业务逻辑代码 + + + /// + /// 查询商品与规格值关系记录分页列表 + /// + public async Task> GetGoodsSpecRelList(GoodsSpecRelQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + 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); + } + + /// + /// 添加或修改商品与规格值关系记录 + /// + public async Task 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 + + } +} diff --git a/ARW.Service/Business/IBusinessService/GoodsManager/GoodsSpecs/GoodsSkus/IGoodsSkuService.cs b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsSpecs/GoodsSkus/IGoodsSkuService.cs new file mode 100644 index 0000000..1f4784f --- /dev/null +++ b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsSpecs/GoodsSkus/IGoodsSkuService.cs @@ -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 +{ + /// + /// 商品规格接口类 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + public interface IGoodsSkuService : IBaseService + { + /// + /// 获取商品规格分页列表 + /// + /// + /// + Task> GetGoodsSkuList(GoodsSkuQueryDto parm); + + + /// + /// 添加或修改商品规格 + /// + /// + /// + Task AddOrUpdateGoodsSku(GoodsSku parm); + + + + + + } +} diff --git a/ARW.Service/Business/IBusinessService/GoodsManager/GoodsSpecs/GoodsSpecRels/IGoodsSpecRelService.cs b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsSpecs/GoodsSpecRels/IGoodsSpecRelService.cs new file mode 100644 index 0000000..3323e55 --- /dev/null +++ b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsSpecs/GoodsSpecRels/IGoodsSpecRelService.cs @@ -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 +{ + /// + /// 商品与规格值关系记录接口类 + /// + /// @author 黎文豪 + /// @date 2023-06-19 + /// + public interface IGoodsSpecRelService : IBaseService + { + /// + /// 获取商品与规格值关系记录分页列表 + /// + /// + /// + Task> GetGoodsSpecRelList(GoodsSpecRelQueryDto parm); + + + /// + /// 添加或修改商品与规格值关系记录 + /// + /// + /// + Task AddOrUpdateGoodsSpecRel(GoodsSpecRel parm); + + + + + + } +} diff --git a/ARW.WebApi/Controllers/Business/GoodsManager/GoodsSpecs/SpecValues/SpecValueController.cs b/ARW.WebApi/Controllers/Business/GoodsManager/GoodsSpecs/SpecValues/SpecValueController.cs deleted file mode 100644 index c5718fd..0000000 --- a/ARW.WebApi/Controllers/Business/GoodsManager/GoodsSpecs/SpecValues/SpecValueController.cs +++ /dev/null @@ -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 -{ - /// - /// 商品规格值控制器 - /// - /// @author 黎文豪 - /// @date 2023-06-19 - /// - [Verify] - [Route("business/[controller]")] - public class SpecValueController : BaseController - { - private readonly ISpecValueService _SpecValueService; - - /// - /// 依赖注入 - /// - /// 商品规格值服务 - public SpecValueController(ISpecValueService SpecValueService) - { - _SpecValueService = SpecValueService; - } - - - /// - /// 获取商品规格值列表 - /// - /// 查询参数 - /// - [HttpGet("getSpecValueList")] - [ActionPermissionFilter(Permission = "business:specvalue:list")] - public async Task GetSpecValueList([FromQuery] SpecValueQueryDto parm) - { - var res = await _SpecValueService.GetSpecValueList(parm); - return SUCCESS(res); - } - - /// - /// 添加或修改商品规格值 - /// - /// - /// - [HttpPost("addOrUpdateSpecValue")] - [ActionPermissionFilter(Permission = "business:specvalue:addOrUpdate")] - [Log(Title = "添加或修改商品规格值", BusinessType = BusinessType.ADDORUPDATE)] - public async Task AddOrUpdateSpecValue([FromBody] SpecValueDto parm) - { - if (parm == null) { throw new CustomException("请求参数错误"); } - - var modal = new SpecValue(); - if (parm.SpecValueId != 0) modal = parm.Adapt().ToUpdate(HttpContext); - else modal = parm.Adapt().ToCreate(HttpContext); - - var res = await _SpecValueService.AddOrUpdateSpecValue(modal); - return SUCCESS(res); - } - - /// - /// 删除商品规格值 - /// - /// - [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("删除成功!"); - } - - - - - - - } -} diff --git a/ARW.WebApi/Controllers/Business/GoodsManager/GoodsSpecs/Specs/SpecController.cs b/ARW.WebApi/Controllers/Business/GoodsManager/GoodsSpecs/Specs/SpecController.cs deleted file mode 100644 index 329eed1..0000000 --- a/ARW.WebApi/Controllers/Business/GoodsManager/GoodsSpecs/Specs/SpecController.cs +++ /dev/null @@ -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 -{ - /// - /// 商品规格组控制器 - /// - /// @author 黎文豪 - /// @date 2023-06-19 - /// - [Verify] - [Route("business/[controller]")] - public class SpecController : BaseController - { - private readonly ISpecService _SpecService; - - /// - /// 依赖注入 - /// - /// 商品规格组服务 - public SpecController(ISpecService SpecService) - { - _SpecService = SpecService; - } - - - /// - /// 获取商品规格组列表 - /// - /// 查询参数 - /// - [HttpGet("getSpecList")] - [ActionPermissionFilter(Permission = "business:spec:list")] - public async Task GetSpecList([FromQuery] SpecQueryDto parm) - { - var res = await _SpecService.GetSpecList(parm); - return SUCCESS(res); - } - - - /// - /// 添加或修改商品规格组 - /// - /// - /// - [HttpPost("addOrUpdateSpec")] - [ActionPermissionFilter(Permission = "business:spec:addOrUpdate")] - [Log(Title = "添加或修改商品规格组", BusinessType = BusinessType.ADDORUPDATE)] - public async Task AddOrUpdateSpec([FromBody] SpecDto parm) - { - if (parm == null) { throw new CustomException("请求参数错误"); } - - var modal = new Spec(); - if (parm.SpecId != 0) modal = parm.Adapt().ToUpdate(HttpContext); - else modal = parm.Adapt().ToCreate(HttpContext); - - var res = await _SpecService.AddOrUpdateSpec(modal); - return SUCCESS(res); - } - - /// - /// 删除商品规格组 - /// - /// - [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("删除成功!"); - } - - - - - - - } -}