From eb0e715540a5f0d63b64d851ccea81c63345f7e2 Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Tue, 13 Jun 2023 09:13:43 +0800 Subject: [PATCH] up Signed-off-by: Chenx221 --- .../chenx221/controller/ScoreController.class | Bin 2032 -> 4526 bytes .../cyou/chenx221/mapper/ScoreDao.class | Bin 316 -> 471 bytes .../chenx221/mapper/impl/ScoreDaoImpl.class | Bin 925 -> 1258 bytes .../classes/cyou/chenx221/pojo/Score.class | Bin 3055 -> 3016 bytes .../cyou/chenx221/service/ScoreService.class | Bin 741 -> 1012 bytes .../WEB-INF/classes/mapper/ScoreMapper.xml | 32 +++- .../WEB-INF/views/scoreQueryResult.jsp | 179 ++++++++++++++++++ .../WEB-INF/views/scoreopv2.jsp | 2 +- .../chenx221/controller/ScoreController.java | 78 ++++---- .../java/cyou/chenx221/mapper/ScoreDao.java | 2 + .../chenx221/mapper/impl/ScoreDaoImpl.java | 7 +- .../main/java/cyou/chenx221/pojo/Score.java | 3 +- .../cyou/chenx221/service/ScoreService.java | 4 + .../src/main/resources/mapper/ScoreMapper.xml | 32 +++- .../web/WEB-INF/views/scoreQueryResult.jsp | 179 ++++++++++++++++++ project2/web/WEB-INF/views/scoreopv2.jsp | 2 +- 16 files changed, 476 insertions(+), 44 deletions(-) create mode 100644 project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreQueryResult.jsp create mode 100644 project2/web/WEB-INF/views/scoreQueryResult.jsp diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/controller/ScoreController.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/controller/ScoreController.class index 6687b95b4eeed57db9db800bbf8f9c33a7e6da4a..21467d91a6bbdcdcf3166e95b4de12ed14e6c65f 100644 GIT binary patch literal 4526 zcmbtWTT>jz75*9)W*HW+HY^r0NU~&G3%jeauq-PeDZ*G6Y>;Fj;eeG$!|nhhEi-s# z7DR5&#g6S%rSj}lrE;mHoKzm{R1#1`R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_j&+m~xIBxXcAJfMt$i zYV;OIWGQ7HN3Ck)bEK(JfD*GNS0!EAXx~?gE;>)|qLnMGjxSirtGLUxHCmEj&cn6u zaE%qyw2AI7(N9w8dUlKJ?Hb~o@hj9v!;_M6O>x}fcZ(M8pwS#^Xc*a|yZ?_;OBE@O zxB1;-Fm}Le-KMHe-_gWaRa?W^U95auz1r!-i{tnF?qaJ}e|o6ByScSE5MIN%Ez)p@ zI6SJVJ-#Y-Qf=^$1}JlPv>{S^M>8U|ceJD-cA+ISMm6~!Qu@2>nqiaw9=@-d{SQ<> z{Bv8a^%cWbsG4H6NxmH={Gk;7DD0F~%^ybze-b71qJ(~wFp$D`!h_^3{4OiB2|rbC QB{_PJ^Y`gN=-LPW1O7)J%>V!Z delta 509 zcmZvY%}&BV6opSq`Dv@5Mo=OWj0?oHfQq7M{Q>b`H^zm!>WXLx3qiLoeSoff1UDvz zg^46SfDdDQ0AoBeB;dj{GxyHSJ>NaI&(mKKi9~M;D-lslM&5{^~k9!On z#-L*yIeAjK8^~jhQDi0tsGVmXU|e8i8!SrFiQ(J}QjBaM!P-egkVG6QWH2R(DcQy9 z5iKmCNQTMxD3-}tp*95N8yu@7JB9ha#^qc>X=0t(1~$pDS=nI}-6|anp1;B~%(C>5 zM3A>Lbeq92X6eS_XR}+D+Pw5q=qh_&DoE3TB4|_zFCr8EeB>0RKdtXC@xQ;VGn6T` q#Xqi4=`@MmzCaZ_P3-nBGk-3@UV9X&*q0NJFgxJ+kmcQ}kA4AL06KaA diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/ScoreDao.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/ScoreDao.class index 876b637e4a5d97d101ae6005b22433aac78fea1f..905e96b1f0ac55df070eeaec3977b5cc005eeb80 100644 GIT binary patch delta 170 zcmdnPbe);&)W2Q(7#J9A83ZPB&5q$qPb~>7O)aVnPR=h%EoNlU(eO#G%rDhX&PdIx zFfuaKFUZfz*9Xg5Yx-m*mL=+!mSpDW`(zfESTizs;88xYY`!@Y3nK$70~-S)13S=C dCI${5pOb+L&gTY-@qlG`8Tf!SNF_f50|1h4C^`TD delta 62 zcmcc4yoZVF)W2Q(7#J9A8F(jh&7N$)SfI|x!pOkNz{bGHzz&pPV&DK`PB4p$fg4DJ IWOx`D0G@0J761SM diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/impl/ScoreDaoImpl.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/impl/ScoreDaoImpl.class index 4fde319342e208c10a67904626619f67a106992a..f261df3d19323e6ecbf23e00f69b93fcde04a14b 100644 GIT binary patch delta 450 zcmZXP&q@MO7{$+b&8Bp$$g&#kkNwrrauK+Z7Hy(Hh;R|On`97048}2N)v70O-8&=| zVT&H1N9iG=b7v$1H*>!8&AGpO?vwF78~ghC_yll*qhV}G>N7|Q=9;d5)px!7TI1Gp zdvPpa)kG3&f^x3fcJ7=~$LTgpHQ#G>o0Wf?%bT{_@GJRn)%RPSQnl6dD+bapS-BQf z%nj~ojGLCA7&%DTEcZ!syD{u>I_sH5Il%0hGxPluvgwhjL7H|5SdENbv zFH!RR+#kS>?KK%VACcb9?&zwMKV(B30WI1x1mXsnbX2{3z8~w>!E1I2=@HXsqAisJ t5^|(9z*28j)B4}EfiJa=4~YN( diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Score.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Score.class index d74e5fa6171b3980ab39342ba6b91895a5971e73..01c2858644a23c0057f4667ec6aa21f0d5afc235 100644 GIT binary patch delta 301 zcmXBM%`OB%6b0Z@)m^%KdLkI34KXCdRH{jjh!BEF#7{_=h2^Zg0uLauwJXcn+m1-Z zD_GiCcm@lv;J7w7C*M8y{uJ-UXsGqA^&3&cU+VMM@#rz$dVtp!ZD z^?+&DiUVd{%LL57u%ofU*+$|&lf`4;;Qtb<=+OBC7Ii2|Q)saNXEP`eNt)v}mbAcR z*ev}=+Vq2TQZ4)Ytmz+8YdYLmKT1zjDOS&{sc2nV;rm&oHtG9jo3};`;hPc0#;=>fdBvi delta 293 zcmX>h{$6~;945xL$##r!lYcV_Z~o2H!@{|Ofr){gfq_A7@&tAXDPAo})~yT@T9RyA z8KgG?g_#&sfTR)w$K*Zi^8Shpsz9CxL<55wgF280)XJd2z{9`@W(hF}1NDH!#2CaG zn87T5pezfRB?V-$f?2Xa7TaVQ4lPEN$rm_8C&zGTuxbG1G$*g+5}&+)L!VIxC~nJY z02DI>i)nJ|Gn#7O)aVnPR=h%EoNlU z(eO#G%rDhX&PdIxFfuaKFUZfz*9Xg5PrUxXk+m44kdZ+Ow=zZs4?KoU?qFQO&CI~a zz{(&FBqb(WGf7)Y0$s<)zzigL8CZZUP6mDkDIiabfeA=*F-SAW0BI15n}G+Yi;+Q= zK?o=(F}a^fx*nvP4JgI{6a(o3sX*wG1G1SIWHPtb76x|hoeaWE t3>(185Jrh1Ie;7P0B!~a21TGz5JQ!KhA1-#g3MQ8Pz4$Qa)lZL0|3LVI8i+10w?~gD{X30ZO_tFaaS01DDoz z21YIItqklNfjlM#(aD0$!m46Gwira7L7YJX$OEcm;AY?f>Skn+WDo+%iA?rnmbMlJ n%CG^&7=U6RT_6=8wGdrWKsFPDG!V;xS+WdrKpLc8o`C@X`Q8zs diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/ScoreMapper.xml b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/ScoreMapper.xml index 820fd7d..840fe21 100644 --- a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/ScoreMapper.xml +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/ScoreMapper.xml @@ -11,7 +11,6 @@ WHERE invalid = 0; - @@ -25,5 +24,36 @@ + \ No newline at end of file diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreQueryResult.jsp b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreQueryResult.jsp new file mode 100644 index 0000000..887312e --- /dev/null +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreQueryResult.jsp @@ -0,0 +1,179 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + + + + + 成绩信息查询结果页 + + + + + + + + + + +
+ +
+ + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
成绩ID学号学生姓名课程ID课程名成绩
${score.scoreID}${score.student.id}${score.student.name}${score.course.courseID}${score.course.courseName}${score.score}
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + \ No newline at end of file diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreopv2.jsp b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreopv2.jsp index 79c44b9..bd04123 100644 --- a/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreopv2.jsp +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreopv2.jsp @@ -258,7 +258,7 @@
- +
diff --git a/project2/src/main/java/cyou/chenx221/controller/ScoreController.java b/project2/src/main/java/cyou/chenx221/controller/ScoreController.java index 5e24aea..44b8f67 100644 --- a/project2/src/main/java/cyou/chenx221/controller/ScoreController.java +++ b/project2/src/main/java/cyou/chenx221/controller/ScoreController.java @@ -50,42 +50,46 @@ public class ScoreController { return "scoreopv2"; } -// @PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")//学生信息查询(带条件) -// public String getQueryCourses(@RequestParam(value = "name", defaultValue = "null", required = false) String name,//学生姓名 -// @RequestParam(value = "coursename", defaultValue = "null", required = false) String course_name,//课程名 -// @RequestParam(value = "scoreid", defaultValue = "-1", required = false) int score_id,//成绩ID -// @RequestParam(value = "studentid", defaultValue = "-1", required = false) int student_id,//学号 -// @RequestParam(value = "courseid", defaultValue = "-1", required = false) int course_id,//课程ID -// @RequestParam(value = "min", required = false) int min,//最低分 -// @RequestParam(value = "max", required = false) int max,//最高分 -// @RequestParam(value = "range_enabler", defaultValue = "false", required = false) boolean range_enabler,//是否启用分数范围 -// Model model) { -// -// //username helper start -// String username = new UsernameHelper().getCurrentUsername(); -// if (username != null) { -// model.addAttribute("username", username); -// } -// //username helper end -// -// if (name.equals("null")) { -// name = null; -// } -// if (course_name.equals("null")) { -// course_name = null; -// } -// if (score_id == -1 && student_id == -1 && course_id == -1 && !range_enabler) { -// model.addAttribute("errorMessage", "查询条件不可全为空"); -// return "redirect:/score/infomodv2"; -// } -// List scores; -// Score score; -// -// score = new Score((score_id == -1? null:score_id), ((student_id==-1&&name==null)==null?null:(new Student(student_id,name))), null, null, min, max); -// course = new Course((id == -1 ? null : id), name, description); -//// System.out.println("id:" + id + " name:" + name + " description:" + description); + @PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")//学生信息查询(带条件) + public String getQueryCourses(@RequestParam(value = "name", defaultValue = "null", required = false) String name,//学生姓名 + @RequestParam(value = "coursename", defaultValue = "null", required = false) String course_name,//课程名 + @RequestParam(value = "scoreid", defaultValue = "-1", required = false) int score_id,//成绩ID + @RequestParam(value = "studentid", defaultValue = "-1", required = false) int student_id,//学号 + @RequestParam(value = "courseid", defaultValue = "-1", required = false) int course_id,//课程ID + @RequestParam(value = "min", defaultValue = "-1", required = false) int min,//最低分 + @RequestParam(value = "max", defaultValue = "-1", required = false) int max,//最高分 + @RequestParam(value = "range_enabler", defaultValue = "false", required = false) boolean range_enabler,//是否启用分数范围 + Model model) { + + //username helper start + String username = new UsernameHelper().getCurrentUsername(); + if (username != null) { + model.addAttribute("username", username); + } + //username helper end + + if (name.equals("null")) { + name = null; + } + if (course_name.equals("null")) { + course_name = null; + } +// System.out.println("name: " + name + " course_name: " + course_name + " score_id: " + score_id + " student_id: " + student_id + " course_id: " + course_id + " min: " + min + " max: " + max + " range_enabler: " + range_enabler); + if (score_id == -1 && student_id == -1 && course_id == -1 && !range_enabler && course_name == null && name == null) { + model.addAttribute("errorMessage", "查询条件不可全为空"); + return "redirect:/score/infomodv2"; + } + + List scores; + Score score; + + score = new Score((score_id == -1 ? null : score_id), ((student_id == -1 && name == null) ? null : (new Student((student_id == -1 ? null : student_id), name))), (course_id == -1 && course_name == null) ? null : (new Course((course_id == -1 ? null : course_id), course_name)), range_enabler ? (min == -1 ? null : min) : null, range_enabler ? (max == -1 ? null : max) : null); + + scores = scoreService.getQueryScores(score); + //TODO: query result download(csv) // courses = courseService.getQueryCourses(course); -// model.addAttribute("courses", courses); -// return "courseQueryResult"; -// } +// model.addAttribute("score", score); + model.addAttribute("scores", scores); + return "scoreQueryResult"; + } } diff --git a/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java b/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java index 25ee739..563e492 100644 --- a/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java +++ b/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java @@ -8,4 +8,6 @@ import java.util.List; @Repository public interface ScoreDao { List getAllScore(); + + List getQueryScores(Score score); } diff --git a/project2/src/main/java/cyou/chenx221/mapper/impl/ScoreDaoImpl.java b/project2/src/main/java/cyou/chenx221/mapper/impl/ScoreDaoImpl.java index c51f4e6..ac44ab7 100644 --- a/project2/src/main/java/cyou/chenx221/mapper/impl/ScoreDaoImpl.java +++ b/project2/src/main/java/cyou/chenx221/mapper/impl/ScoreDaoImpl.java @@ -13,7 +13,7 @@ public class ScoreDaoImpl implements ScoreDao { private SqlSession sqlSession; @Autowired - public ScoreDaoImpl(SqlSession sqlSession){ + public ScoreDaoImpl(SqlSession sqlSession) { this.sqlSession = sqlSession; } @@ -21,4 +21,9 @@ public class ScoreDaoImpl implements ScoreDao { public List getAllScore() { return sqlSession.selectList("getAllScore"); } + + @Override + public List getQueryScores(Score score) { + return sqlSession.selectList("getQueryScores", score); + } } diff --git a/project2/src/main/java/cyou/chenx221/pojo/Score.java b/project2/src/main/java/cyou/chenx221/pojo/Score.java index 5637bb6..837b881 100644 --- a/project2/src/main/java/cyou/chenx221/pojo/Score.java +++ b/project2/src/main/java/cyou/chenx221/pojo/Score.java @@ -23,11 +23,10 @@ public class Score { this.score = score; } - public Score(Integer scoreID, Student student, Course course, Integer score, Integer min, Integer max) { + public Score(Integer scoreID, Student student, Course course, Integer min, Integer max) { ScoreID = scoreID; this.student = student; this.course = course; - this.score = score; this.min = min; this.max = max; } diff --git a/project2/src/main/java/cyou/chenx221/service/ScoreService.java b/project2/src/main/java/cyou/chenx221/service/ScoreService.java index f1292a5..bf4e9ef 100644 --- a/project2/src/main/java/cyou/chenx221/service/ScoreService.java +++ b/project2/src/main/java/cyou/chenx221/service/ScoreService.java @@ -17,4 +17,8 @@ public class ScoreService { public List getAllScores() { return scoreDao.getAllScore(); } + + public List getQueryScores(Score score) { + return scoreDao.getQueryScores(score); + } } diff --git a/project2/src/main/resources/mapper/ScoreMapper.xml b/project2/src/main/resources/mapper/ScoreMapper.xml index 820fd7d..840fe21 100644 --- a/project2/src/main/resources/mapper/ScoreMapper.xml +++ b/project2/src/main/resources/mapper/ScoreMapper.xml @@ -11,7 +11,6 @@ WHERE invalid = 0; - @@ -25,5 +24,36 @@ + \ No newline at end of file diff --git a/project2/web/WEB-INF/views/scoreQueryResult.jsp b/project2/web/WEB-INF/views/scoreQueryResult.jsp new file mode 100644 index 0000000..887312e --- /dev/null +++ b/project2/web/WEB-INF/views/scoreQueryResult.jsp @@ -0,0 +1,179 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + + + + + 成绩信息查询结果页 + + + + + + + + + + +
+ +
+ + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
成绩ID学号学生姓名课程ID课程名成绩
${score.scoreID}${score.student.id}${score.student.name}${score.course.courseID}${score.course.courseName}${score.score}
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + \ No newline at end of file diff --git a/project2/web/WEB-INF/views/scoreopv2.jsp b/project2/web/WEB-INF/views/scoreopv2.jsp index 79c44b9..bd04123 100644 --- a/project2/web/WEB-INF/views/scoreopv2.jsp +++ b/project2/web/WEB-INF/views/scoreopv2.jsp @@ -258,7 +258,7 @@
- +