package com.jevon.service.impl; import com.jevon.mapper.TeacherCourseMapper; import com.jevon.model.TeacherCourse; import com.jevon.service.TeacherCourseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * @author chen * @version 1.0 * @date 2019/9/25 0025 14:46 */ @Service("teacherCourseService") public class TeacherCourseServiceImpl implements TeacherCourseService { @Autowired TeacherCourseMapper teacherCourseMapper; @Override public int insertBatch(List list) { int i = 0 ; List result = new ArrayList<>(); for(TeacherCourse teacherClass :list){ i++ ; result.add(teacherClass); if(i % 100 == 0){ teacherCourseMapper.insertBatch(result); result = new ArrayList<>(); } } if(result.size()>0){ teacherCourseMapper.insertBatch(result); } return 1; } @Override public int updateByPrimaryKey(TeacherCourse record) { return teacherCourseMapper.updateByPrimaryKey(record); } @Override public int updateTeacherCourse(TeacherCourse teacherCourse) { return teacherCourseMapper.updateTeacherCourse(teacherCourse); } @Override public TeacherCourse selectTeacherCourse(TeacherCourse teacherCourse) { return teacherCourseMapper.selectTeacherCourse(teacherCourse); } @Override public int selectTeacherDayCourseNumber(TeacherCourse teacherCourse) { return teacherCourseMapper.selectTeacherDayCourseNumber(teacherCourse); } @Override public int isCreateCourse(TeacherCourse teacherCourse) { return teacherCourseMapper.isCreateCourse(teacherCourse); } @Override public int deleteBySchoolIdAndTeam(int schoolId, String team) { TeacherCourse teacherCourse = new TeacherCourse(); teacherCourse.setSchoolId(schoolId); teacherCourse.setTeacherName(team); return teacherCourseMapper.deleteBySchoolIdAndTeam(teacherCourse); } @Override public int recallTeacherCourse(TeacherCourse teacherCourse) { return teacherCourseMapper.recallTeacherCourse(teacherCourse); } @Override public List selectBySchoolIdAndTeam(int schoolId, String team) { TeacherCourse teacherCourse = new TeacherCourse(); teacherCourse.setSchoolId(schoolId); teacherCourse.setTeam(team); return teacherCourseMapper.selectBySchoolIdAndTeam(teacherCourse); } }