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 long ShopGuid { get; set; }
public string ShopName { get; set; }
public string GoodsServicesName { get; set; }

View File

@ -33,13 +33,13 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsServicesRels
this._GoodsServicesRelRepository = GoodsServicesRelRepository;
}
#region
/// <summary>
#region
/// <summary>
/// 查询商品服务与承诺关系表分页列表
/// </summary>
public async Task<PagedInfo<GoodsServicesRelVo>> GetGoodsServicesRelList(GoodsServicesRelQueryDto parm)
public async Task<PagedInfo<GoodsServicesRelVo>> GetGoodsServicesRelList(GoodsServicesRelQueryDto parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<GoodsServicesRel>();
@ -47,26 +47,26 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsServicesRels
var query = _GoodsServicesRelRepository
.Queryable()
.Where(predicate.ToExpression())
.OrderBy(s => s.Create_time,OrderByType.Desc)
.OrderBy(s => s.Create_time, OrderByType.Desc)
.Select(s => new GoodsServicesRelVo
{
Id = s.Id,
Guid = s.Guid,
ShopGuid = s.ShopGuid,
GoodsGuid = s.GoodsGuid,
ServiceGuid = s.ServiceGuid,
});
Id = s.Id,
Guid = s.Guid,
ShopGuid = s.ShopGuid,
GoodsGuid = s.GoodsGuid,
ServiceGuid = s.ServiceGuid,
});
return await query.ToPageAsync(parm);
return await query.ToPageAsync(parm);
}
/// <summary>
/// <summary>
/// 添加或修改商品服务与承诺关系表
/// </summary>
public async Task<string> AddOrUpdateGoodsServicesRel(GoodsServicesRel model)
{
if (model.GoodsServicesRelId != 0)
if (model.Id != 0)
{
var response = await _GoodsServicesRelRepository.UpdateAsync(model);
return "修改成功!";
@ -83,10 +83,10 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsServicesRels
#endregion
#endregion
#endregion
}
}

View File

@ -45,6 +45,7 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsServicess
//开始拼装查询条件d
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(parm.GoodsServicesIsDefault != null, s => s.GoodsServicesIsDefault == parm.GoodsServicesIsDefault);
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 Microsoft.AspNetCore.Authorization;
using ARW.Admin.WebApi.Framework;
using ARW.Service.Business.IBusinessService.ShopManager.Shops;
namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
@ -30,14 +31,16 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
public class GoodsServicesController : BaseController
{
private readonly IGoodsServicesService _GoodsServicesService;
private readonly IShopService _ShopService;
/// <summary>
/// 依赖注入
/// </summary>
/// <param name="GoodsServicesService">商品服务与承诺服务</param>
public GoodsServicesController(IGoodsServicesService GoodsServicesService)
public GoodsServicesController(IGoodsServicesService GoodsServicesService, IShopService shopService)
{
_GoodsServicesService = GoodsServicesService;
_ShopService = shopService;
}
@ -50,6 +53,14 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
[ActionPermissionFilter(Permission = "business:goodsservices:list")]
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);
return SUCCESS(res);
}
@ -66,10 +77,18 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
{
if (parm == null) { throw new CustomException("请求参数错误"); }
var modal = new GoodsServices();
var modal = new GoodsServices();
if (parm.GoodsServicesId != 0) modal = parm.Adapt<GoodsServices>().ToUpdate(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);
return SUCCESS(res);
}
@ -88,16 +107,16 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
var response = _GoodsServicesService.Delete(idsArr);
return SUCCESS("删除成功!");
}
/// <summary>
/// <summary>
/// 导出商品服务与承诺
/// </summary>
/// <returns></returns>
[Log(Title = "商品服务与承诺导出", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
[HttpGet("exportGoodsServices")]
[ActionPermissionFilter(Permission = "business:goodsservices:export")]
public async Task<IActionResult> ExportExcel([FromQuery] GoodsServicesQueryDto parm)
public async Task<IActionResult> ExportExcel([FromQuery] GoodsServicesQueryDto parm)
{
parm.PageSize = 10000;
var list = await _GoodsServicesService.GetGoodsServicesList(parm);
@ -116,7 +135,7 @@ namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsServicess
data = selectDataList;
}
// 导出数据处理
var handleData = await _GoodsServicesService.HandleExportData(data);