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

namespace Edu.Repository.Exam
{
    /// <summary>
    /// 单词测试详情仓储层
    /// </summary>
    public class RB_StuWords_ExamDetailRepository : BaseRepository<RB_StuWords_ExamDetail>
    {
        /// <summary>
        /// 获取学员单词测试详情列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_StuWords_ExamDetail_Extend> GetStuWordsExamDetailListRepository(RB_StuWords_ExamDetail_Extend query)
        {
            StringBuilder builder = new StringBuilder();
            builder.AppendFormat(@"
SELECT A.*
FROM RB_StuWords_ExamDetail AS A
WHERE 1=1
");
            if (query != null)
            {
                if (query.ExamId > 0)
                {
                    builder.AppendFormat(" A.{0}={1} ", nameof(RB_StuWords_ExamDetail_Extend.ExamId), query.ExamId);
                }
                if (!string.IsNullOrEmpty(query.QExamIds))
                {
                    builder.AppendFormat(" A.{0} IN({1}) ", nameof(RB_StuWords_ExamDetail_Extend.ExamId), query.QExamIds);
                }
            }
            return Get<RB_StuWords_ExamDetail_Extend>(builder.ToString()).ToList();
        }
    }
}
