修改班级表结构,部分查询代码

master
xiaoCJ 5 months ago
parent f22edb4084
commit 3686624e5b

@ -127,7 +127,9 @@ public class StuIndexController {
StuUserDto stuUserDto = new StuUserDto();
BeanUtils.copyProperties(stuUser, stuUserDto);
StuClass stuClass = stuClassMapper.selectByPrimaryKey(stuUser.getClassId());
StuClassExample example =new StuClassExample();
List<StuClass> stuClassList = stuClassMapper.selectByExample(example);
StuClass stuClass = stuClassList.get(0);
stuUserDto.setClassName(stuClass.getClassName());
stuUserDto.setIpPlace(sysLoginLogs.get(0).getIpAddress());
stuUserDto.setLastIP(sysLoginLogs.get(0).getLoginIp());

@ -154,9 +154,12 @@ public class TeaExamManageController {
list.add(s);
}
}
StuClassExample example =new StuClassExample();
example.createCriteria().andClassIdIn(list);
List<StuClass> stuClasslist = stuClassMapper.selectByExample(example);
String s = "";
for (String id : list) {
StuClass stuClass = stuClassMapper.selectByPrimaryKey(id);
for (StuClass stuClass : stuClasslist) {
s += stuClass.getClassName() + ",";
}
// 去掉最后一个逗号

@ -221,11 +221,18 @@ public class TeaGradeManageController {
if (!teaAndStudentExams.isEmpty()) {
TeaAndStudentExam teaAndStudentExam = teaAndStudentExams.get(0);
String classId = teaAndStudentExam.getClassId();
String[] split = classId.split(",");
for (String singleId : split) {
StuClass stuClass = stuClassMapper.selectByPrimaryKey(singleId);
List<String> idlist = Arrays.asList(split);
StuClassExample example =new StuClassExample();
example.createCriteria().andClassIdIn(idlist);
List<StuClass> stuClassList = stuClassMapper.selectByExample(example);
for (StuClass stuClass : stuClassList) {
String className = stuClass.getClassName();
map.put(singleId, className);
map.put(stuClass.getId(), className);
}
list.add(map);
}
@ -475,7 +482,9 @@ public class TeaGradeManageController {
StuUser user = userMapper.selectByPrimaryKey(trainingReport.getUserId());
trainingReportDto.setName(user.getName());
trainingReportDto.setStudentId(user.getStudentId());
StuClass stuClass = stuClassMapper.selectByPrimaryKey(user.getClassId());
StuClassExample example =new StuClassExample();
List<StuClass> stuClassList = stuClassMapper.selectByExample(example);
StuClass stuClass = stuClassList.get(0);
trainingReportDto.setClassName(stuClass.getClassName());
list.add(trainingReportDto);
}

Loading…
Cancel
Save