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_BaseRepository : BaseRepository<RB_Teaching_Rewards_Base>
    {
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="demodel"></param>
        /// <param name="orderIds"></param>
        /// <returns></returns>
        public List<RB_Teaching_Rewards_Base_ViewModel> GetList(RB_Teaching_Rewards_Base_ViewModel demodel)
        {
            string where = $@" 1=1";
            
            if (demodel.School_Id > 0)
            {
                where += $@" and {nameof(RB_Teaching_Rewards_Base.School_Id)} ={demodel.School_Id}";
            }
            if (demodel.Type > 0)
            {
                where += $@" and {nameof(RB_Teaching_Rewards_Base.Type)} ={demodel.Type}";
            }

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