Commit e6e6895df48d7fe8027027d418c3f6557d01f2b5
1 parent
ef5c16a0
Exists in
master
学科考试概况
Showing
21 changed files
with
767 additions
and
36 deletions
Show diff stats
src/main/java/com/jevon/controller/LearnController.java
... | ... | @@ -140,7 +140,7 @@ public class LearnController { |
140 | 140 | analyseDetail.setAnalyseId(analyse.getId()); |
141 | 141 | analyseDetail.setQuestionType(examExcelVo.getQuestionType()); |
142 | 142 | analyseDetail.setDifficult(DifficultEnums.getDifficultType(examExcelVo.getDifficult())); |
143 | - analyseDetail.setScore(new Float(examExcelVo.getScore())); | |
143 | + analyseDetail.setScore(new Double(examExcelVo.getScore())); | |
144 | 144 | analyseDetail.setCreateTime(date); |
145 | 145 | analyseDetails.add(analyseDetail); |
146 | 146 | initAnalyseDimensional(analyse,questionNumber,examExcelVo.getScore(),examExcelVo.getKnowledge(),DimensionalEnums.knowledge.getDimensionalType(),analyseDimensionals); |
... | ... | @@ -151,7 +151,7 @@ public class LearnController { |
151 | 151 | } |
152 | 152 | analyseDetailService.insertBatch(analyseDetails); |
153 | 153 | analyseDimensionalService.insertBatch(analyseDimensionals); |
154 | - analyse.setMaxScore(maxScore); | |
154 | + analyse.setMaxScore(new Double(maxScore)); | |
155 | 155 | analyseService.update(analyse); |
156 | 156 | }catch (Exception e){ |
157 | 157 | System.out.println(e); | ... | ... |
src/main/java/com/jevon/controller/LearnStatController.java
1 | 1 | package com.jevon.controller; |
2 | 2 | |
3 | 3 | import com.jevon.model.Analyse; |
4 | +import com.jevon.model.AnalyseDetail; | |
4 | 5 | import com.jevon.model.Student; |
5 | 6 | import com.jevon.service.*; |
7 | +import com.jevon.vo.BaseVo; | |
6 | 8 | 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; | |
9 | +import com.jevon.wordDTO.second.*; | |
10 | 10 | import io.swagger.annotations.Api; |
11 | 11 | import io.swagger.annotations.ApiOperation; |
12 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -47,14 +47,14 @@ public class LearnStatController { |
47 | 47 | @Autowired |
48 | 48 | StudentService studentService; |
49 | 49 | |
50 | - @ApiOperation("getForm2_1") | |
51 | - @RequestMapping(value = "getForm2_1", method = RequestMethod.POST) | |
52 | - public Form1RepVo getForm2_1(@RequestBody GetLearnReqVo getLearnReqVo){ | |
50 | + @ApiOperation("getForm2_1_1") | |
51 | + @RequestMapping(value = "getForm2_1_1", method = RequestMethod.POST) | |
52 | + public Form1RepVo getForm2_1_1(@RequestBody GetLearnReqVo getLearnReqVo){ | |
53 | 53 | Form1RepVo form1RepVo = new Form1RepVo(); |
54 | 54 | //2.1表 |
55 | 55 | Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); |
56 | 56 | //分数段 |
57 | - float maxScore = analyse.getMaxScore(); | |
57 | + Double maxScore = analyse.getMaxScore(); | |
58 | 58 | Map<String,String> segmentMap = new HashMap<>(); |
59 | 59 | segmentMap.put("A(优秀)",maxScore*0.85 + "~" + maxScore+"分"); |
60 | 60 | segmentMap.put("B(良好)",maxScore*0.7 + "~" + (maxScore*0.85-1f)+"分"); |
... | ... | @@ -71,19 +71,19 @@ public class LearnStatController { |
71 | 71 | Form1 formA = new Form1(); |
72 | 72 | formA.setLevel("A"); |
73 | 73 | formA.setNumber(a); |
74 | - formA.setProp(a/sum); | |
74 | + formA.setProp(a/sum*100); | |
75 | 75 | Form1 formB = new Form1(); |
76 | 76 | formB.setLevel("B"); |
77 | 77 | formB.setNumber(b); |
78 | - formB.setProp(b/sum); | |
78 | + formB.setProp(b/sum*100); | |
79 | 79 | Form1 formC = new Form1(); |
80 | 80 | formC.setLevel("C"); |
81 | 81 | formC.setNumber(c); |
82 | - formC.setProp(c/sum); | |
82 | + formC.setProp(c/sum*100); | |
83 | 83 | Form1 formD = new Form1(); |
84 | 84 | formD.setLevel("D"); |
85 | 85 | formD.setNumber(d); |
86 | - formD.setProp(d/sum); | |
86 | + formD.setProp(d/sum*100); | |
87 | 87 | form1List.add(formA); |
88 | 88 | form1List.add(formB); |
89 | 89 | form1List.add(formC); |
... | ... | @@ -92,9 +92,9 @@ public class LearnStatController { |
92 | 92 | return form1RepVo; |
93 | 93 | } |
94 | 94 | |
95 | - @ApiOperation("getForm2_2") | |
96 | - @RequestMapping(value = "getForm2_2", method = RequestMethod.POST) | |
97 | - public List<Form2> getForm2_2(@RequestBody GetLearnReqVo getLearnReqVo){ | |
95 | + @ApiOperation("getForm2_1_2") | |
96 | + @RequestMapping(value = "getForm2_1_2", method = RequestMethod.POST) | |
97 | + public List<Form2> getForm2_1_2(@RequestBody GetLearnReqVo getLearnReqVo){ | |
98 | 98 | Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); |
99 | 99 | List<Student> allStudents = studentService.selectBySchoolName(getLearnReqVo.getAnalyseId(),null); |
100 | 100 | List<Student> students = studentService.selectBySchoolName(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName()); |
... | ... | @@ -103,23 +103,205 @@ public class LearnStatController { |
103 | 103 | double highScore = allStudents.get(highNumber).getScore(); |
104 | 104 | int lowNumber = allStudents.size()-highNumber; |
105 | 105 | double lowScore = allStudents.get(lowNumber).getScore(); |
106 | + int highAllCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),null,highScore,analyse.getMaxScore()+1f); | |
107 | + int lowAllCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),null,0,lowScore); | |
106 | 108 | int highCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),highScore,analyse.getMaxScore()+1f); |
107 | 109 | int lowCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),0,lowScore); |
108 | 110 | List<Form2> list = new ArrayList<>(); |
109 | 111 | Form2 form = new Form2(); |
110 | 112 | form.setName("联盟校"); |
111 | 113 | form.setStudentNumber(allStudents.size()); |
112 | - form.setHighNumber(highNumber); | |
113 | - form.setLowNumber(highNumber); | |
114 | + form.setHighNumber(highAllCount); | |
115 | + form.setLowNumber(lowAllCount); | |
114 | 116 | list.add(form); |
115 | 117 | Form2 form2 = new Form2(); |
116 | 118 | form2.setName(getLearnReqVo.getSchoolName()); |
117 | 119 | form2.setStudentNumber(students.size()); |
118 | 120 | form2.setHighNumber(highCount); |
119 | 121 | form2.setLowNumber(lowCount); |
120 | - form2.setHighProp(highCount/new Double(allStudents.size())); | |
121 | - form2.setLowProp(lowCount/new Double(allStudents.size())); | |
122 | + form2.setHighProp(highCount/new Double(highAllCount)); | |
123 | + form2.setLowProp(lowCount/new Double(lowAllCount)); | |
122 | 124 | list.add(form2); |
123 | 125 | return list; |
124 | 126 | } |
127 | + | |
128 | + @ApiOperation("getForm2_1_3_2") | |
129 | + @RequestMapping(value = "getForm2_1_3_2", method = RequestMethod.POST) | |
130 | + public List<Form2> getForm2_1_3_2(@RequestBody GetLearnReqVo getLearnReqVo){ | |
131 | + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); | |
132 | + List<Student> allStudents = studentService.selectBySchoolName(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName()); | |
133 | + //先算高分段的分数 再去人数 | |
134 | + int highNumber = (int) Math.floor(allStudents.size()*0.27); | |
135 | + double highScore = allStudents.get(highNumber).getScore(); | |
136 | + int lowNumber = allStudents.size()-highNumber; | |
137 | + double lowScore = allStudents.get(lowNumber).getScore(); | |
138 | + int highAllCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),highScore,analyse.getMaxScore()+1f); | |
139 | + int lowAllCount = studentService.selectCountByScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),0,lowScore); | |
140 | + List<Form2> resultList = new ArrayList<>(); | |
141 | + Form2 form = new Form2(); | |
142 | + form.setName("联盟校"); | |
143 | + form.setStudentNumber(allStudents.size()); | |
144 | + form.setHighNumber(highAllCount); | |
145 | + form.setLowNumber(lowAllCount); | |
146 | + resultList.add(form); | |
147 | + List<String> classNamList = studentService.selectClassNameBySchool(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName()); | |
148 | + for(String className : classNamList){ | |
149 | + List<Student> list = studentService.selectByClassName(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),className); | |
150 | + int highCount = studentService.selectCountBySchoolScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),className,highScore,analyse.getMaxScore()+1f); | |
151 | + int lowCount = studentService.selectCountBySchoolScore(getLearnReqVo.getAnalyseId(),getLearnReqVo.getSchoolName(),className,0,lowScore); | |
152 | + Form2 form2 = new Form2(); | |
153 | + form2.setName(className); | |
154 | + form2.setStudentNumber(list.size()); | |
155 | + form2.setHighNumber(highCount); | |
156 | + form2.setLowNumber(lowCount); | |
157 | + form2.setHighProp(highCount/new Double(highAllCount)); | |
158 | + form2.setLowProp(lowCount/new Double(lowAllCount)); | |
159 | + resultList.add(form2); | |
160 | + } | |
161 | + return resultList; | |
162 | + } | |
163 | + | |
164 | + @ApiOperation("getForm2_1_3") | |
165 | + @RequestMapping(value = "getForm2_1_3", method = RequestMethod.POST) | |
166 | + public List<Table1> getForm2_1_3(@RequestBody GetLearnReqVo getLearnReqVo){ | |
167 | + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); | |
168 | + List<Double> list = new ArrayList<>(); | |
169 | + list.add(Math.ceil(analyse.getMaxScore())); | |
170 | + list.add(Math.ceil(analyse.getMaxScore()*0.95)); | |
171 | + list.add(Math.ceil(analyse.getMaxScore()*0.9)); | |
172 | + list.add(Math.ceil(analyse.getMaxScore()*0.85)); | |
173 | + list.add(Math.ceil(analyse.getMaxScore()*0.8)); | |
174 | + list.add(Math.ceil(analyse.getMaxScore()*0.75)); | |
175 | + list.add(Math.ceil(analyse.getMaxScore()*0.7)); | |
176 | + list.add(Math.ceil(analyse.getMaxScore()*0.65)); | |
177 | + list.add(Math.ceil(analyse.getMaxScore()*0.6)); | |
178 | + list.add(Math.ceil(analyse.getMaxScore()*0.55)); | |
179 | + list.add(Math.ceil(analyse.getMaxScore()*0.5)); | |
180 | + list.add(Math.ceil(analyse.getMaxScore()*0.45)); | |
181 | + list.add(Math.ceil(analyse.getMaxScore()*0.4)); | |
182 | + list.add(Math.ceil(analyse.getMaxScore()*0.35)); | |
183 | + list.add(Math.ceil(analyse.getMaxScore()*0.3)); | |
184 | + list.add(Math.ceil(analyse.getMaxScore()*0)); | |
185 | + List<Table1> list1 = new ArrayList<>(); | |
186 | + for(int i =0 ; i <list.size() ; i++){ | |
187 | + Table1 table1 = new Table1(); | |
188 | + if(i == 0){ | |
189 | + table1.setScore(list.get(i)+""); | |
190 | + table1.setNumber(studentService.selectCountByScore(analyse.getId(),getLearnReqVo.getSchoolName(),new Double(list.get(i)),new Double(list.get(i)+1))); | |
191 | + }else { | |
192 | + table1.setScore(list.get(i)+"-"+(list.get(i-1)-0.5)); | |
193 | + table1.setNumber(studentService.selectCountByScore(analyse.getId(),getLearnReqVo.getSchoolName(),new Double(list.get(i)),new Double(list.get(i-1)))); | |
194 | + } | |
195 | + list1.add(table1); | |
196 | + } | |
197 | + return list1; | |
198 | + } | |
199 | + | |
200 | + @ApiOperation("getForm2_2_1") | |
201 | + @RequestMapping(value = "getForm2_2_1", method = RequestMethod.POST) | |
202 | + public List<Form3> getForm2_2_1(@RequestBody GetLearnReqVo getLearnReqVo){ | |
203 | + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); | |
204 | + List<Form3> list = new ArrayList<>(); | |
205 | + Form3 form3 = new Form3(); | |
206 | + form3.setName("联盟校"); | |
207 | + List<Student> allStudents = studentService.selectBySchoolName(analyse.getId(),null); | |
208 | + form3.setMaxScore(studentService.selectMaxScore(analyse.getId(),null)); | |
209 | + form3.setAverage(studentService.selectAvgScore(analyse.getId(),null)); | |
210 | + form3.setMinScore(studentService.selectMinScore(analyse.getId(),null)); | |
211 | + int a = studentService.selectCountByScore(analyse.getId(),null,analyse.getMaxScore()*0.85,analyse.getMaxScore()+1); | |
212 | + form3.setApercent(a / new Double(allStudents.size()) * 100); | |
213 | + int b = studentService.selectCountByScore(analyse.getId(),null,analyse.getMaxScore()*0.7,analyse.getMaxScore()*0.85); | |
214 | + form3.setBpercent(b / new Double(allStudents.size()) * 100); | |
215 | + int c = studentService.selectCountByScore(analyse.getId(),null,analyse.getMaxScore()*0.6,analyse.getMaxScore()*0.7); | |
216 | + form3.setCpercent(c / new Double(allStudents.size()) * 100); | |
217 | + int d = studentService.selectCountByScore(analyse.getId(),null,analyse.getMaxScore()*0,analyse.getMaxScore()*0.6); | |
218 | + form3.setDpercent(d / new Double(allStudents.size()) * 100); | |
219 | + list.add(form3); | |
220 | + | |
221 | + Form3 form = new Form3(); | |
222 | + form.setName("联盟校"); | |
223 | + List<Student> students = studentService.selectBySchoolName(analyse.getId(),getLearnReqVo.getSchoolName()); | |
224 | + form.setMaxScore(studentService.selectMaxScore(analyse.getId(),getLearnReqVo.getSchoolName())); | |
225 | + form.setAverage(studentService.selectAvgScore(analyse.getId(),getLearnReqVo.getSchoolName())); | |
226 | + form.setMinScore(studentService.selectMinScore(analyse.getId(),getLearnReqVo.getSchoolName())); | |
227 | + int a1 = studentService.selectCountByScore(analyse.getId(),getLearnReqVo.getSchoolName(),analyse.getMaxScore()*0.85,analyse.getMaxScore()+1); | |
228 | + form.setApercent(a1 / new Double(students.size()) * 100); | |
229 | + int b1 = studentService.selectCountByScore(analyse.getId(),getLearnReqVo.getSchoolName(),analyse.getMaxScore()*0.7,analyse.getMaxScore()*0.85); | |
230 | + form.setBpercent(b1 / new Double(students.size()) * 100); | |
231 | + int c1 = studentService.selectCountByScore(analyse.getId(),getLearnReqVo.getSchoolName(),analyse.getMaxScore()*0.6,analyse.getMaxScore()*0.7); | |
232 | + form.setCpercent(c1 / new Double(students.size()) * 100); | |
233 | + int d1 = studentService.selectCountByScore(analyse.getId(),getLearnReqVo.getSchoolName(),analyse.getMaxScore()*0,analyse.getMaxScore()*0.6); | |
234 | + form.setDpercent(d1 / new Double(students.size()) * 100); | |
235 | + list.add(form); | |
236 | + return list ; | |
237 | + } | |
238 | + | |
239 | + @ApiOperation("getForm2_2_2") | |
240 | + @RequestMapping(value = "getForm2_2_2", method = RequestMethod.POST) | |
241 | + public List<Form4> getForm2_2_2(@RequestBody GetLearnReqVo getLearnReqVo){ | |
242 | + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); | |
243 | + List<Form4> list = new ArrayList<>(); | |
244 | + Form4 form4 = new Form4(); | |
245 | + form4.setName("联盟校"); | |
246 | + form4.setModeNumber(studentService.selectModeNumber(analyse.getId(),null)); | |
247 | + form4.setMedianNumber(studentService.selectMedian(analyse.getId(),null)); | |
248 | + form4.setStdev(studentService.selectStdev(analyse.getId(),null)); | |
249 | + form4.setAvgNumber(studentService.selectAvgScore(analyse.getId(),null)); | |
250 | + list.add(form4); | |
251 | + Form4 form = new Form4(); | |
252 | + form.setName(getLearnReqVo.getSchoolName()); | |
253 | + form.setModeNumber(studentService.selectModeNumber(analyse.getId(),getLearnReqVo.getSchoolName())); | |
254 | + form.setMedianNumber(studentService.selectMedian(analyse.getId(),getLearnReqVo.getSchoolName())); | |
255 | + form.setStdev(studentService.selectStdev(analyse.getId(),getLearnReqVo.getSchoolName())); | |
256 | + form.setAvgNumber(studentService.selectAvgScore(analyse.getId(),getLearnReqVo.getSchoolName())); | |
257 | + list.add(form); | |
258 | + return list; | |
259 | + } | |
260 | + | |
261 | + @ApiOperation("getForm2_2_3") | |
262 | + @RequestMapping(value = "getForm2_2_3", method = RequestMethod.POST) | |
263 | + public List<From5> getForm2_2_3(@RequestBody GetLearnReqVo getLearnReqVo){ | |
264 | + List<From5> list = new ArrayList<>(); | |
265 | + Analyse analyse = analyseService.selectById(getLearnReqVo.getAnalyseId()); | |
266 | + List<Student> allStudents = studentService.selectBySchoolName(analyse.getId(),null); | |
267 | + int allNumber = (int) Math.floor(allStudents.size()*0.27) ; | |
268 | + List<String> allHighStudent = new ArrayList<>(); | |
269 | + List<String> allLowStudent = new ArrayList<>(); | |
270 | + for (int i = 0; i < allNumber ; i++) { | |
271 | + allHighStudent.add(allStudents.get(i).getStudentNumber()); | |
272 | + } | |
273 | + for(int i =allStudents.size()-allNumber ; i < allStudents.size() ; i++){ | |
274 | + allLowStudent.add(allStudents.get(i).getStudentNumber()); | |
275 | + } | |
276 | + List<Student> students = studentService.selectBySchoolName(analyse.getId(),getLearnReqVo.getSchoolName()); | |
277 | + int number = (int) Math.floor(students.size()*0.27) ; | |
278 | + List<String> highStudent = new ArrayList<>(); | |
279 | + List<String> lowStudent = new ArrayList<>(); | |
280 | + for (int i = 0; i < number ; i++) { | |
281 | + highStudent.add(students.get(i).getStudentNumber()); | |
282 | + } | |
283 | + for(int i =students.size()-number ; i < students.size() ; i++){ | |
284 | + lowStudent.add(students.get(i).getStudentNumber()); | |
285 | + } | |
286 | + List<AnalyseDetail> analyseDetails = analyseDetailService.selectByAnalyseId(analyse.getId()); | |
287 | + for(AnalyseDetail analyseDetail : analyseDetails){ | |
288 | + From5 from5 = new From5(); | |
289 | + Double allSumScore = studentDetailService.selectSumScore(analyse.getId(),null,analyseDetail.getQuestionNumber()); | |
290 | + Double schoolSumScore = studentDetailService.selectSumScore(analyse.getId(),getLearnReqVo.getSchoolName(),analyseDetail.getQuestionNumber()); | |
291 | + from5.setExamNumber(analyseDetail.getQuestionNumber()); | |
292 | + from5.setScore(analyseDetail.getScore()); | |
293 | + from5.setAllRate(allSumScore/new Double(allStudents.size()) / analyseDetail.getScore()); | |
294 | + from5.setSchoolRate(schoolSumScore/new Double(students.size()) / analyseDetail.getScore()); | |
295 | + from5.setAllAvg(allSumScore / new Double(allStudents.size())); | |
296 | + from5.setSchoolAvg(schoolSumScore / new Double(students.size())); | |
297 | + int allHigh = studentDetailService.selectTrueByExamNumber(analyse.getId(),null ,analyseDetail.getQuestionNumber(),allHighStudent,analyseDetail.getScore()); | |
298 | + int allLow = studentDetailService.selectTrueByExamNumber(analyse.getId(),null ,analyseDetail.getQuestionNumber(),allLowStudent,analyseDetail.getScore()); | |
299 | + int high = studentDetailService.selectTrueByExamNumber(analyse.getId(),getLearnReqVo.getSchoolName() ,analyseDetail.getQuestionNumber(),highStudent,analyseDetail.getScore()); | |
300 | + int low = studentDetailService.selectTrueByExamNumber(analyse.getId(),getLearnReqVo.getSchoolName() ,analyseDetail.getQuestionNumber(),lowStudent,analyseDetail.getScore()); | |
301 | + from5.setAllDist(new Double(allHigh-allLow)/new Double(allNumber)); | |
302 | + from5.setSchoolDist(new Double(high-low)/new Double(number)); | |
303 | + list.add(from5); | |
304 | + } | |
305 | + return list; | |
306 | + } | |
125 | 307 | } | ... | ... |
src/main/java/com/jevon/mapper/AnalyseDetailMapper.java
src/main/java/com/jevon/mapper/StudentDetailMapper.java
src/main/java/com/jevon/mapper/StudentMapper.java
... | ... | @@ -13,7 +13,23 @@ public interface StudentMapper { |
13 | 13 | |
14 | 14 | int insertBatch(List<Student> list); |
15 | 15 | |
16 | - List<Student> selectBySchoolName(Student student); | |
16 | + List<Student> selectByStudent(Student student); | |
17 | 17 | |
18 | 18 | int selectCountByScore(Student student); |
19 | + | |
20 | + List<String> selectClassNameBySchool(Student student); | |
21 | + | |
22 | + //最高分 | |
23 | + Double selectMaxScore(Student student); | |
24 | + //最低分 | |
25 | + Double selectMinScore(Student student); | |
26 | + //平均分 | |
27 | + Double selectAvgScore(Student student); | |
28 | + //众数 | |
29 | + Double selectModeNumber(Student student); | |
30 | + //中位数 | |
31 | + Double selectMedian(Student student); | |
32 | + //标准差 | |
33 | + Double selectStdev(Student student); | |
34 | + | |
19 | 35 | } | ... | ... |
src/main/java/com/jevon/model/Analyse.java
... | ... | @@ -14,7 +14,7 @@ public class Analyse { |
14 | 14 | private String examTime ; |
15 | 15 | private String courseName ; |
16 | 16 | private Date createTime ; |
17 | - private Float maxScore ; | |
17 | + private Double maxScore ; | |
18 | 18 | |
19 | 19 | public int getId() { |
20 | 20 | return id; |
... | ... | @@ -56,11 +56,11 @@ public class Analyse { |
56 | 56 | this.createTime = createTime; |
57 | 57 | } |
58 | 58 | |
59 | - public Float getMaxScore() { | |
59 | + public Double getMaxScore() { | |
60 | 60 | return maxScore; |
61 | 61 | } |
62 | 62 | |
63 | - public void setMaxScore(Float maxScore) { | |
63 | + public void setMaxScore(Double maxScore) { | |
64 | 64 | this.maxScore = maxScore; |
65 | 65 | } |
66 | 66 | } | ... | ... |
src/main/java/com/jevon/model/AnalyseDetail.java
... | ... | @@ -14,7 +14,7 @@ public class AnalyseDetail { |
14 | 14 | private String questionNumber ; |
15 | 15 | private String questionType ; |
16 | 16 | private int difficult ; |
17 | - private float score ; | |
17 | + private Double score ; | |
18 | 18 | private Date createTime ; |
19 | 19 | |
20 | 20 | public int getId() { |
... | ... | @@ -49,11 +49,11 @@ public class AnalyseDetail { |
49 | 49 | this.difficult = difficult; |
50 | 50 | } |
51 | 51 | |
52 | - public float getScore() { | |
52 | + public Double getScore() { | |
53 | 53 | return score; |
54 | 54 | } |
55 | 55 | |
56 | - public void setScore(float score) { | |
56 | + public void setScore(Double score) { | |
57 | 57 | this.score = score; |
58 | 58 | } |
59 | 59 | ... | ... |
src/main/java/com/jevon/model/StudentDetail.java
... | ... | @@ -3,6 +3,7 @@ package com.jevon.model; |
3 | 3 | import com.jevon.vo.excel.ScoreExcelVo; |
4 | 4 | |
5 | 5 | import java.util.Date; |
6 | +import java.util.List; | |
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @author chen |
... | ... | @@ -22,6 +23,9 @@ public class StudentDetail { |
22 | 23 | private float score ; |
23 | 24 | private Date createTime ; |
24 | 25 | |
26 | + //查询用 高分段 低分段学生考号 | |
27 | + private List<String> studentNumbers ; | |
28 | + | |
25 | 29 | public StudentDetail(ScoreExcelVo scoreExcelVo) { |
26 | 30 | this.schoolName = scoreExcelVo.getSchoolName(); |
27 | 31 | this.className = scoreExcelVo.getClassName(); |
... | ... | @@ -29,6 +33,9 @@ public class StudentDetail { |
29 | 33 | this.studentNumber = scoreExcelVo.getStudentNumber(); |
30 | 34 | } |
31 | 35 | |
36 | + public StudentDetail() { | |
37 | + } | |
38 | + | |
32 | 39 | public int getId() { |
33 | 40 | return id; |
34 | 41 | } |
... | ... | @@ -108,4 +115,12 @@ public class StudentDetail { |
108 | 115 | public void setCreateTime(Date createTime) { |
109 | 116 | this.createTime = createTime; |
110 | 117 | } |
118 | + | |
119 | + public List<String> getStudentNumbers() { | |
120 | + return studentNumbers; | |
121 | + } | |
122 | + | |
123 | + public void setStudentNumbers(List<String> studentNumbers) { | |
124 | + this.studentNumbers = studentNumbers; | |
125 | + } | |
111 | 126 | } | ... | ... |
src/main/java/com/jevon/service/AnalyseDetailService.java
src/main/java/com/jevon/service/StudentDetailService.java
... | ... | @@ -13,4 +13,8 @@ public interface StudentDetailService { |
13 | 13 | |
14 | 14 | int insertBatch(List<StudentDetail> list); |
15 | 15 | |
16 | + Double selectSumScore(int analyseId , String schoolName , String examNumber); | |
17 | + | |
18 | + int selectTrueByExamNumber(int analyseId , String schoolName , String examNumber , List<String> studentNumbers ,Double score); | |
19 | + | |
16 | 20 | } | ... | ... |
src/main/java/com/jevon/service/StudentService.java
... | ... | @@ -15,6 +15,23 @@ public interface StudentService { |
15 | 15 | |
16 | 16 | List<Student> selectBySchoolName(int analyseId , String schoolName); |
17 | 17 | |
18 | + List<Student> selectByClassName(int analyseId , String schoolName ,String className); | |
19 | + | |
18 | 20 | int selectCountByScore(int analyseId , String schoolName , double begin , double end); |
19 | 21 | |
22 | + int selectCountBySchoolScore(int analyseId , String schoolName ,String className , double begin , double end); | |
23 | + | |
24 | + List<String> selectClassNameBySchool(int analyseId , String schoolName); | |
25 | + | |
26 | + Double selectMaxScore(int analyseId , String schoolName); | |
27 | + | |
28 | + Double selectMinScore(int analyseId , String schoolName); | |
29 | + | |
30 | + Double selectAvgScore(int analyseId , String schoolName); | |
31 | + //众数 | |
32 | + Double selectModeNumber(int analyseId , String schoolName); | |
33 | + //中位数 | |
34 | + Double selectMedian(int analyseId , String schoolName); | |
35 | + //标准差 | |
36 | + Double selectStdev(int analyseId , String schoolName); | |
20 | 37 | } | ... | ... |
src/main/java/com/jevon/service/impl/AnalyseDetailServiceImpl.java
... | ... | @@ -35,4 +35,9 @@ public class AnalyseDetailServiceImpl implements AnalyseDetailService { |
35 | 35 | analyseDetailMapper.insertBatch(result); |
36 | 36 | return 1 ; |
37 | 37 | } |
38 | + | |
39 | + @Override | |
40 | + public List<AnalyseDetail> selectByAnalyseId(int analyseId) { | |
41 | + return analyseDetailMapper.selectByAnalyseId(analyseId); | |
42 | + } | |
38 | 43 | } | ... | ... |
src/main/java/com/jevon/service/impl/StudentDetailServiceImpl.java
... | ... | @@ -35,4 +35,24 @@ public class StudentDetailServiceImpl implements StudentDetailService { |
35 | 35 | studentDetailMapper.insertBatch(result); |
36 | 36 | return 1 ; |
37 | 37 | } |
38 | + | |
39 | + @Override | |
40 | + public Double selectSumScore(int analyseId, String schoolName, String examNumber) { | |
41 | + StudentDetail studentDetail = new StudentDetail(); | |
42 | + studentDetail.setAnalyseId(analyseId); | |
43 | + studentDetail.setSchoolName(schoolName); | |
44 | + studentDetail.setExamNumber(examNumber); | |
45 | + return studentDetailMapper.selectSumScore(studentDetail); | |
46 | + } | |
47 | + | |
48 | + @Override | |
49 | + public int selectTrueByExamNumber(int analyseId, String schoolName, String examNumber, List<String> studentNumbers , Double score) { | |
50 | + StudentDetail studentDetail = new StudentDetail(); | |
51 | + studentDetail.setAnalyseId(analyseId); | |
52 | + studentDetail.setSchoolName(schoolName); | |
53 | + studentDetail.setExamNumber(examNumber); | |
54 | + studentDetail.setScore(new Float(score)); | |
55 | + studentDetail.setStudentNumbers(studentNumbers); | |
56 | + return studentDetailMapper.selectTrueByExamNumber(studentDetail); | |
57 | + } | |
38 | 58 | } | ... | ... |
src/main/java/com/jevon/service/impl/StudentServiceImpl.java
... | ... | @@ -41,7 +41,16 @@ public class StudentServiceImpl implements StudentService { |
41 | 41 | Student student = new Student(); |
42 | 42 | student.setAnalyseId(analyseId); |
43 | 43 | student.setSchoolName(schoolName); |
44 | - return studentMapper.selectBySchoolName(student); | |
44 | + return studentMapper.selectByStudent(student); | |
45 | + } | |
46 | + | |
47 | + @Override | |
48 | + public List<Student> selectByClassName(int analyseId, String schoolName, String className) { | |
49 | + Student student = new Student(); | |
50 | + student.setAnalyseId(analyseId); | |
51 | + student.setSchoolName(schoolName); | |
52 | + student.setClassName(className); | |
53 | + return studentMapper.selectByStudent(student); | |
45 | 54 | } |
46 | 55 | |
47 | 56 | @Override |
... | ... | @@ -53,4 +62,70 @@ public class StudentServiceImpl implements StudentService { |
53 | 62 | student.setEnd(end); |
54 | 63 | return studentMapper.selectCountByScore(student); |
55 | 64 | } |
65 | + | |
66 | + @Override | |
67 | + public int selectCountBySchoolScore(int analyseId, String schoolName, String className, double begin, double end) { | |
68 | + Student student = new Student(); | |
69 | + student.setAnalyseId(analyseId); | |
70 | + student.setSchoolName(schoolName); | |
71 | + student.setClassName(className); | |
72 | + student.setBegin(begin); | |
73 | + student.setEnd(end); | |
74 | + return studentMapper.selectCountByScore(student); } | |
75 | + | |
76 | + @Override | |
77 | + public List<String> selectClassNameBySchool(int analyseId, String schoolName) { | |
78 | + Student student = new Student(); | |
79 | + student.setAnalyseId(analyseId); | |
80 | + student.setSchoolName(schoolName); | |
81 | + return studentMapper.selectClassNameBySchool(student); | |
82 | + } | |
83 | + | |
84 | + @Override | |
85 | + public Double selectMaxScore(int analyseId, String schoolName) { | |
86 | + Student student = new Student(); | |
87 | + student.setAnalyseId(analyseId); | |
88 | + student.setSchoolName(schoolName); | |
89 | + return studentMapper.selectMaxScore(student); | |
90 | + } | |
91 | + | |
92 | + @Override | |
93 | + public Double selectMinScore(int analyseId, String schoolName) { | |
94 | + Student student = new Student(); | |
95 | + student.setAnalyseId(analyseId); | |
96 | + student.setSchoolName(schoolName); | |
97 | + return studentMapper.selectMinScore(student); | |
98 | + } | |
99 | + | |
100 | + @Override | |
101 | + public Double selectAvgScore(int analyseId, String schoolName) { | |
102 | + Student student = new Student(); | |
103 | + student.setAnalyseId(analyseId); | |
104 | + student.setSchoolName(schoolName); | |
105 | + return studentMapper.selectAvgScore(student); | |
106 | + } | |
107 | + | |
108 | + @Override | |
109 | + public Double selectModeNumber(int analyseId, String schoolName) { | |
110 | + Student student = new Student(); | |
111 | + student.setAnalyseId(analyseId); | |
112 | + student.setSchoolName(schoolName); | |
113 | + return studentMapper.selectModeNumber(student); | |
114 | + } | |
115 | + | |
116 | + @Override | |
117 | + public Double selectMedian(int analyseId, String schoolName) { | |
118 | + Student student = new Student(); | |
119 | + student.setAnalyseId(analyseId); | |
120 | + student.setSchoolName(schoolName); | |
121 | + return studentMapper.selectMedian(student); | |
122 | + } | |
123 | + | |
124 | + @Override | |
125 | + public Double selectStdev(int analyseId, String schoolName) { | |
126 | + Student student = new Student(); | |
127 | + student.setAnalyseId(analyseId); | |
128 | + student.setSchoolName(schoolName); | |
129 | + return studentMapper.selectStdev(student); | |
130 | + } | |
56 | 131 | } | ... | ... |
... | ... | @@ -0,0 +1,82 @@ |
1 | +package com.jevon.wordDTO.second; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/21 0021 9:03 | |
7 | + */ | |
8 | +public class Form3 { | |
9 | + | |
10 | + private String name ; | |
11 | + private Double maxScore ; | |
12 | + private Double average ; | |
13 | + private Double minScore ; | |
14 | + private Double apercent ; | |
15 | + private Double bpercent ; | |
16 | + private Double cpercent ; | |
17 | + private Double dpercent ; | |
18 | + | |
19 | + public String getName() { | |
20 | + return name; | |
21 | + } | |
22 | + | |
23 | + public void setName(String name) { | |
24 | + this.name = name; | |
25 | + } | |
26 | + | |
27 | + public Double getMaxScore() { | |
28 | + return maxScore; | |
29 | + } | |
30 | + | |
31 | + public void setMaxScore(Double maxScore) { | |
32 | + this.maxScore = maxScore; | |
33 | + } | |
34 | + | |
35 | + public Double getAverage() { | |
36 | + return average; | |
37 | + } | |
38 | + | |
39 | + public void setAverage(Double average) { | |
40 | + this.average = average; | |
41 | + } | |
42 | + | |
43 | + public Double getMinScore() { | |
44 | + return minScore; | |
45 | + } | |
46 | + | |
47 | + public void setMinScore(Double minScore) { | |
48 | + this.minScore = minScore; | |
49 | + } | |
50 | + | |
51 | + public Double getApercent() { | |
52 | + return apercent; | |
53 | + } | |
54 | + | |
55 | + public void setApercent(Double apercent) { | |
56 | + this.apercent = apercent; | |
57 | + } | |
58 | + | |
59 | + public Double getBpercent() { | |
60 | + return bpercent; | |
61 | + } | |
62 | + | |
63 | + public void setBpercent(Double bpercent) { | |
64 | + this.bpercent = bpercent; | |
65 | + } | |
66 | + | |
67 | + public Double getCpercent() { | |
68 | + return cpercent; | |
69 | + } | |
70 | + | |
71 | + public void setCpercent(Double cpercent) { | |
72 | + this.cpercent = cpercent; | |
73 | + } | |
74 | + | |
75 | + public Double getDpercent() { | |
76 | + return dpercent; | |
77 | + } | |
78 | + | |
79 | + public void setDpercent(Double dpercent) { | |
80 | + this.dpercent = dpercent; | |
81 | + } | |
82 | +} | ... | ... |
... | ... | @@ -0,0 +1,55 @@ |
1 | +package com.jevon.wordDTO.second; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/21 0021 9:51 | |
7 | + */ | |
8 | +public class Form4 { | |
9 | + | |
10 | + private String name ; | |
11 | + private Double modeNumber ; | |
12 | + private Double medianNumber ; | |
13 | + private Double stdev ; | |
14 | + private Double avgNumber ; | |
15 | + | |
16 | + public String getName() { | |
17 | + return name; | |
18 | + } | |
19 | + | |
20 | + public void setName(String name) { | |
21 | + this.name = name; | |
22 | + } | |
23 | + | |
24 | + public Double getModeNumber() { | |
25 | + return modeNumber; | |
26 | + } | |
27 | + | |
28 | + public void setModeNumber(Double modeNumber) { | |
29 | + this.modeNumber = modeNumber; | |
30 | + } | |
31 | + | |
32 | + public Double getMedianNumber() { | |
33 | + return medianNumber; | |
34 | + } | |
35 | + | |
36 | + public void setMedianNumber(Double medianNumber) { | |
37 | + this.medianNumber = medianNumber; | |
38 | + } | |
39 | + | |
40 | + public Double getStdev() { | |
41 | + return stdev; | |
42 | + } | |
43 | + | |
44 | + public void setStdev(Double stdev) { | |
45 | + this.stdev = stdev; | |
46 | + } | |
47 | + | |
48 | + public Double getAvgNumber() { | |
49 | + return avgNumber; | |
50 | + } | |
51 | + | |
52 | + public void setAvgNumber(Double avgNumber) { | |
53 | + this.avgNumber = avgNumber; | |
54 | + } | |
55 | +} | ... | ... |
... | ... | @@ -0,0 +1,82 @@ |
1 | +package com.jevon.wordDTO.second; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/21 0021 9:59 | |
7 | + */ | |
8 | +public class From5 { | |
9 | + | |
10 | + private String examNumber ; | |
11 | + private Double score ; | |
12 | + private Double allRate ; | |
13 | + private Double schoolRate ; | |
14 | + private Double allAvg ; | |
15 | + private Double schoolAvg ; | |
16 | + private Double allDist ; | |
17 | + private Double schoolDist ; | |
18 | + | |
19 | + public String getExamNumber() { | |
20 | + return examNumber; | |
21 | + } | |
22 | + | |
23 | + public void setExamNumber(String examNumber) { | |
24 | + this.examNumber = examNumber; | |
25 | + } | |
26 | + | |
27 | + public Double getScore() { | |
28 | + return score; | |
29 | + } | |
30 | + | |
31 | + public void setScore(Double score) { | |
32 | + this.score = score; | |
33 | + } | |
34 | + | |
35 | + public Double getAllRate() { | |
36 | + return allRate; | |
37 | + } | |
38 | + | |
39 | + public void setAllRate(Double allRate) { | |
40 | + this.allRate = allRate; | |
41 | + } | |
42 | + | |
43 | + public Double getSchoolRate() { | |
44 | + return schoolRate; | |
45 | + } | |
46 | + | |
47 | + public void setSchoolRate(Double schoolRate) { | |
48 | + this.schoolRate = schoolRate; | |
49 | + } | |
50 | + | |
51 | + public Double getAllAvg() { | |
52 | + return allAvg; | |
53 | + } | |
54 | + | |
55 | + public void setAllAvg(Double allAvg) { | |
56 | + this.allAvg = allAvg; | |
57 | + } | |
58 | + | |
59 | + public Double getSchoolAvg() { | |
60 | + return schoolAvg; | |
61 | + } | |
62 | + | |
63 | + public void setSchoolAvg(Double schoolAvg) { | |
64 | + this.schoolAvg = schoolAvg; | |
65 | + } | |
66 | + | |
67 | + public Double getAllDist() { | |
68 | + return allDist; | |
69 | + } | |
70 | + | |
71 | + public void setAllDist(Double allDist) { | |
72 | + this.allDist = allDist; | |
73 | + } | |
74 | + | |
75 | + public Double getSchoolDist() { | |
76 | + return schoolDist; | |
77 | + } | |
78 | + | |
79 | + public void setSchoolDist(Double schoolDist) { | |
80 | + this.schoolDist = schoolDist; | |
81 | + } | |
82 | +} | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +package com.jevon.wordDTO.second; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/21 0021 8:34 | |
7 | + */ | |
8 | +public class Table1 { | |
9 | + | |
10 | + private String score ; | |
11 | + private int number ; | |
12 | + | |
13 | + public String getScore() { | |
14 | + return score; | |
15 | + } | |
16 | + | |
17 | + public void setScore(String score) { | |
18 | + this.score = score; | |
19 | + } | |
20 | + | |
21 | + public int getNumber() { | |
22 | + return number; | |
23 | + } | |
24 | + | |
25 | + public void setNumber(int number) { | |
26 | + this.number = number; | |
27 | + } | |
28 | +} | ... | ... |
src/main/resources/mapping/AnalyseDetailMapper.xml
... | ... | @@ -18,4 +18,8 @@ |
18 | 18 | (#{emp.analyseId},#{emp.questionNumber},#{emp.questionType},#{emp.difficult},#{emp.score},#{emp.createTime}) |
19 | 19 | </foreach> |
20 | 20 | </insert> |
21 | + | |
22 | + <select id="selectByAnalyseId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
23 | + select * from sz_learn_analyse_detail where analyse_id = #{analyseId} order by id | |
24 | + </select> | |
21 | 25 | </mapper> |
22 | 26 | \ No newline at end of file | ... | ... |
src/main/resources/mapping/StudentDetailMapper.xml
... | ... | @@ -23,4 +23,34 @@ |
23 | 23 | #{emp.studentNumber},#{emp.analyseId},#{emp.examNumber},#{emp.score},#{emp.createTime}) |
24 | 24 | </foreach> |
25 | 25 | </insert> |
26 | + | |
27 | + <select id="selectSumScore" parameterType="com.jevon.model.StudentDetail" resultType="java.lang.Double"> | |
28 | + SELECT sum(score) FROM sz_learn_student_detail where 1=1 | |
29 | + <if test="analyseId != 0"> | |
30 | + and analyse_id = #{analyseId} | |
31 | + </if> | |
32 | + <if test="schoolName != null"> | |
33 | + and school_name = #{schoolName} | |
34 | + </if> | |
35 | + <if test="examNumber != null"> | |
36 | + and exam_number = #{examNumber} | |
37 | + </if> | |
38 | + </select> | |
39 | + | |
40 | + <select id="selectTrueByExamNumber" parameterType="com.jevon.model.StudentDetail" resultType="java.lang.Integer"> | |
41 | + select count(*) from sz_learn_student_detail where 1=1 | |
42 | + <if test="analyseId != 0"> | |
43 | + and analyse_id = #{analyseId} | |
44 | + </if> | |
45 | + <if test="schoolName != null"> | |
46 | + and school_name = #{schoolName} | |
47 | + </if> | |
48 | + <if test="examNumber != null"> | |
49 | + and exam_number = #{examNumber} | |
50 | + </if> | |
51 | + and score = #{score} and student_number in | |
52 | + <foreach item="item" collection="studentNumbers" open="(" separator="," close=")"> | |
53 | + #{item} | |
54 | + </foreach> | |
55 | + </select> | |
26 | 56 | </mapper> |
27 | 57 | \ No newline at end of file | ... | ... |
src/main/resources/mapping/StudentMapper.xml
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
14 | 14 | </resultMap> |
15 | 15 | |
16 | - <insert id="insertBatch" parameterType="java.util.List"> | |
16 | + <insert id="insertBatch" parameterType="java.util.List"> | |
17 | 17 | insert into sz_learn_student (school_name, class_name,student_name, |
18 | 18 | student_number,analyse_id,score,create_time) |
19 | 19 | values |
... | ... | @@ -21,9 +21,9 @@ |
21 | 21 | (#{emp.schoolName},#{emp.className},#{emp.studentName}, |
22 | 22 | #{emp.studentNumber},#{emp.analyseId},#{emp.score},#{emp.createTime}) |
23 | 23 | </foreach> |
24 | - </insert> | |
24 | + </insert> | |
25 | 25 | |
26 | - <select id="selectBySchoolName" parameterType="com.jevon.model.Student" resultMap="BaseResultMap"> | |
26 | + <select id="selectByStudent" parameterType="com.jevon.model.Student" resultMap="BaseResultMap"> | |
27 | 27 | select * from sz_learn_student where 1=1 |
28 | 28 | <if test="analyseId != 0"> |
29 | 29 | and analyse_id = #{analyseId} |
... | ... | @@ -31,11 +31,118 @@ |
31 | 31 | <if test="schoolName != null"> |
32 | 32 | and school_name = #{schoolName} |
33 | 33 | </if> |
34 | + <if test="className != null"> | |
35 | + and class_name = #{className} | |
36 | + </if> | |
34 | 37 | order by score desc |
35 | - </select> | |
38 | + </select> | |
39 | + | |
40 | + <select id="selectCountByScore" parameterType="com.jevon.model.Student" resultType="java.lang.Integer"> | |
41 | + select count(1) from sz_learn_student where 1=1 | |
42 | + <if test="analyseId != 0"> | |
43 | + and analyse_id = #{analyseId} | |
44 | + </if> | |
45 | + <if test="schoolName != null"> | |
46 | + and school_name = #{schoolName} | |
47 | + </if> | |
48 | + <if test="className != null"> | |
49 | + and class_name = #{className} | |
50 | + </if> | |
51 | + and score <![CDATA[ >= ]]> #{begin} and score <![CDATA[ < ]]> #{end} | |
52 | + </select> | |
53 | + | |
54 | + <select id="selectClassNameBySchool" parameterType="com.jevon.model.Student" resultType="java.lang.String"> | |
55 | + select DISTINCT(class_name) from sz_learn_student where 1=1 | |
56 | + and analyse_id = #{analyseId} | |
57 | + and school_name = #{schoolName} | |
58 | + </select> | |
59 | + | |
60 | + <select id="selectMaxScore" parameterType="com.jevon.model.Student" resultType="java.lang.Double"> | |
61 | + select max(score) from sz_learn_student where 1=1 | |
62 | + <if test="analyseId != 0"> | |
63 | + and analyse_id = #{analyseId} | |
64 | + </if> | |
65 | + <if test="schoolName != null"> | |
66 | + and school_name = #{schoolName} | |
67 | + </if> | |
68 | + </select> | |
69 | + | |
70 | + <select id="selectMinScore" parameterType="com.jevon.model.Student" resultType="java.lang.Double"> | |
71 | + select min(score) from sz_learn_student where 1=1 | |
72 | + <if test="analyseId != 0"> | |
73 | + and analyse_id = #{analyseId} | |
74 | + </if> | |
75 | + <if test="schoolName != null"> | |
76 | + and school_name = #{schoolName} | |
77 | + </if> | |
78 | + </select> | |
79 | + | |
80 | + <select id="selectAvgScore" parameterType="com.jevon.model.Student" resultType="java.lang.Double"> | |
81 | + select avg(score) from sz_learn_student where 1=1 | |
82 | + <if test="analyseId != 0"> | |
83 | + and analyse_id = #{analyseId} | |
84 | + </if> | |
85 | + <if test="schoolName != null"> | |
86 | + and school_name = #{schoolName} | |
87 | + </if> | |
88 | + </select> | |
89 | + | |
90 | + <select id="selectModeNumber" parameterType="com.jevon.model.Student" resultType="java.lang.Double"> | |
91 | + SELECT score FROM sz_learn_student | |
92 | + WHERE 1=1 | |
93 | + <if test="analyseId != 0"> | |
94 | + and analyse_id = #{analyseId} | |
95 | + </if> | |
96 | + <if test="schoolName != null"> | |
97 | + and school_name = #{schoolName} | |
98 | + </if> | |
99 | + GROUP BY score | |
100 | + HAVING COUNT ( * ) >= ( | |
101 | + SELECT MAX( cnt ) FROM | |
102 | + ( | |
103 | + SELECT COUNT ( * ) cnt FROM sz_learn_student WHERE 1=1 | |
104 | + <if test="analyseId != 0"> | |
105 | + and analyse_id = #{analyseId} | |
106 | + </if> | |
107 | + <if test="schoolName != null"> | |
108 | + and school_name = #{schoolName} | |
109 | + </if> | |
110 | + GROUP BY score ) tmp | |
111 | + ) | |
112 | + </select> | |
36 | 113 | |
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> | |
114 | + <select id="selectMedian" parameterType="com.jevon.model.Student" resultType="java.lang.Double"> | |
115 | + SELECT | |
116 | + avg(DISTINCT score) | |
117 | + FROM ( | |
118 | + select T1.score from sz_learn_student T1 , sz_learn_student T2 | |
119 | + WHERE 1=1 | |
120 | + <if test="analyseId != 0"> | |
121 | + and T1.analyse_id = #{analyseId} | |
122 | + </if> | |
123 | + <if test="schoolName != null"> | |
124 | + and T1.school_name = #{schoolName} | |
125 | + </if> | |
126 | + <if test="analyseId != 0"> | |
127 | + and T2.analyse_id = #{analyseId} | |
128 | + </if> | |
129 | + <if test="schoolName != null"> | |
130 | + and T2.school_name = #{schoolName} | |
131 | + </if> | |
132 | + GROUP BY | |
133 | + T1.score | |
134 | + HAVING | |
135 | + sum(case when T2.score <![CDATA[ >= ]]> T1.score then 1 else 0 end) >= count(*)/2 | |
136 | + and sum(case when T2.score <![CDATA[ <= ]]> T1.score then 1 else 0 end)>= count(*)/2) tmp | |
137 | + </select> | |
138 | + | |
139 | + <select id="selectStdev" parameterType="com.jevon.model.Student" resultType="java.lang.Double"> | |
140 | + select STDEV(score) from sz_learn_student where 1=1 | |
141 | + <if test="analyseId != 0"> | |
142 | + and analyse_id = #{analyseId} | |
143 | + </if> | |
144 | + <if test="schoolName != null"> | |
145 | + and school_name = #{schoolName} | |
146 | + </if> | |
147 | + </select> | |
41 | 148 | </mapper> |
42 | 149 | \ No newline at end of file | ... | ... |