diff --git a/ARW.Model/Dto/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiDto.cs b/ARW.Model/Dto/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiDto.cs
new file mode 100644
index 0000000..ea89b12
--- /dev/null
+++ b/ARW.Model/Dto/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiDto.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
+
+namespace ARW.Model.Dto.Api.GoodsManager.GoodsCategorys
+{
+
+ ///
+ /// 经营类目查询对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-07-08
+ ///
+ public class GoodsCategoryQueryDtoApi : PagerInfo
+ {
+ public string GoodsCategoryName { get; set; }
+ public int? GoodsCategoryDisplayStatus { get; set; }
+ public int? GoodsCategoryIsPopular { get; set; }
+ }
+
+
+ ///
+ /// 经营类目详情输入对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-07-08
+ ///
+ public class GoodsCategoryDtoApi
+ {
+ [Required(ErrorMessage = "GoodsCategoryGuid不能为空")]
+ public long GoodsCategoryGuid { get; set; }
+ }
+
+}
diff --git a/ARW.Model/Vo/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiVo.cs b/ARW.Model/Vo/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiVo.cs
new file mode 100644
index 0000000..5f86141
--- /dev/null
+++ b/ARW.Model/Vo/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiVo.cs
@@ -0,0 +1,51 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
+using System.Collections.Generic;
+
+namespace ARW.Model.Vo.Api.GoodsManager.GoodsCategorys
+{
+ ///
+ /// 经营类目展示对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-07-08
+ ///
+ public class GoodsCategoryVoApi
+ {
+
+ ///
+ /// 描述 :
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(IsTreeKey = true)]
+ [EpplusIgnore]
+ public long GroupId { get; set; }
+
+ ///
+ /// 描述 :父级guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long ParentGuid { get; set; }
+
+
+ ///
+ /// 描述 :名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 描述 :图片
+ ///
+ [EpplusIgnore]
+ public string Thumbnail { get; set; }
+
+
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ [SugarColumn(IsIgnore = true)]
+ public List Children { get; set; }
+ }
+
+}
diff --git a/ARW.Service/Api/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryServiceApi.cs b/ARW.Service/Api/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryServiceApi.cs
new file mode 100644
index 0000000..9416f5f
--- /dev/null
+++ b/ARW.Service/Api/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryServiceApi.cs
@@ -0,0 +1,69 @@
+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.GoodsManager.GoodsCategorys;
+using ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys;
+using ARW.Model.Dto.Api.GoodsManager.GoodsCategorys;
+using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
+using ARW.Model.Vo.Api.GoodsManager.GoodsCategorys;
+
+namespace ARW.Service.Api.BusinessService.GoodsManager.GoodsCategorys
+{
+ ///
+ /// 经营类目接口实现类Api
+ ///
+ /// @author lwh
+ /// @date 2023-07-08
+ ///
+ [AppService(ServiceType = typeof(IGoodsCategoryServiceApi), ServiceLifetime = LifeTime.Transient)]
+ public class GoodsCategoryServiceImplApi : BaseService, IGoodsCategoryServiceApi
+ {
+ private readonly GoodsCategoryRepository _GoodsCategoryRepository;
+
+ public GoodsCategoryServiceImplApi(GoodsCategoryRepository GoodsCategoryRepository)
+ {
+ this._GoodsCategoryRepository = GoodsCategoryRepository;
+ }
+
+ #region Api接口代码
+
+
+ ///
+ /// 查询经营类目树形列表(Api)
+ ///
+ ///
+ ///
+ public async Task> GetGoodsCategoryTreeListApi(GoodsCategoryQueryDtoApi parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.GoodsCategoryName), s => s.GoodsCategoryName.Contains(parm.GoodsCategoryName));
+ predicate = predicate.AndIF(parm.GoodsCategoryDisplayStatus != null, s => s.GoodsCategoryDisplayStatus == parm.GoodsCategoryDisplayStatus);
+ predicate = predicate.AndIF(parm.GoodsCategoryIsPopular != null, s => s.GoodsCategoryIsPopular == parm.GoodsCategoryIsPopular);
+ var query = _GoodsCategoryRepository
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .OrderBy(s => s.ProductCategorySort, OrderByType.Asc)
+ .Select((s) => new GoodsCategoryVoApi
+ {
+ GroupId = s.GoodsCategoryGuid,
+ ParentGuid = s.GoodsCategoryParentGuid,
+ Name = s.GoodsCategoryName,
+ Thumbnail = s.GoodsCategoryImg,
+ });
+
+ return await query.ToTreeAsync(it => it.Children, it => it.ParentGuid, 0);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/ARW.Service/Api/IBusinessService/GoodsManager/GoodsCategorys/IGoodsCategoryServiceApi.cs b/ARW.Service/Api/IBusinessService/GoodsManager/GoodsCategorys/IGoodsCategoryServiceApi.cs
new file mode 100644
index 0000000..fcc209a
--- /dev/null
+++ b/ARW.Service/Api/IBusinessService/GoodsManager/GoodsCategorys/IGoodsCategoryServiceApi.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Api.GoodsManager.GoodsCategorys;
+using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
+using ARW.Model.Vo.Api.GoodsManager.GoodsCategorys;
+
+namespace ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys
+{
+ ///
+ /// 经营类目接口类Api
+ ///
+ /// @author lwh
+ /// @date 2023-07-08
+ ///
+ public interface IGoodsCategoryServiceApi : IBaseService
+ {
+ ///
+ /// 获取经营类目树形列表(Api)
+ ///
+ ///
+ ///
+ Task> GetGoodsCategoryTreeListApi(GoodsCategoryQueryDtoApi parm);
+
+
+ }
+}
diff --git a/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs b/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs
index b61c7d7..18a30db 100644
--- a/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs
+++ b/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs
@@ -122,7 +122,7 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsCategorys
}
else
{
- if (model.GoodsCategoryParentGuid != 0) throw new CustomException("不允许添加三级类目!");
+ //if (model.GoodsCategoryParentGuid != 0) throw new CustomException("不允许添加三级类目!");
var info = _GoodsCategoryRepository.GetFirst(it => it.GoodsCategoryGuid == model.GoodsCategoryParentGuid);
model.GoodsCategoryAncestralGuid = "0";
if (info != null) model.GoodsCategoryAncestralGuid = info.GoodsCategoryAncestralGuid + "," + model.GoodsCategoryParentGuid;
diff --git a/ARW.WebApi/Controllers/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiController.cs b/ARW.WebApi/Controllers/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiController.cs
new file mode 100644
index 0000000..7362f0e
--- /dev/null
+++ b/ARW.WebApi/Controllers/Api/GoodsManager/GoodsCategorys/GoodsCategoryApiController.cs
@@ -0,0 +1,59 @@
+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.GoodsManager.GoodsCategorys;
+using ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys;
+using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
+using ARW.Model.Vo.Api.GoodsManager.GoodsCategorys;
+using Microsoft.AspNetCore.Authorization;
+using Geocoding;
+
+namespace ARW.WebApi.Controllers.Api.GoodsManager.GoodsCategorys
+{
+ ///
+ /// 经营类目控制器Api
+ ///
+ /// @author lwh
+ /// @date 2023-07-08
+ ///
+ [Verify]
+ [Route("api/[controller]")]
+ public class GoodsCategoryApiController : BaseController
+ {
+ private readonly IGoodsCategoryServiceApi _GoodsCategoryServiceApi;
+
+ ///
+ /// 依赖注入
+ ///
+ /// 经营类目经营类目Api服务
+ public GoodsCategoryApiController(IGoodsCategoryServiceApi GoodsCategoryServiceApi)
+ {
+ _GoodsCategoryServiceApi = GoodsCategoryServiceApi;
+ }
+
+
+ ///
+ /// 获取经营类目树形列表(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getGoodsCategoryTreeList")]
+ public async Task GetGoodsCategoryTreeListApi([FromQuery] GoodsCategoryQueryDtoApi parm)
+ {
+ var res = await _GoodsCategoryServiceApi.GetGoodsCategoryTreeListApi(parm);
+ if (res == null)
+ res = new List();
+
+ return SUCCESS(res);
+ }
+
+ }
+}