处理预报名时间字段

This commit is contained in:
mirage 2026-03-06 10:17:16 +08:00
parent 746cb5dca4
commit 655cff6256
1 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
@Service @Service
public class StudentServiceImpl extends ServiceImpl<StudentInfoMapper, StudentInfo> implements IStudentInfoService { public class StudentServiceImpl extends ServiceImpl<StudentInfoMapper, StudentInfo> implements IStudentInfoService {
@ -38,8 +39,13 @@ public class StudentServiceImpl extends ServiceImpl<StudentInfoMapper, StudentIn
Long studentId = baseInfo.getStudentId(); Long studentId = baseInfo.getStudentId();
Long studentBaseId = baseInfo.getStudentBaseId(); Long studentBaseId = baseInfo.getStudentBaseId();
StudentInfo existingStudentInfo = studentInfoMapper.selectById(studentId);
Date preservedPreRegistrationTime = existingStudentInfo != null ? existingStudentInfo.getPreRegistrationTime() : null;
studentInfo.setStudentId(studentId); studentInfo.setStudentId(studentId);
studentBaseInfo.setStudentBaseId(studentBaseId); studentBaseInfo.setStudentBaseId(studentBaseId);
// 保留原有预报名时间若之前未设置则用当前时间
studentInfo.setPreRegistrationTime(preservedPreRegistrationTime != null ? preservedPreRegistrationTime : new Date());
studentInfoMapper.updateById(studentInfo); studentInfoMapper.updateById(studentInfo);
studentBaseInfoMapper.updateById(studentBaseInfo); studentBaseInfoMapper.updateById(studentBaseInfo);
@ -48,6 +54,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentInfoMapper, StudentIn
else { else {
// 学生学业信息入库 // 学生学业信息入库
BeanUtils.copyProperties(studentInfoValidate, studentInfo); BeanUtils.copyProperties(studentInfoValidate, studentInfo);
// 预报名时间新增时设置为当前时间
studentInfo.setPreRegistrationTime(new Date());
studentInfoMapper.insert(studentInfo); studentInfoMapper.insert(studentInfo);
// 学生基本信息入库 // 学生基本信息入库