修改bug

This commit is contained in:
yangjun 2024-11-07 15:58:45 +08:00
parent 29c6862f8b
commit ddb6b32165
1 changed files with 24 additions and 9 deletions

View File

@ -685,16 +685,31 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
ZyInfoStudent stuPar = zyInfoStudentService.getById(zyInfoStudent.getStuId()); ZyInfoStudent stuPar = zyInfoStudentService.getById(zyInfoStudent.getStuId());
ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId()); ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId());
if(stuPar==null) { if(stuPar==null) {
//20241107新增判断看原来是否有数据防止重复添加
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ZyInfoStudent zyInfoStudent1 = new ZyInfoStudent(); QueryWrapper<ZyInfoStudent> zyInfoStudentQueryWrapper = new QueryWrapper<>();
zyInfoStudent1.setMainId(zyInfo.getId()); zyInfoStudentQueryWrapper.eq("create_by",user.getUsername());
zyInfoStudent1.setCreateBy(user.getUsername()); zyInfoStudentQueryWrapper.eq("main_id",zyInfoStudent.getMainId());
zyInfoStudent1.setCreateTime(new Date()); zyInfoStudentQueryWrapper.last("limit 1");
zyInfoStudent1.setFilePath(zyInfoStudent.getFilePath()); ZyInfoStudent zyInfoStudent2 = zyInfoStudentService.getOne(zyInfoStudentQueryWrapper);
zyInfoStudent1.setStudentName(user.getRealname()); if(zyInfoStudent2!=null){
zyInfoStudentService.save(zyInfoStudent1); //20241107新增判断看原来是否有数据防止重复添加将原来的id赋值到请求数据里
stuPar =zyInfoStudent1; zyInfoStudent.setId(zyInfoStudent2.getId());
zyInfoStudent =zyInfoStudent1; stuPar.setFilePath(zyInfoStudent.getFilePath());
zyInfoStudent =stuPar;
}else{
ZyInfoStudent zyInfoStudent1 = new ZyInfoStudent();
zyInfoStudent1.setMainId(zyInfo.getId());
zyInfoStudent1.setCreateBy(user.getUsername());
zyInfoStudent1.setCreateTime(new Date());
zyInfoStudent1.setFilePath(zyInfoStudent.getFilePath());
zyInfoStudent1.setStudentName(user.getRealname());
zyInfoStudentService.save(zyInfoStudent1);
stuPar =zyInfoStudent1;
zyInfoStudent =zyInfoStudent1;
}
}else{ }else{
stuPar.setFilePath(zyInfoStudent.getFilePath()); stuPar.setFilePath(zyInfoStudent.getFilePath());