TeacherCourseServiceImpl.java
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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<TeacherCourse> list) {
int i = 0 ;
List<TeacherCourse> 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<TeacherCourse> selectBySchoolIdAndTeam(int schoolId, String team) {
TeacherCourse teacherCourse = new TeacherCourse();
teacherCourse.setSchoolId(schoolId);
teacherCourse.setTeam(team);
return teacherCourseMapper.selectBySchoolIdAndTeam(teacherCourse);
}
}