using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Extend.BaseSetUp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mall.Repository.BaseSetUp
{
  public  class RB_Logistics_RulesPriceRepository:BaseRepository<RB_Logistics_RulesPrice>
    {
        /// <summary>
        /// 表名称
        /// </summary>
        public string TableName { get { return nameof(RB_Logistics_RulesPrice); } }

        /// <summary>
        /// 获取小程序列表
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns></returns>
        public List<RB_Logistics_RulesPrice_Extend> GetListRepository(RB_Logistics_RulesPrice_Extend query)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Logistics_RulesPrice_Extend.Status)}=0");
            if (query != null)
            {
                if (query.TenantId > 0)
                {
                    builder.Append($" AND {nameof(RB_Logistics_RulesPrice_Extend.TenantId)}={query.TenantId}");
                }
                if (query.TenantId > 0)
                {
                    builder.Append($" AND {nameof(RB_Logistics_RulesPrice_Extend.MallBaseId)}={query.MallBaseId}");
                }
                if (query.RulesId > 0)
                {
                    builder.Append($" AND {nameof(RB_Logistics_RulesPrice_Extend.RulesId)}={query.RulesId}");
                }
                
            }
            return Get<RB_Logistics_RulesPrice_Extend>(builder.ToString()).ToList();
        }
    }
}
