diff --git a/ARW.Model/Dto/Api/Custom/GoodsCollections/GoodsCollectionApiDto.cs b/ARW.Model/Dto/Api/Custom/GoodsCollections/GoodsCollectionApiDto.cs
new file mode 100644
index 0000000..2caccc9
--- /dev/null
+++ b/ARW.Model/Dto/Api/Custom/GoodsCollections/GoodsCollectionApiDto.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using ARW.Model.Models.Business.Custom.GoodsCollections;
+
+namespace ARW.Model.Dto.Api.Custom.GoodsCollections
+{
+
+ ///
+ /// 商品收藏查询对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public class GoodsCollectionQueryDtoApi : PagerInfo
+ {
+ public long CustomerGuid { get; set; }
+ }
+
+
+ ///
+ /// 商品收藏详情输入对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public class GoodsCollectionDtoApi
+ {
+ [Required(ErrorMessage = "GoodsCollectionGuid不能为空")]
+ public long GoodsCollectionGuid { get; set; }
+ }
+
+}
diff --git a/ARW.Model/Dto/Business/Custom/GoodsCollections/GoodsCollectionDto.cs b/ARW.Model/Dto/Business/Custom/GoodsCollections/GoodsCollectionDto.cs
new file mode 100644
index 0000000..03ce7d3
--- /dev/null
+++ b/ARW.Model/Dto/Business/Custom/GoodsCollections/GoodsCollectionDto.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using ARW.Model.Models.Business.Custom.GoodsCollections;
+
+namespace ARW.Model.Dto.Business.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏输入对象
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public class GoodsCollectionDto
+ {
+
+ public int GoodsCollectionId { get; set; }
+
+ public long GoodsCollectionGuid { get; set; }
+
+ public long CustomerGuid { get; set; }
+
+ [Required(ErrorMessage = "商品guid不能为空")]
+ public long GoodsGuid { get; set; }
+
+
+
+
+
+ }
+
+
+ ///
+ /// 商品收藏查询对象
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public class GoodsCollectionQueryDto : PagerInfo
+ {
+
+ public string ids { get; set; }
+ }
+
+
+
+
+}
diff --git a/ARW.Model/Models/Business/Custom/GoodsCollections/GoodsCollection.cs b/ARW.Model/Models/Business/Custom/GoodsCollections/GoodsCollection.cs
new file mode 100644
index 0000000..5f6dc57
--- /dev/null
+++ b/ARW.Model/Models/Business/Custom/GoodsCollections/GoodsCollection.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using SqlSugar;
+using OfficeOpenXml.Attributes;
+using Newtonsoft.Json;
+
+namespace ARW.Model.Models.Business.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏,数据实体对象
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ [SugarTable("tb_goods_collection")]
+ public class GoodsCollection : BusinessBase
+ {
+
+ ///
+ /// 描述 :
+ /// 空值 : false
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_collection_id")]
+ public int GoodsCollectionId { get; set; }
+
+
+ ///
+ /// 描述 :
+ /// 空值 : false
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "goods_collection_guid")]
+ public long GoodsCollectionGuid { get; set; }
+
+
+ ///
+ /// 描述 :客户guid
+ /// 空值 : false
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(ColumnName = "customer_guid")]
+ public long CustomerGuid { get; set; }
+
+
+ ///
+ /// 描述 :商品guid
+ /// 空值 : false
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(ColumnName = "goods_guid")]
+ public long GoodsGuid { get; set; }
+
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/ARW.Model/Vo/Api/Custom/GoodsCollections/GoodsCollectionApiVo.cs b/ARW.Model/Vo/Api/Custom/GoodsCollections/GoodsCollectionApiVo.cs
new file mode 100644
index 0000000..ff2bcde
--- /dev/null
+++ b/ARW.Model/Vo/Api/Custom/GoodsCollections/GoodsCollectionApiVo.cs
@@ -0,0 +1,67 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Api.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏展示对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public class GoodsCollectionVoApi
+ {
+
+ ///
+ /// 描述 :商品guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long SpuId { get; set; }
+
+
+ ///
+ /// 描述 :商品名称
+ ///
+ public string Title { get; set; }
+
+
+ ///
+ /// 描述 :商品封面
+ ///
+ public string Thumb { get; set; }
+
+
+ ///
+ /// 描述 :收藏人数
+ ///
+ public int CollectionNum { get; set; }
+
+
+ ///
+ /// 描述 :商品价格
+ ///
+ public decimal Price { get; set; }
+
+
+ ///
+ /// 描述 :商品划线价格
+ ///
+ public decimal OriginPrice { get; set; }
+
+
+ ///
+ /// 描述 :商品库存总量
+ ///
+ public int SpuStockQuantity { get; set; }
+
+
+ ///
+ /// 描述 :是否上架
+ ///
+ public int IsPutOnSale { get; set;}
+
+ }
+
+}
diff --git a/ARW.Model/Vo/Business/Custom/GoodsCollections/GoodsCollectionVo.cs b/ARW.Model/Vo/Business/Custom/GoodsCollections/GoodsCollectionVo.cs
new file mode 100644
index 0000000..5518bdc
--- /dev/null
+++ b/ARW.Model/Vo/Business/Custom/GoodsCollections/GoodsCollectionVo.cs
@@ -0,0 +1,45 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Business.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏展示对象
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public class GoodsCollectionVo
+ {
+
+
+ ///
+ /// 描述 :
+ ///
+ public int GoodsCollectionId { get; set; }
+
+
+ ///
+ /// 描述 :
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long GoodsCollectionGuid { get; set; }
+
+
+ ///
+ /// 描述 :客户guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long CustomerGuid { get; set; }
+
+
+ ///
+ /// 描述 :商品guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long GoodsGuid { get; set; }
+
+ }
+}
diff --git a/ARW.Repository/Business/Custom/GoodsCollections/GoodsCollectionRepository.cs b/ARW.Repository/Business/Custom/GoodsCollections/GoodsCollectionRepository.cs
new file mode 100644
index 0000000..06a0cf4
--- /dev/null
+++ b/ARW.Repository/Business/Custom/GoodsCollections/GoodsCollectionRepository.cs
@@ -0,0 +1,20 @@
+using System;
+using Infrastructure.Attribute;
+using ARW.Repository.System;
+using ARW.Model.Models.Business.Custom.GoodsCollections;
+
+namespace ARW.Repository.Business.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏仓储
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ [AppService(ServiceLifetime = LifeTime.Transient)]
+ public class GoodsCollectionRepository : BaseRepository
+ {
+ #region 业务逻辑代码
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/ARW.Service/Api/BusinessService/Custom/GoodsCollections/GoodsCollectionServiceApi.cs b/ARW.Service/Api/BusinessService/Custom/GoodsCollections/GoodsCollectionServiceApi.cs
new file mode 100644
index 0000000..6cb05bb
--- /dev/null
+++ b/ARW.Service/Api/BusinessService/Custom/GoodsCollections/GoodsCollectionServiceApi.cs
@@ -0,0 +1,104 @@
+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 ARW.Model;
+using ARW.Repository;
+using ARW.Repository.Business.Custom.GoodsCollections;
+using ARW.Service.Api.IBusinessService.Custom.GoodsCollections;
+using ARW.Model.Dto.Api.Custom.GoodsCollections;
+using ARW.Model.Models.Business.Custom.GoodsCollections;
+using ARW.Model.Vo.Api.Custom.GoodsCollections;
+using ARW.Model.Models.Business.GoodsManager.Goodss;
+using Org.BouncyCastle.Crypto.Prng;
+using Infrastructure;
+
+namespace ARW.Service.Api.BusinessService.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏接口实现类Api
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ [AppService(ServiceType = typeof(IGoodsCollectionServiceApi), ServiceLifetime = LifeTime.Transient)]
+ public class GoodsCollectionServiceImplApi : BaseService, IGoodsCollectionServiceApi
+ {
+ private readonly GoodsCollectionRepository _GoodsCollectionRepository;
+
+ public GoodsCollectionServiceImplApi(GoodsCollectionRepository GoodsCollectionRepository)
+ {
+ this._GoodsCollectionRepository = GoodsCollectionRepository;
+ }
+
+ #region Api接口代码
+
+
+ ///
+ /// 查询商品收藏列表(Api)
+ ///
+ ///
+ ///
+ public async Task> GetGoodsCollectionListApi(GoodsCollectionQueryDtoApi parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+ predicate = predicate.AndIF(parm.CustomerGuid != 0, s => s.CustomerGuid == parm.CustomerGuid);
+
+ var query = _GoodsCollectionRepository
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .LeftJoin((s, c) => s.GoodsGuid == c.GoodsGuid)
+ .OrderBy(s => s.Create_time, OrderByType.Desc)
+ .Select((s, c) => new GoodsCollectionVoApi
+ {
+ SpuId = s.GoodsGuid,
+ Title = c.GoodsName,
+ Thumb = c.GoodsPicture,
+ Price = c.GoodsPriceLowest,
+ OriginPrice = c.GoodsDashedPriceLowest,
+ SpuStockQuantity = c.GoodsTotalInventory,
+ IsPutOnSale = c.GoodsShelfStatus
+ });
+
+
+ var list = await query.ToPageAsync(parm);
+
+ foreach (var item in list.Result)
+ {
+ item.Thumb = item.Thumb.Split(",").First();
+ }
+
+ return list;
+
+ }
+
+
+ ///
+ /// 添加或修改商品收藏
+ ///
+ public async Task AddOrUpdateGoodsCollection(GoodsCollection model)
+ {
+ if (model.GoodsCollectionId != 0)
+ {
+ var response = await _GoodsCollectionRepository.UpdateAsync(model);
+ return "修改成功!";
+ }
+ else
+ {
+ var isRepeat = await _GoodsCollectionRepository.GetFirstAsync(s => s.CustomerGuid == model.CustomerGuid && s.GoodsGuid == model.GoodsGuid);
+ if (isRepeat != null) throw new CustomException("商品已收藏,请勿重复收藏!");
+ var response = await _GoodsCollectionRepository.InsertReturnSnowflakeIdAsync(model);
+ return "添加成功!";
+ }
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/ARW.Service/Api/IBusinessService/Custom/GoodsCollections/IGoodsCollectionServiceApi.cs b/ARW.Service/Api/IBusinessService/Custom/GoodsCollections/IGoodsCollectionServiceApi.cs
new file mode 100644
index 0000000..778bc03
--- /dev/null
+++ b/ARW.Service/Api/IBusinessService/Custom/GoodsCollections/IGoodsCollectionServiceApi.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Api.Custom.GoodsCollections;
+using ARW.Model.Models.Business.Custom.GoodsCollections;
+using ARW.Model.Vo.Api.Custom.GoodsCollections;
+
+namespace ARW.Service.Api.IBusinessService.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏接口类Api
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public interface IGoodsCollectionServiceApi : IBaseService
+ {
+ ///
+ /// 获取商品收藏分页列表(Api)
+ ///
+ ///
+ ///
+ Task> GetGoodsCollectionListApi(GoodsCollectionQueryDtoApi parm);
+
+
+ ///
+ /// 添加或修改商品收藏
+ ///
+ ///
+ ///
+ Task AddOrUpdateGoodsCollection(GoodsCollection parm);
+
+
+ }
+}
diff --git a/ARW.Service/Business/BusinessService/Custom/GoodsCollections/GoodsCollectionService.cs b/ARW.Service/Business/BusinessService/Custom/GoodsCollections/GoodsCollectionService.cs
new file mode 100644
index 0000000..af50edf
--- /dev/null
+++ b/ARW.Service/Business/BusinessService/Custom/GoodsCollections/GoodsCollectionService.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.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
+{
+ ///
+ /// 商品收藏接口实现类
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ [AppService(ServiceType = typeof(IGoodsCollectionService), ServiceLifetime = LifeTime.Transient)]
+ public class GoodsCollectionServiceImpl : BaseService, IGoodsCollectionService
+ {
+ private readonly GoodsCollectionRepository _GoodsCollectionRepository;
+
+ public GoodsCollectionServiceImpl(GoodsCollectionRepository GoodsCollectionRepository)
+ {
+ this._GoodsCollectionRepository = GoodsCollectionRepository;
+ }
+
+ #region 业务逻辑代码
+
+
+ ///
+ /// 查询商品收藏分页列表
+ ///
+ public async Task> GetGoodsCollectionList(GoodsCollectionQueryDto parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ 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);
+ }
+
+ ///
+ /// 添加或修改商品收藏
+ ///
+ public async Task 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
+
+ }
+}
diff --git a/ARW.Service/Business/IBusinessService/Custom/GoodsCollections/IGoodsCollectionService.cs b/ARW.Service/Business/IBusinessService/Custom/GoodsCollections/IGoodsCollectionService.cs
new file mode 100644
index 0000000..2de148b
--- /dev/null
+++ b/ARW.Service/Business/IBusinessService/Custom/GoodsCollections/IGoodsCollectionService.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.Custom.GoodsCollections;
+using ARW.Model.Models.Business.Custom.GoodsCollections;
+using ARW.Model.Vo.Business.Custom.GoodsCollections;
+
+namespace ARW.Service.Business.IBusinessService.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏接口类
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ public interface IGoodsCollectionService : IBaseService
+ {
+ ///
+ /// 获取商品收藏分页列表
+ ///
+ ///
+ ///
+ Task> GetGoodsCollectionList(GoodsCollectionQueryDto parm);
+
+
+ ///
+ /// 添加或修改商品收藏
+ ///
+ ///
+ ///
+ Task AddOrUpdateGoodsCollection(GoodsCollection parm);
+
+
+
+
+
+ }
+}
diff --git a/ARW.WebApi/Controllers/Api/Custom/GoodsCollections/GoodsCollectionApiController.cs b/ARW.WebApi/Controllers/Api/Custom/GoodsCollections/GoodsCollectionApiController.cs
new file mode 100644
index 0000000..75840df
--- /dev/null
+++ b/ARW.WebApi/Controllers/Api/Custom/GoodsCollections/GoodsCollectionApiController.cs
@@ -0,0 +1,100 @@
+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.Admin.WebApi.Controllers;
+using ARW.Model.Dto.Api.Custom.GoodsCollections;
+using ARW.Service.Api.IBusinessService.Custom.GoodsCollections;
+using ARW.Model.Models.Business.Custom.GoodsCollections;
+using ARW.Model.Vo.Api.Custom.GoodsCollections;
+using Microsoft.AspNetCore.Authorization;
+using Geocoding;
+using ARW.Model.Dto.Business.Custom.GoodsCollections;
+using ARW.Service.Business.IBusinessService.Custom.GoodsCollections;
+using ARW.Admin.WebApi.Framework;
+
+namespace ARW.WebApi.Controllers.Api.Custom.GoodsCollections
+{
+ ///
+ /// 商品收藏控制器Api
+ ///
+ /// @author lwh
+ /// @date 2023-10-22
+ ///
+ [Verify]
+ [Route("api/[controller]")]
+ public class GoodsCollectionApiController : BaseController
+ {
+ private readonly IGoodsCollectionServiceApi _GoodsCollectionServiceApi;
+
+ ///
+ /// 依赖注入
+ ///
+ /// 商品收藏商品收藏Api服务
+ public GoodsCollectionApiController(IGoodsCollectionServiceApi GoodsCollectionServiceApi)
+ {
+ _GoodsCollectionServiceApi = GoodsCollectionServiceApi;
+ }
+
+
+ ///
+ /// 获取商品收藏列表(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getGoodsCollectionList")]
+ public async Task GetGoodsCollectionListApi([FromQuery] GoodsCollectionQueryDtoApi parm)
+ {
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ parm.CustomerGuid = user.UserId;
+
+ var res = await _GoodsCollectionServiceApi.GetGoodsCollectionListApi(parm);
+ return SUCCESS(res);
+ }
+
+
+ ///
+ /// 添加或修改商品收藏
+ ///
+ ///
+ ///
+ [HttpPost("addOrUpdateGoodsCollection")]
+ [Log(Title = "添加或修改商品收藏", BusinessType = BusinessType.ADDORUPDATE)]
+ public async Task AddOrUpdateGoodsCollection([FromBody] GoodsCollectionDto parm)
+ {
+ if (parm == null) { throw new CustomException("请求参数错误"); }
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ parm.CustomerGuid = user.UserId;
+
+ var modal = new GoodsCollection();
+ if (parm.GoodsCollectionId != 0) modal = parm.Adapt().ToUpdate(HttpContext);
+ else modal = parm.Adapt().ToCreate(HttpContext);
+
+ var res = await _GoodsCollectionServiceApi.AddOrUpdateGoodsCollection(modal);
+ return SUCCESS(res);
+ }
+
+
+ ///
+ /// 删除商品收藏
+ ///
+ ///
+ [HttpDelete("{ids}")]
+ [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 = _GoodsCollectionServiceApi.Delete(idsArr);
+ return SUCCESS("删除成功!");
+ }
+
+
+ }
+}