Commit 7d488592 authored by Ryan Loong's avatar Ryan Loong

fix 点名次数筛选失效的bug

parent 3783b0bc
......@@ -174,12 +174,17 @@ public class StudentInfoService {
}
Map<Integer, Integer> callTimeMap = studentPointService.countByClassGroupByStudent(classId);
if (Objects.nonNull(minCall) || Objects.nonNull(maxCall)) {
List<Integer> excluded = callTimeMap.entrySet().stream()
.filter(entry -> (Objects.nonNull(minCall) && entry.getValue() < minCall)
|| (Objects.nonNull(maxCall) && entry.getValue() > maxCall))
.map(Map.Entry::getKey).collect(Collectors.toList());
if (Objects.nonNull(minCall)) {
List<Integer> included = callTimeMap.entrySet().stream().filter(entry -> entry.getValue() >= minCall).map(Map.Entry::getKey).collect(Collectors.toList());
if (CollectionUtils.isEmpty(included)) {
criteria.andIdEqualTo(-1);
} else {
criteria.andIdIn(included);
}
}
if (Objects.nonNull(maxCall)) {
List<Integer> excluded = callTimeMap.entrySet().stream().filter(entry -> entry.getValue() > maxCall).map(Map.Entry::getKey).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(excluded)) {
criteria.andIdNotIn(excluded);
}
......
......@@ -5,10 +5,12 @@ import cn.exploring.engine.server.db.dao.StudentPointInfoMapper;
import cn.exploring.engine.server.db.domain.StudentInfo;
import cn.exploring.engine.server.db.domain.StudentPointInfo;
import cn.exploring.engine.server.db.domain.StudentPointInfoExample;
import cn.exploring.engine.server.db.domain.vo.StudentInfoExcelImportVo;
import cn.exploring.engine.server.db.domain.vo.StudentPointExcelExportVo;
import cn.exploring.engine.server.db.util.StrUtil;
import cn.exploring.engine.server.db.util.Util;
import com.alibaba.excel.EasyExcel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
......@@ -16,7 +18,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import javax.print.attribute.IntegerSyntax;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
......@@ -27,6 +28,8 @@ import java.util.stream.Collectors;
@Service
public class StudentPointService {
public static final Log log = LogFactory.getLog(StudentPointService.class);
@Resource
StudentPointInfoMapper studentPointInfoMapper;
......@@ -117,13 +120,17 @@ public class StudentPointService {
@Transactional(rollbackFor = Exception.class)
public void removeByStudentId(Integer studentId) {
studentPointInfoMapper.updateByExampleSelective(new StudentPointInfo(){{
setUpdateTime(LocalDateTime.now());
setDeleted(StudentPointInfo.IS_DELETED);
}}, new StudentPointInfoExample().createCriteria()
StudentPointInfo record = new StudentPointInfo();
record.setUpdateTime(LocalDateTime.now());
record.setDeleted(true);
int i = studentPointInfoMapper.updateByExampleSelective(record,
new StudentPointInfoExample().createCriteria()
.andDeletedEqualTo(StudentPointInfo.NOT_DELETED)
.andStudentIdEqualTo(studentId)
.example());
.example());
log.info(StrUtil.format("【成绩服务】已批量删除成绩 学生ID:'{}' 删除数量: '{}'", studentId, i));
}
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment