using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Common.Enum;
using Edu.Model.Entity.App;

namespace Edu.Repository.App
{
    /// <summary>
    ///  app首页bannerLabel仓储层
    /// </summary>
    public class RB_HomePage_LableRepository : BaseRepository<RB_HomePage_Lable>
    {
        /// <summary>
        /// 获取学生app首页Lable列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_HomePage_Lable> GetHomePageLableList(RB_HomePage_Lable query)
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendFormat(@" SELECT *  FROM RB_HomePage_Lable  WHERE 1=1  ");
            builder.AppendFormat(" AND {0}={1} ", nameof(RB_HomePage_Lable.Status), (int)DateStateEnum.Normal);
            if (query != null)
            {
                if (query.Group_Id > 0)
                {
                    builder.AppendFormat(" AND {0}={1} ", nameof(RB_HomePage_Lable.Group_Id), query.Group_Id);
                }
                if (query.School_Id > 0)
                {
                    builder.AppendFormat(" AND {0}={1} ", nameof(RB_HomePage_Lable.School_Id), query.School_Id);
                }
            }
            return Get<RB_HomePage_Lable>(builder.ToString()).ToList();
        }
    }
}
