using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Edu.Repository.Course
{
    /// <summary>
    /// 学员退课单据审核记录仓储层
    /// </summary>
    public class RB_Student_BackRecordRepository : BaseRepository<RB_Student_BackRecord>
    {
        /// <summary>
        /// 获取学员退课单据审核记录列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_Student_BackRecord_ViewModel> GetStudentBackRecordListRepository(RB_Student_BackRecord_ViewModel query)
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendFormat(@"
SELECT * 
FROM RB_Student_BackRecord
WHERE 1=1
");
            if (query != null)
            {
                if (query.ConditionId > 0)
                {
                    builder.AppendFormat(" AND {0}={1} ", nameof(RB_Student_BackRecord_ViewModel.ConditionId), query.ConditionId);
                }
                if (query.AuditStatus > 0)
                {
                    builder.AppendFormat(" AND {0}={1} ", nameof(RB_Student_BackRecord_ViewModel.AuditStatus), query.AuditStatus);
                }
            }
            return Get<RB_Student_BackRecord_ViewModel>(builder.ToString()).ToList();
        }
    }
}
