Commit f1b81fcd authored by 黄奎's avatar 黄奎

新增关联商品

parent 8db879f8
[*.cs]
# IDE1006: 命名样式
dotnet_diagnostic.IDE1006.severity = none
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
using System;
using VT.FW.DB;
namespace Mall.Model.Entity.Product
{
/// <summary>
/// 商品关联表信息
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Relevance
{
/// <summary>
/// 关联商品主键编号
/// </summary>
public int RelevanceId { get; set; }
/// <summary>
/// 商品编号
/// </summary>
public int GoodsId { get; set; }
/// <summary>
/// 关联商品名称
/// </summary>
public string RelevanceName { get; set; }
/// <summary>
/// 关联商品价格
/// </summary>
public decimal RelevancePrice { get; set; }
/// <summary>
/// 关联商品状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 规格
/// </summary>
public string Unit { get; set; }
/// <summary>
/// 商户编号
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序编号
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 关联物品Id
/// </summary>
public int RelationId { get; set; }
}
}
...@@ -307,6 +307,11 @@ namespace Mall.Model.Extend.Product ...@@ -307,6 +307,11 @@ namespace Mall.Model.Extend.Product
/// </summary> /// </summary>
public List<RB_Goods_MemberPrice_Extend> MemberPriceTreeList { get; set; } public List<RB_Goods_MemberPrice_Extend> MemberPriceTreeList { get; set; }
/// <summary>
/// 关联商品列表
/// </summary>
public List<RB_Goods_Relevance_Extend> RelevanceList { get; set; }
/// <summary> /// <summary>
/// 是否收藏 true/false /// 是否收藏 true/false
/// </summary> /// </summary>
......
using Mall.Model.Entity.Product;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品关联表扩展实体信息
/// </summary>
public class RB_Goods_Relevance_Extend : RB_Goods_Relevance
{
}
}
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
using System; using Mall.Common;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Mall.AOP.CustomerAttribute;
using Mall.Common;
using Mall.Common.API; using Mall.Common.API;
using Mall.Common.Plugin; using Mall.Common.Plugin;
using Mall.Model.Entity.Product; using Mall.Model.Entity.Product;
...@@ -14,15 +8,17 @@ using Mall.Model.Extend.Product; ...@@ -14,15 +8,17 @@ using Mall.Model.Extend.Product;
using Mall.Model.Extend.Reserve; using Mall.Model.Extend.Reserve;
using Mall.Model.Extend.User; using Mall.Model.Extend.User;
using Mall.Model.Query; using Mall.Model.Query;
using Mall.Repository;
using Mall.Repository.BaseSetUp; using Mall.Repository.BaseSetUp;
using Mall.Repository.MarketingCenter; using Mall.Repository.MarketingCenter;
using Mall.Repository.Product; using Mall.Repository.Product;
using Mall.Repository.Reserve; using Mall.Repository.Reserve;
using Mall.Repository.User; using Mall.Repository.User;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using System;
using NPOI.SS.Formula.Functions; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using VT.FW.DB; using VT.FW.DB;
namespace Mall.Module.Product namespace Mall.Module.Product
...@@ -217,6 +213,12 @@ namespace Mall.Module.Product ...@@ -217,6 +213,12 @@ namespace Mall.Module.Product
/// 分享仓储层对象 /// 分享仓储层对象
/// </summary> /// </summary>
private readonly RB_Share_FriendRepository share_FriendRepository = new RB_Share_FriendRepository(); private readonly RB_Share_FriendRepository share_FriendRepository = new RB_Share_FriendRepository();
/// <summary>
/// 关联商品仓储层对象
/// </summary>
private readonly RB_Goods_RelevanceRepository goods_RelevanceRepository = new RB_Goods_RelevanceRepository();
#region 教育咖啡劵 #region 教育咖啡劵
/// <summary> /// <summary>
/// 教育商品 /// 教育商品
...@@ -8002,6 +8004,7 @@ namespace Mall.Module.Product ...@@ -8002,6 +8004,7 @@ namespace Mall.Module.Product
/// <returns></returns> /// <returns></returns>
public RB_Goods_Extend GetProductGoodsInfo(int goodsId, int TenantId, int MallBaseId) public RB_Goods_Extend GetProductGoodsInfo(int goodsId, int TenantId, int MallBaseId)
{ {
var model = goodsRepository.GetEntity(goodsId).RefMapperTo<RB_Goods_Extend>(); var model = goodsRepository.GetEntity(goodsId).RefMapperTo<RB_Goods_Extend>();
if (model == null || model.TenantId != TenantId || model.MallBaseId != MallBaseId) if (model == null || model.TenantId != TenantId || model.MallBaseId != MallBaseId)
{ {
...@@ -8333,6 +8336,12 @@ namespace Mall.Module.Product ...@@ -8333,6 +8336,12 @@ namespace Mall.Module.Product
{ {
model.FormsName = "默认表单"; model.FormsName = "默认表单";
} }
model.RelevanceList= goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend()
{
TenantId = model.TenantId,
MallBaseId = model.MallBaseId,
GoodsId = model.Id
});
return model; return model;
} }
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品关联表仓储层
/// </summary>
public class RB_Goods_RelevanceRepository : BaseRepository<RB_Goods_Relevance>
{
/// <summary>
/// 获取关联商品列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Goods_Relevance_Extend> GetGoodsRelevanceListRepository(RB_Goods_Relevance_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Goods_Relevance AS A
WHERE 1=1
");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Goods_Relevance_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Goods_Relevance_Extend.MallBaseId), query.MallBaseId);
}
if (query.GoodsId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Goods_Relevance_Extend.GoodsId), query.GoodsId);
}
return Get<RB_Goods_Relevance_Extend>(builder.ToString()).ToList();
}
}
}
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
...@@ -1829,7 +1829,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1829,7 +1829,8 @@ namespace Mall.WebApi.Controllers.MallBase
model?.GoodsUrl, model?.GoodsUrl,
model?.goodsLogo, model?.goodsLogo,
model?.GoodsEduType, model?.GoodsEduType,
model?.MaterialId model?.MaterialId,
RelevanceList= model?.RelevanceList.Select(qitem => new { qitem.RelevanceId, qitem.RelevanceName, qitem.RelevancePrice, qitem.Unit })
}; };
} }
return ApiResult.Success("", obj); return ApiResult.Success("", obj);
......
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel> <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment