Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
86fd01de
Commit
86fd01de
authored
Aug 30, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
问题统计修改
parent
418d46b8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
6 deletions
+46
-6
RB_Question_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
+5
-0
QuestionModule.cs
Edu.Module.Question/QuestionModule.cs
+5
-6
RB_QuestionRepository.cs
Edu.Repository/Question/RB_QuestionRepository.cs
+36
-0
No files found.
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
View file @
86fd01de
...
...
@@ -111,5 +111,10 @@ namespace Edu.Model.ViewModel.Question
/// 是否返回所有字段
/// </summary>
public
int
IsShowAllQuestion
{
get
;
set
;
}
/// <summary>
/// 问题数量
/// </summary>
public
int
QuestionCount
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.Question/QuestionModule.cs
View file @
86fd01de
...
...
@@ -146,7 +146,7 @@ namespace Edu.Module.Question
public
List
<
object
>
GetQuestionCategoryListModule
(
RB_Question_ViewModel
query
)
{
List
<
object
>
list
=
new
List
<
object
>();
var
dataList
=
GetQuestionListModule
(
query
);
var
dataList
=
questionRepository
.
GetQuestionStaticsListRepository
(
query
);
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
var
questionTypeList
=
GetQuestionTypeListModule
(
new
RB_Question_Type_ViewModel
());
...
...
@@ -158,12 +158,11 @@ namespace Edu.Module.Question
{
var
qType
=
questionTypeList
?.
Where
(
qitem
=>
qitem
.
QId
==
item
.
QuestionTypeId
)?.
FirstOrDefault
();
var
diffTypeList
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
)
.
GroupBy
(
qitem
=>
new
{
qitem
.
DifficultyType
})
.
Select
(
qitem
=>
new
{
DifficultyType
=
qitem
.
Key
.
DifficultyType
,
DifficultyTypeName
=
qitem
.
Key
.
DifficultyType
.
ToName
(),
DifficultyTypeCount
=
qitem
.
Count
()
,
DifficultyType
=
qitem
.
DifficultyType
,
DifficultyTypeName
=
qitem
.
DifficultyType
.
ToName
(),
DifficultyTypeCount
=
qitem
.
QuestionCount
,
ChooseNum
=
0
});
var
obj
=
new
...
...
@@ -175,7 +174,7 @@ namespace Edu.Module.Question
QuestionDesc
=
""
,
ChooseType
=
1
,
ChooseNum
=
0
,
QuestionTypeNum
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
).
Count
(
),
QuestionTypeNum
=
dataList
.
Where
(
qitem
=>
qitem
.
QuestionTypeId
==
item
.
QuestionTypeId
).
Sum
(
qitem
=>
qitem
.
QuestionCount
),
ChooseList
=
diffTypeList
,
};
list
.
Add
(
obj
);
...
...
Edu.Repository/Question/RB_QuestionRepository.cs
View file @
86fd01de
...
...
@@ -48,6 +48,42 @@ WHERE 1=1
}
}
/// <summary>
/// 问题统计
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Question_ViewModel
>
GetQuestionStaticsListRepository
(
RB_Question_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT QuestionTypeId,DifficultyType,Count(QuestionId) AS QuestionCount
FROM RB_Question
WHERE 1=1
"
);
if
(
query
==
null
)
{
return
new
List
<
RB_Question_ViewModel
>();
}
else
{
if
(!
string
.
IsNullOrEmpty
(
query
.
QBankIds
))
{
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Question_ViewModel
.
BankId
),
query
.
QBankIds
);
}
if
(
query
.
CourseId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Question_ViewModel
.
CourseId
),
query
.
CourseId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
Q_QuestionTypeIds
))
{
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Question_ViewModel
.
QuestionTypeId
),
query
.
Q_QuestionTypeIds
);
}
builder
.
AppendFormat
(
" GROUP BY QuestionTypeId,DifficultyType "
);
return
Get
<
RB_Question_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
/// <summary>
/// 获取问题分页列表
/// </summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment