StudentServiceImpl.java
1.55 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
package com.jevon.service.impl;
import com.jevon.mapper.StudentMapper;
import com.jevon.model.Student;
import com.jevon.service.StudentService;
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/10/18 0018 15:16
*/
@Service
public class StudentServiceImpl implements StudentService {
@Autowired
StudentMapper studentMapper;
@Override
public int insertBatch(List<Student> list) {
int i = 0 ;
List<Student> result = new ArrayList<>();
for(Student student :list){
i++ ;
result.add(student);
if(i % 100 == 0){
studentMapper.insertBatch(result);
result = new ArrayList<>();
}
}
studentMapper.insertBatch(result);
return 1 ;
}
@Override
public List<Student> selectBySchoolName(int analyseId, String schoolName) {
Student student = new Student();
student.setAnalyseId(analyseId);
student.setSchoolName(schoolName);
return studentMapper.selectBySchoolName(student);
}
@Override
public int selectCountByScore(int analyseId, String schoolName, double begin, double end) {
Student student = new Student();
student.setAnalyseId(analyseId);
student.setSchoolName(schoolName);
student.setBegin(begin);
student.setEnd(end);
return studentMapper.selectCountByScore(student);
}
}