Commit 81ae2c0d authored by 吴春's avatar 吴春

提交代码

parent 4f2a751e
using Mall.Model.Entity.BaseSetUp;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.GuideCar
{
/// <summary>
/// 司导-站点扩展表
/// </summary>
public class RB_GuideCar_SiteRegion_Extend : RB_GuideCar_SiteRegion
{
/// <summary>
/// 地区名字
/// </summary>
public string RegionName { get; set; }
public string PriceIds { get; set; }
/// <summary>
/// 地区父级id
/// </summary>
public int ParentID { get; set; }
/// <summary>
/// 地区父级的父级id
/// </summary>
public int GrandpaID { get; set; }
}
}
using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Extend.GuideCar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.GuideCar
{
public class RB_GuideCar_SiteRegionRepository:BaseRepository<RB_GuideCar_SiteRegion>
{
// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_GuideCar_SiteRegion); } }
// <summary>
/// 表名称
/// </summary>
public string DestinationTableName { get { return nameof(RB_Destination); } }
/// <summary>
/// 获取物流地区列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_GuideCar_SiteRegion_Extend> GetListRepository(RB_GuideCar_SiteRegion_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.*,b.`Name` as RegionName,b.ParentID,c.ParentID as GrandpaID FROM {TableName} as a
LEFT JOIN {DestinationTableName} as b on a.RegionId = b.ID
LEFT JOIN {DestinationTableName} as c on b.ParentID = c.ID WHERE a.{nameof(RB_GuideCar_SiteRegion_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.TenantId)}={query.TenantId}");
}
if (query.RulesType > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.RulesType)}={(int)query.RulesType}");
}
if (query.MallBaseId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.RulesPriceId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.RulesPriceId)}={query.RulesPriceId}");
}
if (!string.IsNullOrWhiteSpace(query.PriceIds))
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.RulesPriceId)} in ({query.PriceIds})");
}
}
return Get<RB_GuideCar_SiteRegion_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 获取物流地区列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_GuideCar_SiteRegion_Extend> GetListForSingle(RB_GuideCar_SiteRegion_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.* FROM {TableName} as a WHERE a.{nameof(RB_GuideCar_SiteRegion_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.TenantId)}={query.TenantId}");
}
if (query.RulesType > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.RulesType)}={(int)query.RulesType}");
}
if (query.MallBaseId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.RulesPriceId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.RulesPriceId)}={query.RulesPriceId}");
}
if (!string.IsNullOrWhiteSpace(query.PriceIds))
{
builder.Append($" AND a.{nameof(RB_GuideCar_SiteRegion_Extend.RulesPriceId)} in ({query.PriceIds})");
}
}
return Get<RB_GuideCar_SiteRegion_Extend>(builder.ToString()).ToList();
}
}
}
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