Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
exam_master
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
ai-tech
exam_master
Commits
1af32241
Commit
1af32241
authored
Jun 21, 2024
by
陈立彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
出题
parent
2051ae55
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
8 deletions
+47
-8
ExamController.java
src/main/java/cn/aibreeze/exam/api/ExamController.java
+21
-8
GetQuestionResponseResult.java
.../java/cn/aibreeze/exam/dto/GetQuestionResponseResult.java
+26
-0
No files found.
src/main/java/cn/aibreeze/exam/api/ExamController.java
View file @
1af32241
package
cn
.
aibreeze
.
exam
.
api
;
import
cn.aibreeze.exam.dto.ApiResponse
;
import
cn.aibreeze.exam.dto.GetQuestionResponseResult
;
import
cn.aibreeze.exam.dto.UpdateQuestionRequestDto
;
import
cn.aibreeze.exam.entity.ElehKnowledgeDo
;
import
cn.aibreeze.exam.entity.ElehKnowledgeTagDo
;
...
...
@@ -40,17 +41,29 @@ public class ExamController {
}
@GetMapping
(
value
=
"/get_question"
)
public
ApiResponse
<
ElehKnowledgeDo
>
getQuestion
(
@RequestParam
(
"tenant"
)
Integer
tenant
,
public
ApiResponse
<
GetQuestionResponseResult
>
getQuestion
(
@RequestParam
(
"tenant"
)
Integer
tenant
,
@RequestParam
(
"code"
)
String
code
,
@RequestParam
(
"session_id"
)
String
sessionId
,
@RequestParam
(
"user_id"
)
String
userId
)
{
ElehKnowledgeTagDo
tagDo
=
tagMapper
.
selectByCode
(
tenant
,
code
);
GetQuestionResponseResult
result
=
new
GetQuestionResponseResult
(
);
// 根据分类获取考题
ElehKnowledgeTagDo
tagDo
=
tagMapper
.
selectByCode
(
tenant
,
code
);
if
(
Objects
.
nonNull
(
tagDo
))
{
Long
maxQuestionId
=
qaRecordMapper
.
selectSessionMaxQuestionId
(
tenant
,
sessionId
,
userId
);
maxQuestionId
=
Objects
.
nonNull
(
maxQuestionId
)
?
maxQuestionId
:
0
;
ElehKnowledgeDo
knowledgeDo
=
knowledgeMapper
.
selectQuestion
(
tenant
,
tagDo
.
getId
(),
maxQuestionId
);
return
ApiResponse
.
ok
(
knowledgeDo
);
if
(
Objects
.
nonNull
(
knowledgeDo
))
{
result
.
setQuestion
(
knowledgeDo
.
getQuestion
());
result
.
setAnswer
(
knowledgeDo
.
getAnswer
());
result
.
setProject
(
tagDo
.
getName
());
result
.
setCode
(
tagDo
.
getCode
());
result
.
setNext
(
true
);
}
}
return
ApiResponse
.
ok
(
result
);
}
@PostMapping
(
value
=
"update_question"
)
...
...
src/main/java/cn/aibreeze/exam/dto/GetQuestionResponseResult.java
0 → 100644
View file @
1af32241
package
cn
.
aibreeze
.
exam
.
dto
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
public
class
GetQuestionResponseResult
implements
Serializable
{
@JsonProperty
(
"question_id"
)
private
Long
questionId
;
private
String
question
;
private
String
answer
;
private
String
project
;
private
String
code
;
private
boolean
next
=
false
;
}
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