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 6687b95..21467d9 100644
Binary files a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/controller/ScoreController.class and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/controller/ScoreController.class differ
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 876b637..905e96b 100644
Binary files a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/ScoreDao.class and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/ScoreDao.class differ
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 4fde319..f261df3 100644
Binary files a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/impl/ScoreDaoImpl.class and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/impl/ScoreDaoImpl.class differ
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 d74e5fa..01c2858 100644
Binary files a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Score.class and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Score.class differ
diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/service/ScoreService.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/service/ScoreService.class
index 6d20c44..343d848 100644
Binary files a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/service/ScoreService.class and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/service/ScoreService.class differ
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 @@