fixed 修改店铺经营类目为树形(二级)
This commit is contained in:
parent
7d3f821c1c
commit
bfb6836568
@ -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
|
||||
/// <summary>
|
||||
/// 描述 :值
|
||||
/// </summary>
|
||||
[SugarColumn(IsTreeKey = true)]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long Value { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :父级guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long ParentGuid { get; set; }
|
||||
|
||||
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<GoodsCategoryVoApi> Children { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -112,7 +112,6 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
|
||||
if (parm.ShopId != 0) modal = parm.Adapt<Shop>().ToUpdate(HttpContext);
|
||||
else modal = parm.Adapt<Shop>().ToCreate(HttpContext);
|
||||
|
||||
modal.ShopAuditStatus = 1;
|
||||
|
||||
var res = await _ShopService.AddOrUpdateShop(modal);
|
||||
return SUCCESS(res);
|
||||
|
Loading…
Reference in New Issue
Block a user