|
@@ -7,6 +7,7 @@ import com.example.entity.ResearchFiled;
|
|
|
import com.example.entity.Teacher;
|
|
|
import com.example.mapper.TeacherMapper;
|
|
|
import com.example.service.TeacherService;
|
|
|
+import com.example.vo.TeacherVO;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -48,7 +49,7 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateTeacher(TeacherDTO teacherDTO,Long id) {
|
|
|
+ public void updateTeacher(TeacherDTO teacherDTO, Long id) {
|
|
|
Teacher teacher = new Teacher();
|
|
|
BeanUtils.copyProperties(teacherDTO, teacher);
|
|
|
teacher.setId(id);
|
|
@@ -74,4 +75,34 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
teacherMapper.savePatent(patents);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查询老师详细信息
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TeacherVO getById(Long id) {
|
|
|
+ //查询研究领域
|
|
|
+ List<ResearchFiled> researchFileds = teacherMapper.getResearch(id);
|
|
|
+ //查询专利
|
|
|
+ List<Patent> patents = teacherMapper.getPatent(id);
|
|
|
+ //查询老师信息
|
|
|
+ Teacher teacher = teacherMapper.getTeacher(id);
|
|
|
+ TeacherVO teacherVO = new TeacherVO();
|
|
|
+ BeanUtils.copyProperties(teacher, teacherVO);
|
|
|
+ teacherVO.setResearchFiled(researchFileds);
|
|
|
+ teacherVO.setPatent(patents);
|
|
|
+ return teacherVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id删除老师信息
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void deleteById(Long id) {
|
|
|
+ teacherMapper.deleteById(id);
|
|
|
+ }
|
|
|
+
|
|
|
}
|