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
502dfe7e
Commit
502dfe7e
authored
Jan 08, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
题库查询
parent
a20d9c92
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
3 deletions
+46
-3
RB_Question_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
+5
-0
RB_QuestionRepository.cs
Edu.Repository/Question/RB_QuestionRepository.cs
+14
-1
QuestionController.cs
Edu.WebApi/Controllers/Course/QuestionController.cs
+27
-2
No files found.
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
View file @
502dfe7e
...
...
@@ -58,5 +58,10 @@ namespace Edu.Model.ViewModel.Question
/// </summary>
public
object
AnswerObj
{
get
;
set
;
}
/// <summary>
/// 知识点名称
/// </summary>
public
string
PointName
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Repository/Question/RB_QuestionRepository.cs
View file @
502dfe7e
...
...
@@ -54,7 +54,7 @@ WHERE 1=1
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*,IFNULL(B.`Name` ,'') AS QuestionTypeName
FROM RB_Question AS A LEFT JOIN RB_Question_Type B ON A.QuestionTypeId=B.QId
FROM RB_Question AS A LEFT JOIN RB_Question_Type B ON A.QuestionTypeId=B.QId
WHERE 1=1 "
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Question_ViewModel
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
==
null
)
...
...
@@ -72,6 +72,19 @@ WHERE 1=1 ");
builder
.
AppendFormat
(
" AND A.{0} LIKE @Title "
,
nameof
(
RB_Question_ViewModel
.
Title
));
parameters
.
Add
(
"Title"
,
"%"
+
query
.
Title
.
Trim
()
+
"%"
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
PointName
))
{
builder
.
Append
(
@" AND A.Knowledge<>'' AND EXISTS (SELECT 1 FROM rb_question_point WHERE PointId IN(A.Knowledge) AND A.CourseId=CourseId AND PointName LIKE @PointName ) "
);
parameters
.
Add
(
"PointName"
,
"%"
+
query
.
PointName
.
Trim
()
+
"%"
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QQuestionTypeStr
))
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Question_ViewModel
.
QuestionTypeId
),
query
.
QQuestionTypeStr
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QDifficultyType
))
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Question_ViewModel
.
DifficultyType
),
query
.
QDifficultyType
);
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_Question_ViewModel
.
QuestionId
));
return
GetPage
<
RB_Question_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
...
...
Edu.WebApi/Controllers/Course/QuestionController.cs
View file @
502dfe7e
...
...
@@ -48,9 +48,34 @@ namespace Edu.WebApi.Controllers.Course
var
query
=
new
RB_Question_ViewModel
()
{
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
),
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
),
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
PointName
=
base
.
ParmJObj
.
GetStringValue
(
"PointName"
),
};
try
{
var
DifficultyTypeList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
int
>>(
base
.
ParmJObj
.
GetStringValue
(
"DifficultyType"
));
if
(
DifficultyTypeList
!=
null
&&
DifficultyTypeList
.
Count
>
0
&&
!
DifficultyTypeList
.
Contains
(
0
))
{
query
.
QDifficultyType
=
string
.
Join
(
","
,
DifficultyTypeList
);
}
}
catch
{
}
try
{
var
QuestionTypeIdList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
int
>>(
base
.
ParmJObj
.
GetStringValue
(
"QuestionTypeId"
));
if
(
QuestionTypeIdList
!=
null
&&
QuestionTypeIdList
.
Count
>
0
)
{
query
.
QQuestionTypeStr
=
string
.
Join
(
","
,
QuestionTypeIdList
);
}
}
catch
{
}
var
list
=
questionModule
.
GetQuestionPageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
List
<
object
>
resultList
=
new
List
<
object
>();
foreach
(
var
item
in
list
)
...
...
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