|
|
@@ -18,6 +18,7 @@ import com.usoftchina.smartschool.school.mapper.DataImportMapper;
|
|
|
import com.usoftchina.smartschool.school.mapper.SysStudentMapper;
|
|
|
import com.usoftchina.smartschool.school.po.*;
|
|
|
import com.usoftchina.smartschool.utils.CollectionUtils;
|
|
|
+import com.usoftchina.smartschool.utils.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -100,8 +101,13 @@ public class StudentServiceImpl implements StudentService{
|
|
|
item.setUser_id(userId);
|
|
|
}
|
|
|
item.setSchool_id(schoolid);
|
|
|
- sysStudentMapper.insertparent(item);
|
|
|
- pr_id = item.getParent_id();
|
|
|
+ SysParents sysParents = sysStudentMapper.selectParentByPhone(item.getPa_phone(), schoolid);
|
|
|
+ if (ObjectUtils.isEmpty(sysParents)) {
|
|
|
+ sysStudentMapper.insertparent(item);
|
|
|
+ pr_id = item.getParent_id();
|
|
|
+ }else {
|
|
|
+ pr_id = sysParents.getParent_id();
|
|
|
+ }
|
|
|
sysStudentMapper.insertrelation(id, pr_id, item.getPs_relation());
|
|
|
}
|
|
|
}
|
|
|
@@ -134,8 +140,13 @@ public class StudentServiceImpl implements StudentService{
|
|
|
//构造家长更新对象
|
|
|
item.setUser_id(userId);
|
|
|
}
|
|
|
- sysStudentMapper.insertparent(item);
|
|
|
- pr_id = item.getParent_id();
|
|
|
+ SysParents sysParents = sysStudentMapper.selectParentByPhone(item.getPa_phone(), schoolid);
|
|
|
+ if (ObjectUtils.isEmpty(sysParents)) {
|
|
|
+ sysStudentMapper.insertparent(item);
|
|
|
+ pr_id = item.getParent_id();
|
|
|
+ }else {
|
|
|
+ pr_id = sysParents.getParent_id();
|
|
|
+ }
|
|
|
sysStudentMapper.insertrelation(id, pr_id, item.getPs_relation());
|
|
|
}
|
|
|
}
|
|
|
@@ -228,7 +239,6 @@ public class StudentServiceImpl implements StudentService{
|
|
|
Long userId = createAccount(detail.getPa_phone());
|
|
|
parent.setUser_id(userId);
|
|
|
}
|
|
|
-
|
|
|
sysStudentMapper.insertparent(parent);
|
|
|
}
|
|
|
//插入学生与父母的关系
|