|
@@ -385,17 +385,17 @@ namespace Hotline.Application.Exam.Service.TestPapers
|
|
|
var tagQuestionTable = tagQuestionRepository.Queryable().Where(expression);
|
|
|
var questionTable = quesitonRepository.Queryable().Where(questionExpression);
|
|
|
|
|
|
- var taqQuestions = await tagQuestionTable.InnerJoin(questionTable,(t,q)=>t.QuestionId == q.Id)
|
|
|
- .Select((t,q)=>t)
|
|
|
+ var taqQuestions = await tagQuestionTable.LeftJoin(questionTable, (t, q) => t.QuestionId == q.Id)
|
|
|
+ .Select((t, q) => new TagQuestionCountViewResponse
|
|
|
+ {
|
|
|
+ TotalCount = SqlFunc.AggregateCount(t.Id)
|
|
|
+ })
|
|
|
.ToListAsync();
|
|
|
|
|
|
- var result = taqQuestions.GroupBy(x => x.TagId).Select(m => new TagQuestionCountViewResponse
|
|
|
+ return taqQuestions.Count()> 0?taqQuestions.FirstOrDefault():new TagQuestionCountViewResponse
|
|
|
{
|
|
|
- TagId = m.Key,
|
|
|
- TotalCount = m.Count()
|
|
|
- });
|
|
|
-
|
|
|
- return result.FirstOrDefault();
|
|
|
+ TotalCount = 0
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
#endregion
|