Browse Source

Merge branch 'feature/exam' into test
合并冲突

guqiang 11 hours ago
parent
commit
af5c0e16e8

+ 1 - 1
src/Hotline.Application/Exam/QueryExtensions/Questions/QuestionQueryExtesions.cs

@@ -49,7 +49,7 @@ namespace Hotline.Application.Exam.QueryExtensions.Questions
             Expression<Func<ExamQuestionKnowladge, bool>> expression = m => m.Id != null;
 
             expression = ExpressionableUtility.CreateExpression<ExamQuestionKnowladge>().
-            AndIF(questionPagedRequest.KnowladgeIds.IsNotNullOrEmpty(), x => questionPagedRequest.KnowladgeIds.Contains(x.QuestionId))
+            AndIF(questionPagedRequest.KnowladgeIds.IsNotNullOrEmpty(), x => questionPagedRequest.KnowladgeIds.Contains(x.KnowladgeId))
             .ToExpression();
 
             return expression;

+ 5 - 1
src/Hotline.Application/Exam/Service/Questions/QuestionService.cs

@@ -142,10 +142,14 @@ namespace Hotline.Application.Exam.Service.Questions
             var examTagTable = examTagRepository.Queryable().Where(examTagExpression);
             var allExamTagTable = examTagRepository.Queryable();
 
+            var questionKnowladgeExpression = queryRequest.GetQuestionKnowladgeExpression();
+            var questionKnowladgeTable = new ExamRepository<ExamQuestionKnowladge>(_uow, _dataPermissionFilterBuilder, _serviceProvider).Queryable().Where(questionKnowladgeExpression);
+
 
             var queryable = questionTable.InnerJoin(questionTagTable, (s, d) => s.Id == d.QuestionId).InnerJoin(examTagTable, (s,d, t) => d.TagId == t.Id)
+                .InnerJoin(questionKnowladgeTable, (s, d, t,k) => s.Id == k.QuestionId)
             .Distinct()
-            .Select((s, d, t) => new QuestionViewResponse
+            .Select((s, d, t, k) => new QuestionViewResponse
             {
                 DifficultyLevel = s.DifficultyLevel,
                 FormalEnable = s.FormalEnable,

+ 1 - 1
src/Hotline.Share/Dtos/Trains/TrainRecordDto.cs

@@ -106,7 +106,7 @@ namespace Hotline.Share.Dtos.Trains
         /// <summary>
         /// 答案
         /// </summary>
-        public AddTrainRecordAnswerDto AddTrainRecordAnswerDto { get; set; }
+        public AddTrainRecordAnswerDto? AddTrainRecordAnswerDto { get; set; }
 
         ///// <summary>
         ///// 知识Id