using Edu.Model.Entity.Contract;
using Edu.Model.ViewModel.Contract;
using System.Collections.Generic;
using System.Linq;

namespace Edu.Repository.Contract
{
    /// <summary>
    /// 教育合同仓储层
    /// </summary>
    public class RB_Education_ContractAdjustRepository : BaseRepository<RB_Education_ContractAdjust>
    {

        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="demodel"></param>
        /// <param name="orderIds"></param>
        /// <returns></returns>
        public List<RB_Education_ContractAdjust_ViewModel> GetList(RB_Education_ContractAdjust_ViewModel demodel)
        {            
            string where = $@" 1=1";
            if (demodel.Group_Id > 0)
            {
                where += $@" AND {nameof(RB_Education_ContractAdjust_ViewModel.Group_Id)} ={demodel.Group_Id}";
            }
            if (demodel.ContractId > 0)
            {
                where += $@" AND {nameof(RB_Education_ContractAdjust_ViewModel.ContractId)} ={demodel.ContractId}";
            }

            string sql = $@" SELECT * FROM RB_Education_ContractAdjust WHERE {where} ORDER BY Id DESC";
            return Get<RB_Education_ContractAdjust_ViewModel>(sql).ToList();
        }
    }
}