【新增】 学生交卷之后,查询信息列表
This commit is contained in:
@@ -34,7 +34,21 @@ public class StuPaperScoreDO extends TenantBaseDO {
|
||||
*/
|
||||
private String paperId;
|
||||
/**
|
||||
* 总分
|
||||
* 试题ID
|
||||
*/
|
||||
private BigDecimal allScore;
|
||||
private String quId;
|
||||
/**
|
||||
* 得分
|
||||
*/
|
||||
private BigDecimal score;
|
||||
/**
|
||||
* 分值
|
||||
*/
|
||||
private BigDecimal trueScore;
|
||||
/**
|
||||
* 是否正确
|
||||
*/
|
||||
private int isTrue;
|
||||
|
||||
|
||||
}
|
@@ -18,6 +18,8 @@ public interface StuPaperScoreMapper extends BaseMapperX<StuPaperScoreDO> {
|
||||
|
||||
List<StuPaperScoreDO> findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
|
||||
StuScoreVo getStuScore(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
List<StuScoreVo> getStuScore(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
|
||||
// 通过学生ID,试卷ID ,试题ID,查询数据
|
||||
StuPaperScoreDO findByStuIdAndPaperIdAndQuestionId(@Param("stuId") Long stuId, @Param("paperId") String paperId, @Param("quId") String questionId);
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package pc.exam.pp.module.exam.dal.mysql.student;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -7,13 +8,18 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class StuScoreVo {
|
||||
|
||||
private Long stuId;
|
||||
@Schema(description = "学号")
|
||||
private String stuNumber;
|
||||
|
||||
@Schema(description = "任务编号")
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
private String nickName;
|
||||
|
||||
private String paperid;
|
||||
|
||||
@Schema(description = "得分")
|
||||
private BigDecimal score;
|
||||
|
||||
private String stuNumber;
|
||||
@Schema(description = "正确得分")
|
||||
private BigDecimal trueScore;
|
||||
}
|
||||
|
@@ -13,11 +13,13 @@ import java.util.List;
|
||||
*/
|
||||
public interface StuPaperScoreService {
|
||||
|
||||
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuID, String paperID);
|
||||
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId);
|
||||
|
||||
void insertStuPaperScore(StuPaperScoreDO stuPaperScoreDO);
|
||||
|
||||
void updateStuPaperScore(StuPaperScoreDO stuPaperScoreDO);
|
||||
|
||||
StuScoreVo getStuScore(Long stuID, String paperID);
|
||||
StuScoreVo getStuScore(Long stuId, String paperId);
|
||||
|
||||
StuPaperScoreDO getStuScoreByPaperIdAndQuid(Long stuId, String paperId, String quId);
|
||||
}
|
@@ -3,13 +3,13 @@ package pc.exam.pp.module.exam.service.stuPaperScore;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaper;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperFileMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperScoreMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
|
||||
import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,10 +23,12 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
|
||||
|
||||
@Resource
|
||||
private StuPaperScoreMapper stuPaperScoreMapper;
|
||||
@Resource
|
||||
private EducationPaperMapper educationPaperMapper;
|
||||
|
||||
@Override
|
||||
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuID, String paperID) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperId(stuID, paperID);
|
||||
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperId(stuId, paperId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,7 +42,35 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StuScoreVo getStuScore(Long stuID, String paperID) {
|
||||
return stuPaperScoreMapper.getStuScore(stuID, paperID);
|
||||
public StuScoreVo getStuScore(Long stuId, String paperId) {
|
||||
// 1、创建对象
|
||||
StuScoreVo stuScoreVo = new StuScoreVo();
|
||||
// 2、查询学生得分
|
||||
BigDecimal score = new BigDecimal(0);
|
||||
BigDecimal trueScore = new BigDecimal(0);
|
||||
String stuNumber = "";
|
||||
String nickName = "";
|
||||
String taskId = "";
|
||||
List<StuScoreVo> stuScoreVos = stuPaperScoreMapper.getStuScore(stuId, paperId);
|
||||
for (StuScoreVo scoreVo : stuScoreVos) {
|
||||
stuNumber = scoreVo.getStuNumber();
|
||||
nickName = scoreVo.getNickName();
|
||||
// 3、查询出来的所有分数进行相加
|
||||
score = score.add(scoreVo.getScore());
|
||||
trueScore = trueScore.add(scoreVo.getTrueScore());
|
||||
}
|
||||
stuScoreVo.setScore(score);
|
||||
stuScoreVo.setTrueScore(trueScore);
|
||||
stuScoreVo.setStuNumber(stuNumber);
|
||||
stuScoreVo.setNickName(nickName);
|
||||
// 4、通过paperId查询任务编号
|
||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId);
|
||||
stuScoreVo.setTaskId(educationPaper.getTaskId());
|
||||
return stuScoreVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StuPaperScoreDO getStuScoreByPaperIdAndQuid(Long stuId, String paperId, String quId) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperIdAndQuestionId(stuId, paperId, quId);
|
||||
}
|
||||
}
|
@@ -17,7 +17,8 @@
|
||||
SELECT
|
||||
esps.stu_id AS stuId,
|
||||
esps.paper_id AS paperId,
|
||||
esps.all_score AS score,
|
||||
esps.score AS score,
|
||||
esps.true_score AS trueScore,
|
||||
su.username AS stuNumber,
|
||||
su.nickname AS nickName
|
||||
FROM
|
||||
@@ -25,5 +26,9 @@
|
||||
LEFT JOIN system_users AS su ON esps.stu_id = su.id
|
||||
WHERE esps.stu_id = #{stuId} AND esps.paper_id = #{paperId}
|
||||
</select>
|
||||
<select id="findByStuIdAndPaperIdAndQuestionId" resultType="pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO">
|
||||
SELECT * FROM exam_stu_paper_score WHERE stu_id = #{stuId} AND paper_id = #{paperId} AND qu_id = #{quId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user