|
@@ -1,103 +1,122 @@
|
|
|
-package com.qmth.teachcloud.mark.service.impl;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
-import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
|
|
-import com.qmth.teachcloud.mark.bean.archivescore.QuestionVo;
|
|
|
-import com.qmth.teachcloud.mark.entity.MarkSubjectiveScore;
|
|
|
-import com.qmth.teachcloud.mark.mapper.MarkSubjectiveScoreMapper;
|
|
|
-import com.qmth.teachcloud.mark.service.MarkSubjectiveScoreService;
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
-/**
|
|
|
- * <p>
|
|
|
- * 主观题得分明细表 服务实现类
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * @author xf
|
|
|
- * @since 2023-09-22
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class MarkSubjectiveScoreServiceImpl extends MppServiceImpl<MarkSubjectiveScoreMapper, MarkSubjectiveScore> implements MarkSubjectiveScoreService {
|
|
|
- @Override
|
|
|
- public MarkSubjectiveScore getByStudentIdAndQuestionId(Long studentId, Long questionId) {
|
|
|
- QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
- .eq(MarkSubjectiveScore::getQuestionId, questionId);
|
|
|
- return this.getOne(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Set<Integer> listMainNumberByStudentIdAndUncalculate(Long studentId, boolean uncalculate) {
|
|
|
- Set<Integer> mainNumbers = new HashSet<Integer>();
|
|
|
- List<MarkSubjectiveScore> list = this.listByStudentIdAndUncalculate(studentId, uncalculate);
|
|
|
- for (MarkSubjectiveScore subjectiveScore : list) {
|
|
|
- mainNumbers.add(subjectiveScore.getMainNumber());
|
|
|
- }
|
|
|
- return mainNumbers;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<MarkSubjectiveScore> listByStudentIdAndUncalculate(Long studentId, boolean uncalculate) {
|
|
|
- QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
- .orderByAsc(MarkSubjectiveScore::getMainNumber)
|
|
|
- .orderByAsc(MarkSubjectiveScore::getSubNumber);
|
|
|
- return this.list(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void deleteByStudentId(Long studentId) {
|
|
|
- UpdateWrapper<MarkSubjectiveScore> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId);
|
|
|
- this.remove(updateWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<QuestionVo> getSubjectiveVo(List<Long> studentIds) {
|
|
|
- if (CollectionUtils.isEmpty(studentIds)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- return this.baseMapper.getSubjectiveVo(studentIds);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<MarkSubjectiveScore> listByStudentId(Long studentId) {
|
|
|
- QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
- .orderByAsc(MarkSubjectiveScore::getMainNumber)
|
|
|
- .orderByAsc(MarkSubjectiveScore::getSubNumber);
|
|
|
- return this.list(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void updateRejected(Long studentId, Long questionId, boolean rejectd) {
|
|
|
- UpdateWrapper<MarkSubjectiveScore> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().set(MarkSubjectiveScore::getRejected, rejectd)
|
|
|
- .eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
- .eq(MarkSubjectiveScore::getQuestionId, questionId);
|
|
|
- this.update(updateWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public long countByStudentId(Long studentId) {
|
|
|
- QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId);
|
|
|
- return this.count(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void deleteByExamIdAndPaperNumberAndQuestionId(Long examId, String paperNumber, Long questionId) {
|
|
|
- UpdateWrapper<MarkSubjectiveScore> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().eq(MarkSubjectiveScore::getExamId, examId)
|
|
|
- .eq(MarkSubjectiveScore::getPaperNumber, paperNumber)
|
|
|
- .eq(MarkSubjectiveScore::getQuestionId, questionId);
|
|
|
- this.remove(updateWrapper);
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package com.qmth.teachcloud.mark.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
|
|
+import com.qmth.teachcloud.mark.bean.archivescore.QuestionVo;
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkSubjectiveScore;
|
|
|
+import com.qmth.teachcloud.mark.mapper.MarkSubjectiveScoreMapper;
|
|
|
+import com.qmth.teachcloud.mark.service.MarkSubjectiveScoreService;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 主观题得分明细表 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author xf
|
|
|
+ * @since 2023-09-22
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class MarkSubjectiveScoreServiceImpl extends MppServiceImpl<MarkSubjectiveScoreMapper, MarkSubjectiveScore> implements MarkSubjectiveScoreService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public MarkSubjectiveScore getByStudentIdAndQuestionId(Long studentId, Long questionId) {
|
|
|
+ QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
+ .eq(MarkSubjectiveScore::getQuestionId, questionId);
|
|
|
+ return this.getOne(queryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Set<Integer> listMainNumberByStudentIdAndUncalculate(Long studentId, boolean uncalculate) {
|
|
|
+ Set<Integer> mainNumbers = new HashSet<Integer>();
|
|
|
+ List<MarkSubjectiveScore> list = this.listByStudentIdAndUncalculate(studentId, uncalculate);
|
|
|
+ for (MarkSubjectiveScore subjectiveScore : list) {
|
|
|
+ mainNumbers.add(subjectiveScore.getMainNumber());
|
|
|
+ }
|
|
|
+ return mainNumbers;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<MarkSubjectiveScore> listByStudentIdAndUncalculate(Long studentId, boolean uncalculate) {
|
|
|
+ QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
+ .orderByAsc(MarkSubjectiveScore::getMainNumber)
|
|
|
+ .orderByAsc(MarkSubjectiveScore::getSubNumber);
|
|
|
+ return this.list(queryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteByStudentId(Long studentId) {
|
|
|
+ UpdateWrapper<MarkSubjectiveScore> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId);
|
|
|
+ this.remove(updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<QuestionVo> getSubjectiveVo(List<Long> studentIds) {
|
|
|
+ if (CollectionUtils.isEmpty(studentIds)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return this.baseMapper.getSubjectiveVo(studentIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<MarkSubjectiveScore> listByStudentId(Long studentId) {
|
|
|
+ QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
+ .orderByAsc(MarkSubjectiveScore::getMainNumber)
|
|
|
+ .orderByAsc(MarkSubjectiveScore::getSubNumber);
|
|
|
+ return this.list(queryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateRejected(Long studentId, Long questionId, boolean rejectd) {
|
|
|
+ UpdateWrapper<MarkSubjectiveScore> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().set(MarkSubjectiveScore::getRejected, rejectd)
|
|
|
+ .eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
+ .eq(MarkSubjectiveScore::getQuestionId, questionId);
|
|
|
+ this.update(updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long countByStudentId(Long studentId) {
|
|
|
+ QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId);
|
|
|
+ return this.count(queryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteByExamIdAndPaperNumberAndQuestionId(Long examId, String paperNumber, Long questionId) {
|
|
|
+ UpdateWrapper<MarkSubjectiveScore> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().eq(MarkSubjectiveScore::getExamId, examId)
|
|
|
+ .eq(MarkSubjectiveScore::getPaperNumber, paperNumber)
|
|
|
+ .eq(MarkSubjectiveScore::getQuestionId, questionId);
|
|
|
+ this.remove(updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据学生id和考试id以及试卷编码查询
|
|
|
+ *
|
|
|
+ * @param studentId
|
|
|
+ * @param examId
|
|
|
+ * @param paperNumber
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<MarkSubjectiveScore> listByStudentIdAndExamIdAndPn(Long studentId, Long examId, String paperNumber) {
|
|
|
+ QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
|
|
|
+ .eq(MarkSubjectiveScore::getExamId, examId)
|
|
|
+ .eq(MarkSubjectiveScore::getPaperNumber, paperNumber)
|
|
|
+ .orderByAsc(MarkSubjectiveScore::getMainNumber)
|
|
|
+ .orderByAsc(MarkSubjectiveScore::getSubNumber);
|
|
|
+ return this.list(queryWrapper);
|
|
|
+ }
|
|
|
+}
|