using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mall.Model.Entity.Education;

namespace Mall.Repository.Education
{
    public class RB_Education_StartUpRepository : BaseRepository<RB_Education_StartUp>
    {
        /// <summary>
        /// 获取启动页信息
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns></returns>
        public List<RB_Education_StartUp> GetListRepository(RB_Education_StartUp query)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append($" SELECT * FROM RB_Education_StartUp WHERE {nameof(RB_Education_StartUp.Status)}=0");
            if (query != null)
            {
                if (query.TenantId > 0)
                {
                    builder.Append($" AND {nameof(RB_Education_StartUp.TenantId)}={query.TenantId}");
                }
                if (query.MallBaseId > 0)
                {
                    builder.Append($" AND {nameof(RB_Education_StartUp.MallBaseId)}={query.MallBaseId}");
                }
            }
            return Get<RB_Education_StartUp>(builder.ToString()).ToList();
        }
    }
}
