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

namespace Edu.Repository.Sell
{
    /// <summary>
    /// 教务奖励-概率仓储层
    /// </summary>
    public class RB_Teaching_Rewards_RateRepository : BaseRepository<RB_Teaching_Rewards_Rate>
    {
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="demodel"></param>
        /// <returns></returns>
        public List<RB_Teaching_Rewards_Rate_ViewModel> GetList(RB_Teaching_Rewards_Rate_ViewModel demodel)
        {
            string where = $@" 1=1";
            
            if (demodel.School_Id > 0)
            {
                where += $@" and {nameof(RB_Teaching_Rewards_Rate.School_Id)} ={demodel.School_Id}";
            }
            if (demodel.Type > 0)
            {
                where += $@" and {nameof(RB_Teaching_Rewards_Rate.Type)} ={demodel.Type}";
            }
            if (demodel.RateType > 0)
            {
                where += $@" and {nameof(RB_Teaching_Rewards_Rate.RateType)} ={demodel.RateType}";
            }

            string sql = $@" select * from RB_Teaching_Rewards_Rate where {where} order by Id desc";
            return Get<RB_Teaching_Rewards_Rate_ViewModel>(sql).ToList();
        }
    }
}
