using Edu.Model.Entity.Customer;
using Edu.Model.ViewModel.Customer;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using VT.FW.DB.Dapper;
using Edu.Common.Enum;

namespace Edu.Repository.Customer
{
    /// <summary>
    /// 同业幻灯片仓储层对象
    /// </summary>
    public class RB_B2B_SlideShowRepository : BaseRepository<RB_B2B_SlideShow>
    {
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_B2B_SlideShow_Extend> GetList(RB_B2B_SlideShow_Extend query)
        {
            var parameters = new DynamicParameters();
            StringBuilder builder = new StringBuilder();
            builder.AppendFormat(@" 
SELECT A.*
FROM  RB_B2B_SlideShow AS A
WHERE 1=1
");
            builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_B2B_SlideShow_Extend.Status), (int)DateStateEnum.Normal);
            if (query != null)
            {
                if (query.Group_Id > 0)
                {
                    builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_B2B_SlideShow_Extend.Group_Id), query.Group_Id);
                }
            }
            return Get<RB_B2B_SlideShow_Extend>(builder.ToString(), parameters).ToList();
        }
    }
}
