Commit ef5c16a06dadcbfc62f57b409cd3726f2020af27
1 parent
c6a8c409
Exists in
master
试卷导入
Showing
29 changed files
with
1141 additions
and
10 deletions
Show diff stats
src/main/java/com/jevon/controller/LearnController.java
... | ... | @@ -3,13 +3,13 @@ package com.jevon.controller; |
3 | 3 | import com.jevon.enums.DifficultEnums; |
4 | 4 | import com.jevon.enums.DimensionalEnums; |
5 | 5 | import com.jevon.model.*; |
6 | -import com.jevon.service.AnalyseDetailService; | |
7 | -import com.jevon.service.AnalyseDimensionalService; | |
8 | -import com.jevon.service.AnalyseService; | |
9 | -import com.jevon.service.DimensionalService; | |
6 | +import com.jevon.service.*; | |
10 | 7 | import com.jevon.vo.BaseVo; |
11 | 8 | import com.jevon.vo.excel.ExamExcelVo; |
9 | +import com.jevon.vo.excel.ScoreExcelVo; | |
10 | +import com.jevon.vo.req.CreateExamReqVo; | |
12 | 11 | import com.jevon.vo.req.InitAnalyseReqVo; |
12 | +import com.jevon.vo.req.UpdateExamReqVo; | |
13 | 13 | import io.swagger.annotations.Api; |
14 | 14 | import io.swagger.annotations.ApiOperation; |
15 | 15 | import org.apache.commons.lang3.StringUtils; |
... | ... | @@ -48,6 +48,48 @@ public class LearnController { |
48 | 48 | @Autowired |
49 | 49 | AnalyseDetailService analyseDetailService; |
50 | 50 | |
51 | + @Autowired | |
52 | + StudentDetailService studentDetailService; | |
53 | + | |
54 | + @Autowired | |
55 | + StudentService studentService; | |
56 | + | |
57 | + @ApiOperation("获取列表") | |
58 | + @RequestMapping(value = "getList", method = RequestMethod.POST) | |
59 | + public List<Analyse> getList(){ | |
60 | + List<Analyse> list = analyseService.select(new Analyse()); | |
61 | + return list; | |
62 | + } | |
63 | + | |
64 | + @ApiOperation("创建考试") | |
65 | + @RequestMapping(value = "createExam", method = RequestMethod.POST) | |
66 | + public BaseVo createExam(@RequestBody CreateExamReqVo createExamReqVo){ | |
67 | + BaseVo baseVo = new BaseVo(); | |
68 | + Analyse analyse = new Analyse(); | |
69 | + analyse.setCourseName(createExamReqVo.getCourseName()); | |
70 | + analyse.setExamName(createExamReqVo.getExamName()); | |
71 | + analyse.setExamTime(createExamReqVo.getExamTime()); | |
72 | + int id = analyseService.insert(analyse); | |
73 | + baseVo.setMessage(id+""); | |
74 | + return baseVo; | |
75 | + } | |
76 | + | |
77 | + @ApiOperation("更新考试信息") | |
78 | + @RequestMapping(value = "updateExam", method = RequestMethod.POST) | |
79 | + public BaseVo updateExam(@RequestBody UpdateExamReqVo updateExamReqVo){ | |
80 | + BaseVo baseVo = new BaseVo(); | |
81 | + Analyse analyse = analyseService.selectById(updateExamReqVo.getAnalyseId()); | |
82 | + if(analyse == null){ | |
83 | + baseVo.setMessage("考试不存在"); | |
84 | + baseVo.setSuccess(false); | |
85 | + return baseVo; | |
86 | + } | |
87 | + analyse.setExamTime(updateExamReqVo.getExamTime()); | |
88 | + analyse.setExamName(updateExamReqVo.getExamName()); | |
89 | + analyse.setCourseName(updateExamReqVo.getCourseName()); | |
90 | + return baseVo; | |
91 | + } | |
92 | + | |
51 | 93 | @ApiOperation("试卷信息导入") |
52 | 94 | @RequestMapping(value = "initAnalyse", method = RequestMethod.POST) |
53 | 95 | public BaseVo initAnalyse(@RequestBody InitAnalyseReqVo initAnalyseReqVo){ |
... | ... | @@ -60,6 +102,7 @@ public class LearnController { |
60 | 102 | try{ |
61 | 103 | List<AnalyseDetail> analyseDetails = new ArrayList<>(); |
62 | 104 | List<AnalyseDimensional> analyseDimensionals = new ArrayList<>(); |
105 | + Float maxScore = 0f; | |
63 | 106 | Analyse analyse = analyseService.selectById(initAnalyseReqVo.getAnalyseId()); |
64 | 107 | String fileUrl = initAnalyseReqVo.getUrl(); |
65 | 108 | File excelFile = new File(fileUrl); |
... | ... | @@ -85,6 +128,7 @@ public class LearnController { |
85 | 128 | //获取表头 |
86 | 129 | } else { |
87 | 130 | ExamExcelVo examExcelVo = new ExamExcelVo(sheetRow); |
131 | + maxScore = maxScore + new Float(examExcelVo.getScore()); | |
88 | 132 | AnalyseDetail analyseDetail = new AnalyseDetail(); |
89 | 133 | String questionNumber = null ; |
90 | 134 | if(StringUtils.isNotBlank(examExcelVo.getQuestionSmallNumber())){ |
... | ... | @@ -107,6 +151,8 @@ public class LearnController { |
107 | 151 | } |
108 | 152 | analyseDetailService.insertBatch(analyseDetails); |
109 | 153 | analyseDimensionalService.insertBatch(analyseDimensionals); |
154 | + analyse.setMaxScore(maxScore); | |
155 | + analyseService.update(analyse); | |
110 | 156 | }catch (Exception e){ |
111 | 157 | System.out.println(e); |
112 | 158 | } |
... | ... | @@ -141,5 +187,71 @@ public class LearnController { |
141 | 187 | } |
142 | 188 | } |
143 | 189 | |
190 | + @ApiOperation("考生成绩导入") | |
191 | + @RequestMapping(value = "initScore", method = RequestMethod.POST) | |
192 | + public BaseVo initScore(@RequestBody InitAnalyseReqVo initAnalyseReqVo){ | |
193 | + BaseVo baseVo = new BaseVo(); | |
194 | + analysisScoreExcel(initAnalyseReqVo); | |
195 | + return baseVo; | |
196 | + } | |
144 | 197 | |
198 | + private void analysisScoreExcel(InitAnalyseReqVo initAnalyseReqVo){ | |
199 | + try{ | |
200 | + List<StudentDetail> studentDetails = new ArrayList<>(); | |
201 | + List<Student> students = new ArrayList<>(); | |
202 | + Analyse analyse = analyseService.selectById(initAnalyseReqVo.getAnalyseId()); | |
203 | + String fileUrl = initAnalyseReqVo.getUrl(); | |
204 | + File excelFile = new File(fileUrl); | |
205 | + // 获得工作簿 | |
206 | + String file = excelFile.getName(); | |
207 | + Workbook workbook = null; | |
208 | + if (file.endsWith("xls")) { | |
209 | + workbook = new HSSFWorkbook(new FileInputStream(excelFile)); | |
210 | + } else { | |
211 | + workbook = new XSSFWorkbook(new FileInputStream(excelFile)); | |
212 | + } | |
213 | + // 获得工作表 | |
214 | + Sheet sheet = workbook.getSheetAt(0); | |
215 | + Date date = new Date(); | |
216 | + int rows = sheet.getPhysicalNumberOfRows(); | |
217 | + Map<Integer , String> map = new HashMap<>(); | |
218 | + for (int i = 0; i <= rows; i++) { | |
219 | + // 获取第i行数据 | |
220 | + Row sheetRow = sheet.getRow(i); | |
221 | + if (i == 0) { | |
222 | + //获取标题 | |
223 | + }else if(i == 1){ | |
224 | + //获取表头 | |
225 | + int j = 7 ; | |
226 | + while (sheetRow.getCell(j) != null){ | |
227 | + Cell cell = sheetRow.getCell(j); | |
228 | + cell.setCellType(CellType.STRING); | |
229 | + map.put(j,cell.getStringCellValue().trim()); | |
230 | + j++; | |
231 | + } | |
232 | + } else { | |
233 | + ScoreExcelVo scoreExcelVo = new ScoreExcelVo(sheetRow); | |
234 | + Student student = new Student(scoreExcelVo); | |
235 | + student.setAnalyseId(analyse.getId()); | |
236 | + student.setCreateTime(date); | |
237 | + students.add(student); | |
238 | + int j = 7 ; | |
239 | + while (sheetRow.getCell(j) != null){ | |
240 | + Cell cell = sheetRow.getCell(j); | |
241 | + StudentDetail studentDetail = new StudentDetail(scoreExcelVo); | |
242 | + studentDetail.setAnalyseId(analyse.getId()); | |
243 | + studentDetail.setExamNumber(map.get(j)); | |
244 | + studentDetail.setScore(new Float(cell.getNumericCellValue())); | |
245 | + studentDetail.setCreateTime(date); | |
246 | + studentDetails.add(studentDetail); | |
247 | + j++; | |
248 | + } | |
249 | + } | |
250 | + } | |
251 | + studentService.insertBatch(students); | |
252 | + studentDetailService.insertBatch(studentDetails); | |
253 | + }catch (Exception e){ | |
254 | + System.out.println(e); | |
255 | + } | |
256 | + } | |
145 | 257 | } | ... | ... |
src/main/java/com/jevon/controller/LearnStatController.java
0 → 100644
... | ... | @@ -0,0 +1,125 @@ |
1 | +package com.jevon.controller; | |
2 | + | |
3 | +import com.jevon.model.Analyse; | |
4 | +import com.jevon.model.Student; | |
5 | +import com.jevon.service.*; | |
6 | +import com.jevon.vo.req.GetLearnReqVo; | |
7 | +import com.jevon.wordDTO.second.Form1; | |
8 | +import com.jevon.wordDTO.second.Form1RepVo; | |
9 | +import com.jevon.wordDTO.second.Form2; | |
10 | +import io.swagger.annotations.Api; | |
11 | +import io.swagger.annotations.ApiOperation; | |
12 | +import org.springframework.beans.factory.annotation.Autowired; | |
13 | +import org.springframework.web.bind.annotation.RequestBody; | |
14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
15 | +import org.springframework.web.bind.annotation.RequestMethod; | |
16 | +import org.springframework.web.bind.annotation.RestController; | |
17 | + | |
18 | +import java.util.ArrayList; | |
19 | +import java.util.HashMap; | |
20 | +import java.util.List; | |
21 | +import java.util.Map; | |
22 | + | |
23 | +/** | |
24 | + * @author chen | |
25 | + * @version 1.0 | |
26 | + * @date 2019/10/18 0018 15:54 | |
27 | + */ | |
28 | +@RestController | |
29 | +@RequestMapping(value = "/getLearn") | |
30 | +@Api(value = "学情分析") | |
31 | +public class LearnStatController { | |
32 | + @Autowired | |
33 | + AnalyseService analyseService; | |
34 | + | |
35 | + @Autowired | |
36 | + DimensionalService dimensionalService; | |
37 | + | |
38 | + @Autowired | |
39 | + AnalyseDimensionalService analyseDimensionalService; | |
40 | + | |
41 | + @Autowired | |
42 | + AnalyseDetailService analyseDetailService; | |
43 | + | |
44 | + @Autowired | |
45 | + StudentDetailService studentDetailService; | |
46 | + | |
47 | + @Autowired | |
48 | + StudentService studentService; | |
49 | + | |
50 | + @ApiOperation("getForm2_1") | |
51 | + @RequestMapping(value = "getForm2_1", method = RequestMethod.POST) | |
52 | + public Form1RepVo getForm2_1(@RequestBody GetLearnReqVo getLearnReqVo){ | |
53 | + Form1RepVo form1RepVo = new Form1RepVo(); | |
54 | + //2.1表 | |
55 | + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); | |
56 | + //分数段 | |
57 | + float maxScore = analyse.getMaxScore(); | |
58 | + Map<String,String> segmentMap = new HashMap<>(); | |
59 | + segmentMap.put("A(优秀)",maxScore*0.85 + "~" + maxScore+"分"); | |
60 | + segmentMap.put("B(良好)",maxScore*0.7 + "~" + (maxScore*0.85-1f)+"分"); | |
61 | + segmentMap.put("C(及格)",maxScore*0.7 + "~" + (maxScore*0.7-1f)+"分"); | |
62 | + segmentMap.put("D(不及格)",0 + "~" + (maxScore*0.6-1f)+"分"); | |
63 | + form1RepVo.setMap(segmentMap); | |
64 | + List<Student> students = studentService.selectBySchoolName(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName()); | |
65 | + double sum = new Double(students.size()); | |
66 | + int a = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),maxScore*0.85,maxScore+1f); | |
67 | + int b = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),maxScore*0.7,(maxScore*0.85)); | |
68 | + int c = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),maxScore*0.6,(maxScore*0.7)); | |
69 | + int d = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),maxScore*0,(maxScore*0.6)); | |
70 | + List<Form1> form1List = new ArrayList<>(); | |
71 | + Form1 formA = new Form1(); | |
72 | + formA.setLevel("A"); | |
73 | + formA.setNumber(a); | |
74 | + formA.setProp(a/sum); | |
75 | + Form1 formB = new Form1(); | |
76 | + formB.setLevel("B"); | |
77 | + formB.setNumber(b); | |
78 | + formB.setProp(b/sum); | |
79 | + Form1 formC = new Form1(); | |
80 | + formC.setLevel("C"); | |
81 | + formC.setNumber(c); | |
82 | + formC.setProp(c/sum); | |
83 | + Form1 formD = new Form1(); | |
84 | + formD.setLevel("D"); | |
85 | + formD.setNumber(d); | |
86 | + formD.setProp(d/sum); | |
87 | + form1List.add(formA); | |
88 | + form1List.add(formB); | |
89 | + form1List.add(formC); | |
90 | + form1List.add(formD); | |
91 | + form1RepVo.setList(form1List); | |
92 | + return form1RepVo; | |
93 | + } | |
94 | + | |
95 | + @ApiOperation("getForm2_2") | |
96 | + @RequestMapping(value = "getForm2_2", method = RequestMethod.POST) | |
97 | + public List<Form2> getForm2_2(@RequestBody GetLearnReqVo getLearnReqVo){ | |
98 | + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); | |
99 | + List<Student> allStudents = studentService.selectBySchoolName(getLearnReqVo.getAnalyseId(),null); | |
100 | + List<Student> students = studentService.selectBySchoolName(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName()); | |
101 | + //先算高分段的分数 再去人数 | |
102 | + int highNumber = (int) Math.floor(allStudents.size()*0.27); | |
103 | + double highScore = allStudents.get(highNumber).getScore(); | |
104 | + int lowNumber = allStudents.size()-highNumber; | |
105 | + double lowScore = allStudents.get(lowNumber).getScore(); | |
106 | + int highCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),highScore,analyse.getMaxScore()+1f); | |
107 | + int lowCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),0,lowScore); | |
108 | + List<Form2> list = new ArrayList<>(); | |
109 | + Form2 form = new Form2(); | |
110 | + form.setName("联盟校"); | |
111 | + form.setStudentNumber(allStudents.size()); | |
112 | + form.setHighNumber(highNumber); | |
113 | + form.setLowNumber(highNumber); | |
114 | + list.add(form); | |
115 | + Form2 form2 = new Form2(); | |
116 | + form2.setName(getLearnReqVo.getSchoolName()); | |
117 | + form2.setStudentNumber(students.size()); | |
118 | + form2.setHighNumber(highCount); | |
119 | + form2.setLowNumber(lowCount); | |
120 | + form2.setHighProp(highCount/new Double(allStudents.size())); | |
121 | + form2.setLowProp(lowCount/new Double(allStudents.size())); | |
122 | + list.add(form2); | |
123 | + return list; | |
124 | + } | |
125 | +} | ... | ... |
src/main/java/com/jevon/mapper/AnalyseMapper.java
... | ... | @@ -0,0 +1,15 @@ |
1 | +package com.jevon.mapper; | |
2 | + | |
3 | +import com.jevon.model.StudentDetail; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 13:42 | |
11 | + */ | |
12 | +public interface StudentDetailMapper { | |
13 | + | |
14 | + int insertBatch(List<StudentDetail> list); | |
15 | +} | ... | ... |
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.jevon.mapper; | |
2 | + | |
3 | +import com.jevon.model.Student; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 13:42 | |
11 | + */ | |
12 | +public interface StudentMapper { | |
13 | + | |
14 | + int insertBatch(List<Student> list); | |
15 | + | |
16 | + List<Student> selectBySchoolName(Student student); | |
17 | + | |
18 | + int selectCountByScore(Student student); | |
19 | +} | ... | ... |
src/main/java/com/jevon/model/Analyse.java
... | ... | @@ -11,9 +11,10 @@ public class Analyse { |
11 | 11 | |
12 | 12 | private int id ; |
13 | 13 | private String examName ; |
14 | - private Date examTime ; | |
14 | + private String examTime ; | |
15 | 15 | private String courseName ; |
16 | 16 | private Date createTime ; |
17 | + private Float maxScore ; | |
17 | 18 | |
18 | 19 | public int getId() { |
19 | 20 | return id; |
... | ... | @@ -31,11 +32,11 @@ public class Analyse { |
31 | 32 | this.examName = examName; |
32 | 33 | } |
33 | 34 | |
34 | - public Date getExamTime() { | |
35 | + public String getExamTime() { | |
35 | 36 | return examTime; |
36 | 37 | } |
37 | 38 | |
38 | - public void setExamTime(Date examTime) { | |
39 | + public void setExamTime(String examTime) { | |
39 | 40 | this.examTime = examTime; |
40 | 41 | } |
41 | 42 | |
... | ... | @@ -54,4 +55,12 @@ public class Analyse { |
54 | 55 | public void setCreateTime(Date createTime) { |
55 | 56 | this.createTime = createTime; |
56 | 57 | } |
58 | + | |
59 | + public Float getMaxScore() { | |
60 | + return maxScore; | |
61 | + } | |
62 | + | |
63 | + public void setMaxScore(Float maxScore) { | |
64 | + this.maxScore = maxScore; | |
65 | + } | |
57 | 66 | } | ... | ... |
... | ... | @@ -0,0 +1,125 @@ |
1 | +package com.jevon.model; | |
2 | + | |
3 | +import com.jevon.vo.excel.ScoreExcelVo; | |
4 | + | |
5 | +import java.util.Date; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 13:38 | |
11 | + */ | |
12 | +public class Student { | |
13 | + | |
14 | + private int id ; | |
15 | + private int openId; | |
16 | + private String schoolName ; | |
17 | + private String className ; | |
18 | + private String studentName ; | |
19 | + private String studentNumber ; | |
20 | + private int analyseId ; | |
21 | + private float score ; | |
22 | + private Date createTime ; | |
23 | + | |
24 | + private double begin ; | |
25 | + private double end ; | |
26 | + | |
27 | + public Student(ScoreExcelVo scoreExcelVo) { | |
28 | + this.schoolName = scoreExcelVo.getSchoolName(); | |
29 | + this.className = scoreExcelVo.getClassName(); | |
30 | + this.studentName = scoreExcelVo.getStudentName(); | |
31 | + this.studentNumber = scoreExcelVo.getStudentNumber(); | |
32 | + this.score =new Float(scoreExcelVo.getScore()); | |
33 | + } | |
34 | + | |
35 | + public Student() { | |
36 | + } | |
37 | + | |
38 | + public int getId() { | |
39 | + return id; | |
40 | + } | |
41 | + | |
42 | + public void setId(int id) { | |
43 | + this.id = id; | |
44 | + } | |
45 | + | |
46 | + public int getOpenId() { | |
47 | + return openId; | |
48 | + } | |
49 | + | |
50 | + public void setOpenId(int openId) { | |
51 | + this.openId = openId; | |
52 | + } | |
53 | + | |
54 | + public String getSchoolName() { | |
55 | + return schoolName; | |
56 | + } | |
57 | + | |
58 | + public void setSchoolName(String schoolName) { | |
59 | + this.schoolName = schoolName; | |
60 | + } | |
61 | + | |
62 | + public String getClassName() { | |
63 | + return className; | |
64 | + } | |
65 | + | |
66 | + public void setClassName(String className) { | |
67 | + this.className = className; | |
68 | + } | |
69 | + | |
70 | + public String getStudentName() { | |
71 | + return studentName; | |
72 | + } | |
73 | + | |
74 | + public void setStudentName(String studentName) { | |
75 | + this.studentName = studentName; | |
76 | + } | |
77 | + | |
78 | + public String getStudentNumber() { | |
79 | + return studentNumber; | |
80 | + } | |
81 | + | |
82 | + public void setStudentNumber(String studentNumber) { | |
83 | + this.studentNumber = studentNumber; | |
84 | + } | |
85 | + | |
86 | + public int getAnalyseId() { | |
87 | + return analyseId; | |
88 | + } | |
89 | + | |
90 | + public void setAnalyseId(int analyseId) { | |
91 | + this.analyseId = analyseId; | |
92 | + } | |
93 | + | |
94 | + public float getScore() { | |
95 | + return score; | |
96 | + } | |
97 | + | |
98 | + public void setScore(float score) { | |
99 | + this.score = score; | |
100 | + } | |
101 | + | |
102 | + public Date getCreateTime() { | |
103 | + return createTime; | |
104 | + } | |
105 | + | |
106 | + public void setCreateTime(Date createTime) { | |
107 | + this.createTime = createTime; | |
108 | + } | |
109 | + | |
110 | + public double getBegin() { | |
111 | + return begin; | |
112 | + } | |
113 | + | |
114 | + public void setBegin(double begin) { | |
115 | + this.begin = begin; | |
116 | + } | |
117 | + | |
118 | + public double getEnd() { | |
119 | + return end; | |
120 | + } | |
121 | + | |
122 | + public void setEnd(double end) { | |
123 | + this.end = end; | |
124 | + } | |
125 | +} | ... | ... |
... | ... | @@ -0,0 +1,111 @@ |
1 | +package com.jevon.model; | |
2 | + | |
3 | +import com.jevon.vo.excel.ScoreExcelVo; | |
4 | + | |
5 | +import java.util.Date; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 13:38 | |
11 | + */ | |
12 | +public class StudentDetail { | |
13 | + | |
14 | + private int id ; | |
15 | + private int openId; | |
16 | + private String schoolName ; | |
17 | + private String className ; | |
18 | + private String studentName ; | |
19 | + private String studentNumber ; | |
20 | + private int analyseId ; | |
21 | + private String examNumber ; | |
22 | + private float score ; | |
23 | + private Date createTime ; | |
24 | + | |
25 | + public StudentDetail(ScoreExcelVo scoreExcelVo) { | |
26 | + this.schoolName = scoreExcelVo.getSchoolName(); | |
27 | + this.className = scoreExcelVo.getClassName(); | |
28 | + this.studentName = scoreExcelVo.getStudentName(); | |
29 | + this.studentNumber = scoreExcelVo.getStudentNumber(); | |
30 | + } | |
31 | + | |
32 | + public int getId() { | |
33 | + return id; | |
34 | + } | |
35 | + | |
36 | + public void setId(int id) { | |
37 | + this.id = id; | |
38 | + } | |
39 | + | |
40 | + public int getOpenId() { | |
41 | + return openId; | |
42 | + } | |
43 | + | |
44 | + public void setOpenId(int openId) { | |
45 | + this.openId = openId; | |
46 | + } | |
47 | + | |
48 | + public String getSchoolName() { | |
49 | + return schoolName; | |
50 | + } | |
51 | + | |
52 | + public void setSchoolName(String schoolName) { | |
53 | + this.schoolName = schoolName; | |
54 | + } | |
55 | + | |
56 | + public String getClassName() { | |
57 | + return className; | |
58 | + } | |
59 | + | |
60 | + public void setClassName(String className) { | |
61 | + this.className = className; | |
62 | + } | |
63 | + | |
64 | + public String getStudentName() { | |
65 | + return studentName; | |
66 | + } | |
67 | + | |
68 | + public void setStudentName(String studentName) { | |
69 | + this.studentName = studentName; | |
70 | + } | |
71 | + | |
72 | + public String getStudentNumber() { | |
73 | + return studentNumber; | |
74 | + } | |
75 | + | |
76 | + public void setStudentNumber(String studentNumber) { | |
77 | + this.studentNumber = studentNumber; | |
78 | + } | |
79 | + | |
80 | + public int getAnalyseId() { | |
81 | + return analyseId; | |
82 | + } | |
83 | + | |
84 | + public void setAnalyseId(int analyseId) { | |
85 | + this.analyseId = analyseId; | |
86 | + } | |
87 | + | |
88 | + public String getExamNumber() { | |
89 | + return examNumber; | |
90 | + } | |
91 | + | |
92 | + public void setExamNumber(String examNumber) { | |
93 | + this.examNumber = examNumber; | |
94 | + } | |
95 | + | |
96 | + public float getScore() { | |
97 | + return score; | |
98 | + } | |
99 | + | |
100 | + public void setScore(float score) { | |
101 | + this.score = score; | |
102 | + } | |
103 | + | |
104 | + public Date getCreateTime() { | |
105 | + return createTime; | |
106 | + } | |
107 | + | |
108 | + public void setCreateTime(Date createTime) { | |
109 | + this.createTime = createTime; | |
110 | + } | |
111 | +} | ... | ... |
src/main/java/com/jevon/service/AnalyseService.java
src/main/java/com/jevon/service/StudentDetailService.java
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +package com.jevon.service; | |
2 | + | |
3 | +import com.jevon.model.StudentDetail; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 13:46 | |
11 | + */ | |
12 | +public interface StudentDetailService { | |
13 | + | |
14 | + int insertBatch(List<StudentDetail> list); | |
15 | + | |
16 | +} | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +package com.jevon.service; | |
2 | + | |
3 | +import com.jevon.model.Student; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 15:16 | |
11 | + */ | |
12 | +public interface StudentService { | |
13 | + | |
14 | + int insertBatch(List<Student> list); | |
15 | + | |
16 | + List<Student> selectBySchoolName(int analyseId , String schoolName); | |
17 | + | |
18 | + int selectCountByScore(int analyseId , String schoolName , double begin , double end); | |
19 | + | |
20 | +} | ... | ... |
src/main/java/com/jevon/service/impl/AnalyseServiceImpl.java
... | ... | @@ -33,4 +33,9 @@ public class AnalyseServiceImpl implements AnalyseService { |
33 | 33 | public Analyse selectById(int id) { |
34 | 34 | return analyseMapper.selectById(id); |
35 | 35 | } |
36 | + | |
37 | + @Override | |
38 | + public int update(Analyse analyse) { | |
39 | + return analyseMapper.update(analyse); | |
40 | + } | |
36 | 41 | } | ... | ... |
src/main/java/com/jevon/service/impl/StudentDetailServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,38 @@ |
1 | +package com.jevon.service.impl; | |
2 | + | |
3 | +import com.jevon.mapper.StudentDetailMapper; | |
4 | +import com.jevon.model.StudentDetail; | |
5 | +import com.jevon.service.StudentDetailService; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import java.util.ArrayList; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * @author chen | |
14 | + * @version 1.0 | |
15 | + * @date 2019/10/18 0018 13:47 | |
16 | + */ | |
17 | +@Service | |
18 | +public class StudentDetailServiceImpl implements StudentDetailService { | |
19 | + | |
20 | + @Autowired | |
21 | + StudentDetailMapper studentDetailMapper; | |
22 | + | |
23 | + @Override | |
24 | + public int insertBatch(List<StudentDetail> list) { | |
25 | + int i = 0 ; | |
26 | + List<StudentDetail> result = new ArrayList<>(); | |
27 | + for(StudentDetail studentDetail :list){ | |
28 | + i++ ; | |
29 | + result.add(studentDetail); | |
30 | + if(i % 100 == 0){ | |
31 | + studentDetailMapper.insertBatch(result); | |
32 | + result = new ArrayList<>(); | |
33 | + } | |
34 | + } | |
35 | + studentDetailMapper.insertBatch(result); | |
36 | + return 1 ; | |
37 | + } | |
38 | +} | ... | ... |
src/main/java/com/jevon/service/impl/StudentServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,56 @@ |
1 | +package com.jevon.service.impl; | |
2 | + | |
3 | +import com.jevon.mapper.StudentMapper; | |
4 | +import com.jevon.model.Student; | |
5 | +import com.jevon.service.StudentService; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import java.util.ArrayList; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * @author chen | |
14 | + * @version 1.0 | |
15 | + * @date 2019/10/18 0018 15:16 | |
16 | + */ | |
17 | +@Service | |
18 | +public class StudentServiceImpl implements StudentService { | |
19 | + | |
20 | + @Autowired | |
21 | + StudentMapper studentMapper; | |
22 | + | |
23 | + @Override | |
24 | + public int insertBatch(List<Student> list) { | |
25 | + int i = 0 ; | |
26 | + List<Student> result = new ArrayList<>(); | |
27 | + for(Student student :list){ | |
28 | + i++ ; | |
29 | + result.add(student); | |
30 | + if(i % 100 == 0){ | |
31 | + studentMapper.insertBatch(result); | |
32 | + result = new ArrayList<>(); | |
33 | + } | |
34 | + } | |
35 | + studentMapper.insertBatch(result); | |
36 | + return 1 ; | |
37 | + } | |
38 | + | |
39 | + @Override | |
40 | + public List<Student> selectBySchoolName(int analyseId, String schoolName) { | |
41 | + Student student = new Student(); | |
42 | + student.setAnalyseId(analyseId); | |
43 | + student.setSchoolName(schoolName); | |
44 | + return studentMapper.selectBySchoolName(student); | |
45 | + } | |
46 | + | |
47 | + @Override | |
48 | + public int selectCountByScore(int analyseId, String schoolName, double begin, double end) { | |
49 | + Student student = new Student(); | |
50 | + student.setAnalyseId(analyseId); | |
51 | + student.setSchoolName(schoolName); | |
52 | + student.setBegin(begin); | |
53 | + student.setEnd(end); | |
54 | + return studentMapper.selectCountByScore(student); | |
55 | + } | |
56 | +} | ... | ... |
... | ... | @@ -0,0 +1,51 @@ |
1 | +//package com.jevon.utils; | |
2 | +// | |
3 | +//import com.jevon.vo.excel.ExcelVo; | |
4 | +//import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
5 | +//import org.apache.poi.ss.usermodel.Row; | |
6 | +//import org.apache.poi.ss.usermodel.Sheet; | |
7 | +//import org.apache.poi.ss.usermodel.Workbook; | |
8 | +//import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
9 | +// | |
10 | +//import java.io.File; | |
11 | +//import java.io.FileInputStream; | |
12 | +//import java.util.Date; | |
13 | +//import java.util.List; | |
14 | +// | |
15 | +///** | |
16 | +// * @author chen | |
17 | +// * @version 1.0 | |
18 | +// * @date 2019/10/18 0018 13:54 | |
19 | +// */ | |
20 | +//public class ExcelImportUtils { | |
21 | +// | |
22 | +// public static<T extends ExcelVo> List<T> getExcelList(String url){ | |
23 | +// try{ | |
24 | +// File excelFile = new File(url); | |
25 | +// // 获得工作簿 | |
26 | +// String file = excelFile.getName(); | |
27 | +// Workbook workbook = null; | |
28 | +// if (file.endsWith("xls")) { | |
29 | +// workbook = new HSSFWorkbook(new FileInputStream(excelFile)); | |
30 | +// } else { | |
31 | +// workbook = new XSSFWorkbook(new FileInputStream(excelFile)); | |
32 | +// } | |
33 | +// // 获得工作表 | |
34 | +// Sheet sheet = workbook.getSheetAt(0); | |
35 | +// int rows = sheet.getPhysicalNumberOfRows(); | |
36 | +// for (int i = 0; i < rows; i++) { | |
37 | +// Row sheetRow = sheet.getRow(i); | |
38 | +// if (i == 0) { | |
39 | +// //获取标题 | |
40 | +// }else if(i == 1){ | |
41 | +// //获取表头 | |
42 | +// } else { | |
43 | +// | |
44 | +// } | |
45 | +// } | |
46 | +// }catch (Exception e){ | |
47 | +// | |
48 | +// } | |
49 | +// | |
50 | +// } | |
51 | +//} | ... | ... |
src/main/java/com/jevon/utils/ExcelUtils.java
src/main/java/com/jevon/vo/excel/ExamExcelVo.java
... | ... | @@ -9,7 +9,7 @@ import org.apache.poi.ss.usermodel.Row; |
9 | 9 | * @version 1.0 |
10 | 10 | * @date 2019/10/18 0018 8:51 |
11 | 11 | */ |
12 | -public class ExamExcelVo { | |
12 | +public class ExamExcelVo extends ExcelVo { | |
13 | 13 | |
14 | 14 | private String questionNumber ; |
15 | 15 | private String questionSmallNumber ; |
... | ... | @@ -94,6 +94,7 @@ public class ExamExcelVo { |
94 | 94 | } |
95 | 95 | |
96 | 96 | public ExamExcelVo(Row sheetRow) { |
97 | + super(sheetRow); | |
97 | 98 | Cell cell1 = sheetRow.getCell(0); |
98 | 99 | if(cell1 != null){ |
99 | 100 | cell1.setCellType(CellType.STRING); |
... | ... | @@ -108,7 +109,6 @@ public class ExamExcelVo { |
108 | 109 | this.questionSmallNumber = null ; |
109 | 110 | } |
110 | 111 | |
111 | - | |
112 | 112 | Cell cell3 = sheetRow.getCell(2); |
113 | 113 | if(cell3 != null){ |
114 | 114 | cell3.setCellType(CellType.STRING); | ... | ... |
... | ... | @@ -0,0 +1,102 @@ |
1 | +package com.jevon.vo.excel; | |
2 | + | |
3 | +import org.apache.poi.ss.usermodel.Cell; | |
4 | +import org.apache.poi.ss.usermodel.CellType; | |
5 | +import org.apache.poi.ss.usermodel.Row; | |
6 | + | |
7 | +/** | |
8 | + * @author chen | |
9 | + * @version 1.0 | |
10 | + * @date 2019/10/18 0018 13:50 | |
11 | + */ | |
12 | +public class ScoreExcelVo extends ExcelVo { | |
13 | + | |
14 | + private String schoolName ; | |
15 | + private String className ; | |
16 | + private String studentNumber ; | |
17 | + private String studentName ; | |
18 | + private String courseName ; | |
19 | + private String score ; | |
20 | + | |
21 | + public String getSchoolName() { | |
22 | + return schoolName; | |
23 | + } | |
24 | + | |
25 | + public void setSchoolName(String schoolName) { | |
26 | + this.schoolName = schoolName; | |
27 | + } | |
28 | + | |
29 | + public String getClassName() { | |
30 | + return className; | |
31 | + } | |
32 | + | |
33 | + public void setClassName(String className) { | |
34 | + this.className = className; | |
35 | + } | |
36 | + | |
37 | + public String getStudentNumber() { | |
38 | + return studentNumber; | |
39 | + } | |
40 | + | |
41 | + public void setStudentNumber(String studentNumber) { | |
42 | + this.studentNumber = studentNumber; | |
43 | + } | |
44 | + | |
45 | + public String getStudentName() { | |
46 | + return studentName; | |
47 | + } | |
48 | + | |
49 | + public void setStudentName(String studentName) { | |
50 | + this.studentName = studentName; | |
51 | + } | |
52 | + | |
53 | + public String getCourseName() { | |
54 | + return courseName; | |
55 | + } | |
56 | + | |
57 | + public void setCourseName(String courseName) { | |
58 | + this.courseName = courseName; | |
59 | + } | |
60 | + | |
61 | + public String getScore() { | |
62 | + return score; | |
63 | + } | |
64 | + | |
65 | + public void setScore(String score) { | |
66 | + this.score = score; | |
67 | + } | |
68 | + | |
69 | + public ScoreExcelVo(Row sheetRow) { | |
70 | + super(sheetRow); | |
71 | + Cell cell1 = sheetRow.getCell(1); | |
72 | + if(cell1 != null){ | |
73 | + cell1.setCellType(CellType.STRING); | |
74 | + this.schoolName = cell1.getStringCellValue().trim(); | |
75 | + } | |
76 | + Cell cell2 = sheetRow.getCell(2); | |
77 | + if(cell2 != null){ | |
78 | + cell2.setCellType(CellType.STRING); | |
79 | + this.className = cell2.getStringCellValue().trim(); | |
80 | + } | |
81 | + Cell cell3 = sheetRow.getCell(3); | |
82 | + if(cell3 != null){ | |
83 | + cell3.setCellType(CellType.STRING); | |
84 | + this.studentNumber = cell3.getStringCellValue().trim(); | |
85 | + } | |
86 | + Cell cell4 = sheetRow.getCell(4); | |
87 | + if(cell4 != null){ | |
88 | + cell4.setCellType(CellType.STRING); | |
89 | + this.studentName = cell4.getStringCellValue().trim(); | |
90 | + } | |
91 | + Cell cell5 = sheetRow.getCell(5); | |
92 | + if(cell5 != null){ | |
93 | + cell5.setCellType(CellType.STRING); | |
94 | + this.courseName = cell5.getStringCellValue().trim(); | |
95 | + } | |
96 | + Cell cell6 = sheetRow.getCell(6); | |
97 | + if(cell6 != null){ | |
98 | + cell6.setCellType(CellType.STRING); | |
99 | + this.score = cell6.getStringCellValue().trim(); | |
100 | + } | |
101 | + } | |
102 | +} | ... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +package com.jevon.vo.req; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/18 0018 14:48 | |
7 | + */ | |
8 | +public class CreateExamReqVo { | |
9 | + | |
10 | + private String examName ; | |
11 | + private String courseName ; | |
12 | + private String examTime ; | |
13 | + | |
14 | + public String getExamName() { | |
15 | + return examName; | |
16 | + } | |
17 | + | |
18 | + public void setExamName(String examName) { | |
19 | + this.examName = examName; | |
20 | + } | |
21 | + | |
22 | + public String getCourseName() { | |
23 | + return courseName; | |
24 | + } | |
25 | + | |
26 | + public void setCourseName(String courseName) { | |
27 | + this.courseName = courseName; | |
28 | + } | |
29 | + | |
30 | + public String getExamTime() { | |
31 | + return examTime; | |
32 | + } | |
33 | + | |
34 | + public void setExamTime(String examTime) { | |
35 | + this.examTime = examTime; | |
36 | + } | |
37 | +} | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +package com.jevon.vo.req; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/18 0018 14:57 | |
7 | + */ | |
8 | +public class GetLearnReqVo { | |
9 | + | |
10 | + private int analyseId ; | |
11 | + private String schoolName ; | |
12 | + | |
13 | + public int getAnalyseId() { | |
14 | + return analyseId; | |
15 | + } | |
16 | + | |
17 | + public void setAnalyseId(int analyseId) { | |
18 | + this.analyseId = analyseId; | |
19 | + } | |
20 | + | |
21 | + public String getSchoolName() { | |
22 | + return schoolName; | |
23 | + } | |
24 | + | |
25 | + public void setSchoolName(String schoolName) { | |
26 | + this.schoolName = schoolName; | |
27 | + } | |
28 | +} | ... | ... |
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.jevon.vo.req; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/18 0018 14:53 | |
7 | + */ | |
8 | +public class UpdateExamReqVo extends CreateExamReqVo{ | |
9 | + | |
10 | + private int analyseId ; | |
11 | + | |
12 | + public int getAnalyseId() { | |
13 | + return analyseId; | |
14 | + } | |
15 | + | |
16 | + public void setAnalyseId(int analyseId) { | |
17 | + this.analyseId = analyseId; | |
18 | + } | |
19 | +} | ... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +package com.jevon.wordDTO.second; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/18 0018 15:37 | |
7 | + */ | |
8 | +public class Form1 { | |
9 | + | |
10 | + private String level ; | |
11 | + private int number ; | |
12 | + private double prop ; | |
13 | + | |
14 | + public String getLevel() { | |
15 | + return level; | |
16 | + } | |
17 | + | |
18 | + public void setLevel(String level) { | |
19 | + this.level = level; | |
20 | + } | |
21 | + | |
22 | + public int getNumber() { | |
23 | + return number; | |
24 | + } | |
25 | + | |
26 | + public void setNumber(int number) { | |
27 | + this.number = number; | |
28 | + } | |
29 | + | |
30 | + public double getProp() { | |
31 | + return prop; | |
32 | + } | |
33 | + | |
34 | + public void setProp(double prop) { | |
35 | + this.prop = prop; | |
36 | + } | |
37 | +} | ... | ... |
... | ... | @@ -0,0 +1,31 @@ |
1 | +package com.jevon.wordDTO.second; | |
2 | + | |
3 | +import java.util.List; | |
4 | +import java.util.Map; | |
5 | + | |
6 | +/** | |
7 | + * @author chen | |
8 | + * @version 1.0 | |
9 | + * @date 2019/10/18 0018 15:46 | |
10 | + */ | |
11 | +public class Form1RepVo { | |
12 | + | |
13 | + private Map<String ,String> map ; | |
14 | + private List<Form1> list ; | |
15 | + | |
16 | + public Map<String, String> getMap() { | |
17 | + return map; | |
18 | + } | |
19 | + | |
20 | + public void setMap(Map<String, String> map) { | |
21 | + this.map = map; | |
22 | + } | |
23 | + | |
24 | + public List<Form1> getList() { | |
25 | + return list; | |
26 | + } | |
27 | + | |
28 | + public void setList(List<Form1> list) { | |
29 | + this.list = list; | |
30 | + } | |
31 | +} | ... | ... |
... | ... | @@ -0,0 +1,64 @@ |
1 | +package com.jevon.wordDTO.second; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/18 0018 16:10 | |
7 | + */ | |
8 | +public class Form2 { | |
9 | + | |
10 | + private String name ; | |
11 | + private int studentNumber ; | |
12 | + private int highNumber ; | |
13 | + private double highProp ; | |
14 | + private int lowNumber ; | |
15 | + private double lowProp ; | |
16 | + | |
17 | + public String getName() { | |
18 | + return name; | |
19 | + } | |
20 | + | |
21 | + public void setName(String name) { | |
22 | + this.name = name; | |
23 | + } | |
24 | + | |
25 | + public int getStudentNumber() { | |
26 | + return studentNumber; | |
27 | + } | |
28 | + | |
29 | + public void setStudentNumber(int studentNumber) { | |
30 | + this.studentNumber = studentNumber; | |
31 | + } | |
32 | + | |
33 | + public int getHighNumber() { | |
34 | + return highNumber; | |
35 | + } | |
36 | + | |
37 | + public void setHighNumber(int highNumber) { | |
38 | + this.highNumber = highNumber; | |
39 | + } | |
40 | + | |
41 | + public double getHighProp() { | |
42 | + return highProp; | |
43 | + } | |
44 | + | |
45 | + public void setHighProp(double highProp) { | |
46 | + this.highProp = highProp; | |
47 | + } | |
48 | + | |
49 | + public int getLowNumber() { | |
50 | + return lowNumber; | |
51 | + } | |
52 | + | |
53 | + public void setLowNumber(int lowNumber) { | |
54 | + this.lowNumber = lowNumber; | |
55 | + } | |
56 | + | |
57 | + public double getLowProp() { | |
58 | + return lowProp; | |
59 | + } | |
60 | + | |
61 | + public void setLowProp(double lowProp) { | |
62 | + this.lowProp = lowProp; | |
63 | + } | |
64 | +} | ... | ... |
src/main/resources/mapping/AnalyseMapper.xml
... | ... | @@ -4,9 +4,10 @@ |
4 | 4 | <resultMap id="BaseResultMap" type="com.jevon.model.Analyse" > |
5 | 5 | <id column="id" property="id" jdbcType="INTEGER" /> |
6 | 6 | <result column="exam_name" property="examName" jdbcType="VARCHAR" /> |
7 | - <result column="exam_time" property="examTime" jdbcType="TIMESTAMP" /> | |
7 | + <result column="exam_time" property="examTime" jdbcType="VARCHAR" /> | |
8 | 8 | <result column="course_name" property="courseName" jdbcType="VARCHAR" /> |
9 | 9 | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
10 | + <result column="max_score" property="maxScore" jdbcType="FLOAT" /> | |
10 | 11 | </resultMap> |
11 | 12 | |
12 | 13 | <insert id="insert" parameterType="com.jevon.model.Analyse" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> |
... | ... | @@ -14,6 +15,22 @@ |
14 | 15 | values (#{examName},#{examTime},#{courseName},#{createTime}) |
15 | 16 | </insert> |
16 | 17 | |
18 | + <update id="update" parameterType="com.jevon.model.Analyse"> | |
19 | + update sz_learn_analyse | |
20 | + <set > | |
21 | + <if test="examName != null" > | |
22 | + exam_name = #{examName}, | |
23 | + </if> | |
24 | + <if test="examTime != null" > | |
25 | + exam_time = #{examTime}, | |
26 | + </if> | |
27 | + <if test="maxScore != 0" > | |
28 | + max_score = #{maxScore}, | |
29 | + </if> | |
30 | + </set> | |
31 | + where id = #{id} | |
32 | + </update> | |
33 | + | |
17 | 34 | <select id="select" parameterType="com.jevon.model.Analyse" resultMap="BaseResultMap"> |
18 | 35 | select * from sz_learn_analyse where 1=1 |
19 | 36 | <if test="courseName != 0"> | ... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.jevon.mapper.StudentDetailMapper" > | |
4 | + <resultMap id="BaseResultMap" type="com.jevon.model.StudentDetail" > | |
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | |
6 | + <result column="open_id" property="analyseId" jdbcType="INTEGER" /> | |
7 | + <result column="school_name" property="schoolName" jdbcType="VARCHAR" /> | |
8 | + <result column="class_name" property="className" jdbcType="VARCHAR" /> | |
9 | + <result column="student_name" property="studentName" jdbcType="VARCHAR" /> | |
10 | + <result column="student_number" property="studentNumber" jdbcType="VARCHAR" /> | |
11 | + <result column="analyse_id" property="analyseId" jdbcType="INTEGER" /> | |
12 | + <result column="exam_number" property="examNumber" jdbcType="VARCHAR" /> | |
13 | + <result column="score" property="score" jdbcType="FLOAT" /> | |
14 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | |
15 | + </resultMap> | |
16 | + | |
17 | + <insert id="insertBatch" parameterType="java.util.List"> | |
18 | + insert into sz_learn_student_detail (school_name, class_name,student_name, | |
19 | + student_number,analyse_id,exam_number,score,create_time) | |
20 | + values | |
21 | + <foreach collection="list" item="emp" separator=","> | |
22 | + (#{emp.schoolName},#{emp.className},#{emp.studentName}, | |
23 | + #{emp.studentNumber},#{emp.analyseId},#{emp.examNumber},#{emp.score},#{emp.createTime}) | |
24 | + </foreach> | |
25 | + </insert> | |
26 | +</mapper> | |
0 | 27 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.jevon.mapper.StudentMapper" > | |
4 | + <resultMap id="BaseResultMap" type="com.jevon.model.Student" > | |
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | |
6 | + <result column="open_id" property="analyseId" jdbcType="INTEGER" /> | |
7 | + <result column="school_name" property="schoolName" jdbcType="VARCHAR" /> | |
8 | + <result column="class_name" property="className" jdbcType="VARCHAR" /> | |
9 | + <result column="student_name" property="studentName" jdbcType="VARCHAR" /> | |
10 | + <result column="student_number" property="studentNumber" jdbcType="VARCHAR" /> | |
11 | + <result column="analyse_id" property="analyseId" jdbcType="INTEGER" /> | |
12 | + <result column="score" property="score" jdbcType="FLOAT" /> | |
13 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | |
14 | + </resultMap> | |
15 | + | |
16 | + <insert id="insertBatch" parameterType="java.util.List"> | |
17 | + insert into sz_learn_student (school_name, class_name,student_name, | |
18 | + student_number,analyse_id,score,create_time) | |
19 | + values | |
20 | + <foreach collection="list" item="emp" separator=","> | |
21 | + (#{emp.schoolName},#{emp.className},#{emp.studentName}, | |
22 | + #{emp.studentNumber},#{emp.analyseId},#{emp.score},#{emp.createTime}) | |
23 | + </foreach> | |
24 | + </insert> | |
25 | + | |
26 | + <select id="selectBySchoolName" parameterType="com.jevon.model.Student" resultMap="BaseResultMap"> | |
27 | + select * from sz_learn_student where 1=1 | |
28 | + <if test="analyseId != 0"> | |
29 | + and analyse_id = #{analyseId} | |
30 | + </if> | |
31 | + <if test="schoolName != null"> | |
32 | + and school_name = #{schoolName} | |
33 | + </if> | |
34 | + order by score desc | |
35 | + </select> | |
36 | + | |
37 | + <select id="selectCountByScore" parameterType="com.jevon.model.Student" resultType="java.lang.Integer"> | |
38 | + select count(1) from sz_learn_student where analyse_id = #{analyseId} and school_name = #{schoolName} | |
39 | + and score <![CDATA[ >= ]]> #{begin} and score <![CDATA[ < ]]> #{end} | |
40 | + </select> | |
41 | +</mapper> | |
0 | 42 | \ No newline at end of file | ... | ... |