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

namespace Mall.Repository.Reserve
{
  public  class RB_Reserve_FenXiaoPosterRepository:BaseRepository<RB_Reserve_FenXiaoPoster>
    {
        /// <summary>
        /// 根据查询条件获取小程序用户中心配置实体
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns></returns>
        public RB_Reserve_FenXiaoPoster_Extend GetEntityExtRepository(RB_Reserve_FenXiaoPoster_Extend query)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append(" SELECT * FROM RB_Reserve_FenXiaoPoster WHERE 1=1 ");
            if (query != null)
            {
                if (query.TenantId > 0)
                {
                    builder.AppendFormat(" AND TenantId={0} ", query.TenantId);
                }
                if (query.MallBaseId > 0)
                {
                    builder.AppendFormat(" AND MallBaseId={0} ", query.MallBaseId);
                }
                if (query.Id > 0)
                {
                    builder.AppendFormat(" AND Id={0} ", query.Id);
                }
                if (query.IsOpenReserve >= 0)
                {
                    builder.AppendFormat(" AND IsOpenReserve={0} ", query.IsOpenReserve);
                }
            }
            return Get<RB_Reserve_FenXiaoPoster_Extend>(builder.ToString()).FirstOrDefault();
        }
    }
}
