Commit b484f72d authored by liudong1993's avatar liudong1993

修改优惠券查询

parent e2cc26c4
......@@ -1112,8 +1112,8 @@ namespace Mall.Module.Product
if (cList.Any())
{
string cIds = string.Join(",", cList.Select(x => x.CouponId).Distinct());
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds);
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, true);
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds, true);
if (dcList.Any())
{
foreach (var item in cList)
......@@ -2032,8 +2032,8 @@ namespace Mall.Module.Product
if (cList.Any())
{
string cIds = string.Join(",", cList.Select(x => x.CouponId).Distinct());
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds);
dcList = discountCouponRepository.GetDiscountCouponList(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, true);
dcpList = discountCoupon_ProductRepository.GetListByDiscountCouponIds(new Model.Entity.MarketingCenter.RB_DiscountCoupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds, true);
if (dcList.Any())
{
foreach (var item in cList)
......
......@@ -57,10 +57,17 @@ namespace Mall.Repository.MarketingCenter
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_DiscountCoupon_Extend> GetDiscountCouponList(RB_DiscountCoupon_Extend query)
public List<RB_DiscountCoupon_Extend> GetDiscountCouponList(RB_DiscountCoupon_Extend query,bool IsSelectDel = false)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_DiscountCoupon_Extend.Status)}=0 ");
if (IsSelectDel)
{
builder.Append($" SELECT * FROM {TableName} WHERE 1=1 ");
}
else
{
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_DiscountCoupon_Extend.Status)}=0 ");
}
if (query != null)
{
if (query.ID > 0)
......
......@@ -60,7 +60,7 @@ namespace Mall.Repository.MarketingCenter
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_DiscountCoupon_Product_Extend> GetListByDiscountCouponIds(RB_DiscountCoupon query, string DiscountCouponIds)
public List<RB_DiscountCoupon_Product_Extend> GetListByDiscountCouponIds(RB_DiscountCoupon query, string DiscountCouponIds,bool IsSelectDel =false)
{
StringBuilder builder = new StringBuilder();
......@@ -80,7 +80,14 @@ namespace Mall.Repository.MarketingCenter
{
builder.Append($" AND a.{nameof(RB_DiscountCoupon_Product.DiscountCouponId)} in ({DiscountCouponIds})");
}
string sql = $"SELECT a.* from {TableName} as a WHERE a.{nameof(RB_DiscountCoupon_Product.Status)}=0 {builder.ToString()} ";
string sql = "";
if (IsSelectDel)
{
sql = $"SELECT a.* from {TableName} as a WHERE 1=1 ";
}
else {
sql = $"SELECT a.* from {TableName} as a WHERE a.{nameof(RB_DiscountCoupon_Product.Status)}=0 {builder.ToString()} ";
}
if (query.UseType == Common.Enum.MarketingCenter.UseTypeEnum.Category)
{
sql = $" SELECT a.*,b.`Name` as Relevance from {TableName} as a LEFT JOIN {PCategoryTableName} as b on a.ProductId=b.Id WHERE a.{nameof(RB_DiscountCoupon_Product.Status)}=0 {builder.ToString()} ";
......
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