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

namespace Edu.Repository.Course
{
    /// <summary>
    /// 活动配置仓储层
    /// </summary>
    public class RB_Activity_ConfigRepository : BaseRepository<RB_Activity_Config>
    {
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="demodel"></param>
        /// <param name="orderIds"></param>
        /// <returns></returns>
        public List<RB_Activity_Config_ViewModel> GetList(RB_Activity_Config_ViewModel demodel)
        {
            string where = $@" 1=1 and r.Status =0";
            if (demodel.Group_Id > 0)
            {
                where += $@" and r.{nameof(RB_Activity_Config.Group_Id)} ={demodel.Group_Id}";
            }
            if (demodel.Type > 0)
            {
                where += $@" and r.{nameof(RB_Activity_Config.Type)} ={demodel.Type}";
            }

            string sql = $@" 
SELECT * From RB_Activity_Config r
WHERE {where} 
ORDER BY r.Id DESC ";
            return Get<RB_Activity_Config_ViewModel>(sql).ToList();
        }

    }
}