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 Newtonsoft.Json;
|
||||||
using OfficeOpenXml.Attributes;
|
using OfficeOpenXml.Attributes;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace ARW.Model.Vo.Api.ShopManager.Shops
|
namespace ARW.Model.Vo.Api.ShopManager.Shops
|
||||||
{
|
{
|
||||||
@ -23,10 +25,22 @@ namespace ARW.Model.Vo.Api.ShopManager.Shops
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 描述 :值
|
/// 描述 :值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SugarColumn(IsTreeKey = true)]
|
||||||
[JsonConverter(typeof(ValueToStringConverter))]
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
public long Value { get; set; }
|
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
|
var query = _GoodsCategoryRepository
|
||||||
.Queryable()
|
.Queryable()
|
||||||
.Where(s => s.GoodsCategoryParentGuid == 0)
|
|
||||||
.OrderBy(s => s.Update_time, OrderByType.Desc)
|
.OrderBy(s => s.Update_time, OrderByType.Desc)
|
||||||
.Select((s) => new GoodsCategoryVoApi
|
.Select((s) => new GoodsCategoryVoApi
|
||||||
{
|
{
|
||||||
|
ParentGuid = s.GoodsCategoryParentGuid,
|
||||||
Label = s.GoodsCategoryName,
|
Label = s.GoodsCategoryName,
|
||||||
Value = s.GoodsCategoryGuid,
|
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
|
else
|
||||||
{
|
{
|
||||||
|
if (model.GoodsCategoryParentGuid != 0) throw new CustomException("不允许添加三级类目!");
|
||||||
var info = _GoodsCategoryRepository.GetFirst(it => it.GoodsCategoryGuid == model.GoodsCategoryParentGuid);
|
var info = _GoodsCategoryRepository.GetFirst(it => it.GoodsCategoryGuid == model.GoodsCategoryParentGuid);
|
||||||
model.GoodsCategoryAncestralGuid = "0";
|
model.GoodsCategoryAncestralGuid = "0";
|
||||||
if (info != null) model.GoodsCategoryAncestralGuid = info.GoodsCategoryAncestralGuid + "," + model.GoodsCategoryParentGuid;
|
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);
|
if (parm.ShopId != 0) modal = parm.Adapt<Shop>().ToUpdate(HttpContext);
|
||||||
else modal = parm.Adapt<Shop>().ToCreate(HttpContext);
|
else modal = parm.Adapt<Shop>().ToCreate(HttpContext);
|
||||||
|
|
||||||
modal.ShopAuditStatus = 1;
|
|
||||||
|
|
||||||
var res = await _ShopService.AddOrUpdateShop(modal);
|
var res = await _ShopService.AddOrUpdateShop(modal);
|
||||||
return SUCCESS(res);
|
return SUCCESS(res);
|
||||||
|
Loading…
Reference in New Issue
Block a user