|
@@ -2,6 +2,7 @@ package com.example.service.impl;
|
|
|
|
|
|
import com.example.context.BaseContext;
|
|
|
import com.example.dto.TeacherDTO;
|
|
|
+import com.example.entity.Patent;
|
|
|
import com.example.entity.ResearchFiled;
|
|
|
import com.example.entity.Teacher;
|
|
|
import com.example.mapper.TeacherMapper;
|
|
@@ -36,5 +37,41 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
});
|
|
|
teacherMapper.saveReasearch(researchFiled);
|
|
|
}
|
|
|
+ //向专利插入n条数据
|
|
|
+ List<Patent> patents = teacher.getPatent();
|
|
|
+ if (patents != null && patents.size() > 0) {
|
|
|
+ patents.forEach(patents1 -> {
|
|
|
+ patents1.setTeacherId(teacher.getId());
|
|
|
+ });
|
|
|
+ teacherMapper.savePatent(patents);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateTeacher(TeacherDTO teacherDTO,Long id) {
|
|
|
+ Teacher teacher = new Teacher();
|
|
|
+ BeanUtils.copyProperties(teacherDTO, teacher);
|
|
|
+ teacher.setId(id);
|
|
|
+ teacherMapper.updateTeacher(teacher);
|
|
|
+ //向研究领域插入n条数据
|
|
|
+ teacherMapper.deleteReasearch(teacher.getId());
|
|
|
+ List<ResearchFiled> researchFiled = teacher.getResearchFiled();
|
|
|
+ if (researchFiled != null && researchFiled.size() > 0) {
|
|
|
+ researchFiled.forEach(researchFiled1 -> {
|
|
|
+ researchFiled1.setTeacherId(teacher.getId());
|
|
|
+ });
|
|
|
+
|
|
|
+ teacherMapper.saveReasearch(researchFiled);
|
|
|
+ }
|
|
|
+ //向专利插入n条数据
|
|
|
+ teacherMapper.deletePatents(teacher.getId());
|
|
|
+ List<Patent> patents = teacher.getPatent();
|
|
|
+ if (patents != null && patents.size() > 0) {
|
|
|
+ patents.forEach(patents1 -> {
|
|
|
+ patents1.setTeacherId(teacher.getId());
|
|
|
+ });
|
|
|
+
|
|
|
+ teacherMapper.savePatent(patents);
|
|
|
+ }
|
|
|
}
|
|
|
}
|