Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
practical_train
Commits
9dcd39be
Commit
9dcd39be
authored
Aug 24, 2026
by
wujipeng
Browse files
根据学生id查询最近的一场考试
parent
0e26d1b5
Changes
5
Show whitespace changes
Inline
Side-by-side
practical-business/src/main/java/com/platform/business/controller/ExamController.java
View file @
9dcd39be
...
@@ -4,6 +4,7 @@ import com.platform.business.model.dto.ExamDTO;
...
@@ -4,6 +4,7 @@ import com.platform.business.model.dto.ExamDTO;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.model.vo.ExamStudentVO
;
import
com.platform.business.model.vo.ExamVO
;
import
com.platform.business.model.vo.ExamVO
;
import
com.platform.business.service.ExamService
;
import
com.platform.business.service.ExamService
;
import
com.platform.business.service.ExamStudentService
;
import
com.platform.controller.BaseController
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
import
com.platform.model.resp.Result
;
import
com.platform.page.TableDataInfo
;
import
com.platform.page.TableDataInfo
;
...
@@ -17,6 +18,8 @@ public class ExamController extends BaseController {
...
@@ -17,6 +18,8 @@ public class ExamController extends BaseController {
@Resource
@Resource
private
ExamService
examService
;
private
ExamService
examService
;
@Resource
private
ExamStudentService
examStudentService
;
@PostMapping
(
"/page"
)
@PostMapping
(
"/page"
)
public
TableDataInfo
page
(
@RequestBody
ExamDTO
examDTO
)
{
public
TableDataInfo
page
(
@RequestBody
ExamDTO
examDTO
)
{
...
@@ -53,4 +56,9 @@ public class ExamController extends BaseController {
...
@@ -53,4 +56,9 @@ public class ExamController extends BaseController {
return
getDataTable
(
examService
.
classExamScore
(
examDTO
));
return
getDataTable
(
examService
.
classExamScore
(
examDTO
));
}
}
@ApiOperation
(
value
=
"根据学生id查询最近的一场考试"
)
@GetMapping
(
"/student/recent/{studentId}"
)
public
Result
<
ExamStudentVO
>
recent
(
@PathVariable
String
studentId
)
{
return
Result
.
data
(
examStudentService
.
recent
(
studentId
));
}
}
}
practical-business/src/main/java/com/platform/business/mapper/ExamStudentMapper.java
View file @
9dcd39be
...
@@ -19,4 +19,8 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudentEntity> {
...
@@ -19,4 +19,8 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudentEntity> {
List
<
ExamStudentVO
>
queryOneselfTeacher
(
@Param
(
"userId"
)
String
userId
);
List
<
ExamStudentVO
>
queryOneselfTeacher
(
@Param
(
"userId"
)
String
userId
);
ExamStudentVO
recent
(
@Param
(
"studentId"
)
String
studentId
);
List
<
ExamStudentVO
>
theSameEvent
(
@Param
(
"examId"
)
Integer
examId
);
}
}
practical-business/src/main/java/com/platform/business/service/ExamStudentService.java
View file @
9dcd39be
...
@@ -22,4 +22,6 @@ public interface ExamStudentService extends IService<ExamStudentEntity> {
...
@@ -22,4 +22,6 @@ public interface ExamStudentService extends IService<ExamStudentEntity> {
List
<
ExamStudentVO
>
queryOneselfTeacher
(
String
userId
);
List
<
ExamStudentVO
>
queryOneselfTeacher
(
String
userId
);
ExamStudentVO
recent
(
String
studentId
);
}
}
practical-business/src/main/java/com/platform/business/service/impl/ExamStaudentServiceImpl.java
View file @
9dcd39be
...
@@ -33,4 +33,12 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam
...
@@ -33,4 +33,12 @@ public class ExamStaudentServiceImpl extends ServiceImpl<ExamStudentMapper, Exam
return
baseMapper
.
queryOneselfTeacher
(
userId
);
return
baseMapper
.
queryOneselfTeacher
(
userId
);
}
}
@Override
public
ExamStudentVO
recent
(
String
studentId
)
{
ExamStudentVO
examStudentVO
=
baseMapper
.
recent
(
studentId
);
//获取同一场考试的学生
List
<
ExamStudentVO
>
data
=
baseMapper
.
theSameEvent
(
examStudentVO
.
getExamId
());
examStudentVO
.
setData
(
data
);
return
examStudentVO
;
}
}
}
practical-business/src/main/resources/com/platform/business/mapper/ExamStudentMapper.xml
View file @
9dcd39be
...
@@ -70,4 +70,29 @@
...
@@ -70,4 +70,29 @@
e.chief_id = #{userId} or e.invigilation_id like concat('%',#{userId},'%')
e.chief_id = #{userId} or e.invigilation_id like concat('%',#{userId},'%')
);
);
</select>
</select>
<select
id=
"recent"
resultType=
"com.platform.business.model.vo.ExamStudentVO"
>
select u.level as lev,
e.type,
e.name as examName,
es.start_time as startTime,
es.duration,
e.forbid,
e.chief_id as chiefId,
e.invigilation_id as invigilationId,
es.exam_id as examId,
c.name as className
from exam_student es
left join exam e on es.exam_id = e.id
left join user u on es.student_id = u.id
left join class c on e.class_id = c.id
where u.id = #{studentId}
order by es.start_time desc
limit 1
</select>
<select
id=
"theSameEvent"
resultType=
"com.platform.business.model.vo.ExamStudentVO"
>
select es.student_id as studentId, u.nick_name as studentName
from exam_student es
left join user u on es.student_id = u.id
where es.exam_id = #{examId}
</select>
</mapper>
</mapper>
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