fixed 修改细节

This commit is contained in:
lwh 2023-06-19 13:42:43 +08:00
parent d92eafb858
commit d94878993d
4 changed files with 46 additions and 25 deletions

View File

@ -51,6 +51,7 @@ namespace ARW.Model.Dto.Business.GoodsManager.GoodsServicess
public class GoodsServicesQueryDto : PagerInfo public class GoodsServicesQueryDto : PagerInfo
{ {
public long ShopGuid { get; set; }
public string ShopName { get; set; } public string ShopName { get; set; }
public string GoodsServicesName { get; set; } public string GoodsServicesName { get; set; }

View File

@ -66,7 +66,7 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsServicesRels
/// </summary> /// </summary>
public async Task<string> AddOrUpdateGoodsServicesRel(GoodsServicesRel model) public async Task<string> AddOrUpdateGoodsServicesRel(GoodsServicesRel model)
{ {
if (model.GoodsServicesRelId != 0) if (model.Id != 0)
{ {
var response = await _GoodsServicesRelRepository.UpdateAsync(model); var response = await _GoodsServicesRelRepository.UpdateAsync(model);
return "修改成功!"; return "修改成功!";

View File

@ -45,6 +45,7 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsServicess
//开始拼装查询条件d //开始拼装查询条件d
var predicate = Expressionable.Create<GoodsServices>(); var predicate = Expressionable.Create<GoodsServices>();
predicate = predicate.AndIF(parm.ShopGuid != 0, s => s.ShopGuid == parm.ShopGuid);
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.GoodsServicesName), s => s.GoodsServicesName.Contains(parm.GoodsServicesName)); predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.GoodsServicesName), s => s.GoodsServicesName.Contains(parm.GoodsServicesName));
predicate = predicate.AndIF(parm.GoodsServicesIsDefault != null, s => s.GoodsServicesIsDefault == parm.GoodsServicesIsDefault); predicate = predicate.AndIF(parm.GoodsServicesIsDefault != null, s => s.GoodsServicesIsDefault == parm.GoodsServicesIsDefault);
predicate = predicate.AndIF(parm.GoodsServicesDisplayStatus != null, s => s.GoodsServicesDisplayStatus == parm.GoodsServicesDisplayStatus); predicate = predicate.AndIF(parm.GoodsServicesDisplayStatus != null, s => s.GoodsServicesDisplayStatus == parm.GoodsServicesDisplayStatus);

View File

@ -15,6 +15,7 @@ using ARW.Model.Models.Business.GoodsManager.GoodsServicess;
using ARW.Model.Vo.Business.GoodsManager.GoodsServicess; using ARW.Model.Vo.Business.GoodsManager.GoodsServicess;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using ARW.Admin.WebApi.Framework; using ARW.Admin.WebApi.Framework;
using ARW.Service.Business.IBusinessService.ShopManager.Shops;
namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
@ -30,14 +31,16 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
public class GoodsServicesController : BaseController public class GoodsServicesController : BaseController
{ {
private readonly IGoodsServicesService _GoodsServicesService; private readonly IGoodsServicesService _GoodsServicesService;
private readonly IShopService _ShopService;
/// <summary> /// <summary>
/// 依赖注入 /// 依赖注入
/// </summary> /// </summary>
/// <param name="GoodsServicesService">商品服务与承诺服务</param> /// <param name="GoodsServicesService">商品服务与承诺服务</param>
public GoodsServicesController(IGoodsServicesService GoodsServicesService) public GoodsServicesController(IGoodsServicesService GoodsServicesService, IShopService shopService)
{ {
_GoodsServicesService = GoodsServicesService; _GoodsServicesService = GoodsServicesService;
_ShopService = shopService;
} }
@ -50,6 +53,14 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
[ActionPermissionFilter(Permission = "business:goodsservices:list")] [ActionPermissionFilter(Permission = "business:goodsservices:list")]
public async Task<IActionResult> GetGoodsServicesList([FromQuery] GoodsServicesQueryDto parm) public async Task<IActionResult> GetGoodsServicesList([FromQuery] GoodsServicesQueryDto parm)
{ {
var user = JwtUtil.GetLoginUser(App.HttpContext);
if (user.UserId != 1)
{
var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId);
if (shop == null) throw new Exception("当前用户没有店铺");
parm.ShopGuid = shop.ShopGuid;
}
var res = await _GoodsServicesService.GetGoodsServicesList(parm); var res = await _GoodsServicesService.GetGoodsServicesList(parm);
return SUCCESS(res); return SUCCESS(res);
} }
@ -70,6 +81,14 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
if (parm.GoodsServicesId != 0) modal = parm.Adapt<GoodsServices>().ToUpdate(HttpContext); if (parm.GoodsServicesId != 0) modal = parm.Adapt<GoodsServices>().ToUpdate(HttpContext);
else modal = parm.Adapt<GoodsServices>().ToCreate(HttpContext); else modal = parm.Adapt<GoodsServices>().ToCreate(HttpContext);
var user = JwtUtil.GetLoginUser(App.HttpContext);
if (user.UserId != 1)
{
var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId);
if (shop == null) throw new Exception("当前用户没有店铺");
modal.ShopGuid = shop.ShopGuid;
}
var res = await _GoodsServicesService.AddOrUpdateGoodsServices(modal); var res = await _GoodsServicesService.AddOrUpdateGoodsServices(modal);
return SUCCESS(res); return SUCCESS(res);
} }