From bfb6836568c73871760b7824a4eab938fb12a624 Mon Sep 17 00:00:00 2001
From: lwh <2679599887@qq.com>
Date: Thu, 15 Jun 2023 21:27:14 +0800
Subject: [PATCH] =?UTF-8?q?fixed=20=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA?=
=?UTF-8?q?=E7=BB=8F=E8=90=A5=E7=B1=BB=E7=9B=AE=E4=B8=BA=E6=A0=91=E5=BD=A2?=
=?UTF-8?q?(=E4=BA=8C=E7=BA=A7)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs | 14 ++++++++++++++
.../ShopManager/Shops/ShopServiceApi.cs | 4 ++--
.../GoodsCategorys/GoodsCategoryService.cs | 1 +
.../Business/ShopManager/Shops/ShopController.cs | 1 -
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/ARW.Model/Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs b/ARW.Model/Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs
index b49ef6b..23550ab 100644
--- a/ARW.Model/Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs
+++ b/ARW.Model/Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs
@@ -1,7 +1,9 @@
+using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
using Newtonsoft.Json;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
+using System.Collections.Generic;
namespace ARW.Model.Vo.Api.ShopManager.Shops
{
@@ -23,10 +25,22 @@ namespace ARW.Model.Vo.Api.ShopManager.Shops
///
/// 描述 :值
///
+ [SugarColumn(IsTreeKey = true)]
[JsonConverter(typeof(ValueToStringConverter))]
public long Value { get; set; }
+ ///
+ /// 描述 :父级guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long ParentGuid { get; set; }
+
+
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ [SugarColumn(IsIgnore = true)]
+ public List Children { get; set; }
+
}
}
diff --git a/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs b/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs
index b389cd1..f40049b 100644
--- a/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs
+++ b/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs
@@ -53,15 +53,15 @@ namespace ARW.Service.Api.BusinessService.ShopManager.Shops
{
var query = _GoodsCategoryRepository
.Queryable()
- .Where(s => s.GoodsCategoryParentGuid == 0)
.OrderBy(s => s.Update_time, OrderByType.Desc)
.Select((s) => new GoodsCategoryVoApi
{
+ ParentGuid = s.GoodsCategoryParentGuid,
Label = s.GoodsCategoryName,
Value = s.GoodsCategoryGuid,
});
- return await query.ToListAsync();
+ return await query.ToTreeAsync(it => it.Children, it => it.ParentGuid, 0);
}
diff --git a/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs b/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs
index 9471a07..12ee34c 100644
--- a/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs
+++ b/ARW.Service/Business/BusinessService/GoodsManager/GoodsCategorys/GoodsCategoryService.cs
@@ -122,6 +122,7 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsCategorys
}
else
{
+ 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/Business/ShopManager/Shops/ShopController.cs b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
index 9f41b1f..ca8e434 100644
--- a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
+++ b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
@@ -112,7 +112,6 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
if (parm.ShopId != 0) modal = parm.Adapt().ToUpdate(HttpContext);
else modal = parm.Adapt().ToCreate(HttpContext);
- modal.ShopAuditStatus = 1;
var res = await _ShopService.AddOrUpdateShop(modal);
return SUCCESS(res);