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 new file mode 100644 index 0000000..1bf4183 Binary files /dev/null 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 new file mode 100644 index 0000000..876b637 Binary files /dev/null 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 new file mode 100644 index 0000000..4fde319 Binary files /dev/null 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/Course.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Course.class index 143d5bc..87d2d8c 100644 Binary files a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Course.class and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Course.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 490e111..e48a648 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/pojo/Student.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Student.class index 2f19b15..6b64f97 100644 Binary files a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Student.class and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Student.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 new file mode 100644 index 0000000..6d20c44 Binary files /dev/null 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 new file mode 100644 index 0000000..820fd7d --- /dev/null +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/ScoreMapper.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mybatis-config.xml b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mybatis-config.xml index fa3bc53..400caaf 100644 --- a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mybatis-config.xml +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mybatis-config.xml @@ -13,6 +13,7 @@ + diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/views/dashboard.jsp b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/dashboard.jsp index f5d011a..014f011 100644 --- a/project2/out/artifacts/project2_war_exploded/WEB-INF/views/dashboard.jsp +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/dashboard.jsp @@ -48,9 +48,9 @@
  • +
  • 成绩查看
  • 成绩管理
  • 学生成绩管理
  • -
  • 学生成绩管理
  • diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreList.jsp b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreList.jsp new file mode 100644 index 0000000..7987f95 --- /dev/null +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/scoreList.jsp @@ -0,0 +1,175 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + + + + + 成绩信息查看 + + + + + + + + + + +
    + +
    + + + + +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    成绩ID学号课程名成绩
    ${score.scoreID}${score.student.id}${score.course.courseName}${score.score}
    +
    +
    +
    +
    +
    + + + + +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/project2/src/main/java/cyou/chenx221/controller/ScoreController.java b/project2/src/main/java/cyou/chenx221/controller/ScoreController.java index 77c9908..30b8e17 100644 --- a/project2/src/main/java/cyou/chenx221/controller/ScoreController.java +++ b/project2/src/main/java/cyou/chenx221/controller/ScoreController.java @@ -1,8 +1,11 @@ package cyou.chenx221.controller; +import cyou.chenx221.helper.UsernameHelper; import cyou.chenx221.service.ScoreService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller @@ -14,4 +17,14 @@ public class ScoreController { public ScoreController(ScoreService scoreService) { this.scoreService = scoreService; } + + @GetMapping("/all") + public String getAllScore(Model model){ + String username = new UsernameHelper().getCurrentUsername(); + if (username != null) { + model.addAttribute("username", username); + } + model.addAttribute("scores", scoreService.getAllScores()); + return "scoreList"; + } } diff --git a/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java b/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java index 86fb118..25ee739 100644 --- a/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java +++ b/project2/src/main/java/cyou/chenx221/mapper/ScoreDao.java @@ -1,7 +1,11 @@ package cyou.chenx221.mapper; +import cyou.chenx221.pojo.Score; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface ScoreDao { + List getAllScore(); } 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 13f242b..c51f4e6 100644 --- a/project2/src/main/java/cyou/chenx221/mapper/impl/ScoreDaoImpl.java +++ b/project2/src/main/java/cyou/chenx221/mapper/impl/ScoreDaoImpl.java @@ -1,11 +1,24 @@ package cyou.chenx221.mapper.impl; import cyou.chenx221.mapper.ScoreDao; +import cyou.chenx221.pojo.Score; import org.apache.ibatis.session.SqlSession; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public class ScoreDaoImpl implements ScoreDao { private SqlSession sqlSession; + @Autowired + public ScoreDaoImpl(SqlSession sqlSession){ + this.sqlSession = sqlSession; + } + + @Override + public List getAllScore() { + return sqlSession.selectList("getAllScore"); + } } diff --git a/project2/src/main/java/cyou/chenx221/pojo/Course.java b/project2/src/main/java/cyou/chenx221/pojo/Course.java index ad3b6b3..707ad16 100644 --- a/project2/src/main/java/cyou/chenx221/pojo/Course.java +++ b/project2/src/main/java/cyou/chenx221/pojo/Course.java @@ -10,12 +10,21 @@ public class Course { Description = description; } + public Course(Integer courseID, String courseName) { + CourseID = courseID; + CourseName = courseName; + } + public Course(Integer courseID, String courseName, String description) { CourseID = courseID; CourseName = courseName; Description = description; } + public Course(Integer courseID) { + CourseID = courseID; + } + public Course() { } diff --git a/project2/src/main/java/cyou/chenx221/pojo/Score.java b/project2/src/main/java/cyou/chenx221/pojo/Score.java index 32fffe0..4950975 100644 --- a/project2/src/main/java/cyou/chenx221/pojo/Score.java +++ b/project2/src/main/java/cyou/chenx221/pojo/Score.java @@ -6,6 +6,14 @@ public class Score { private Course course; //。。。 private Integer score; //成绩 + public Score(Integer scoreID, Integer score) { + ScoreID = scoreID; + this.score = score; + } + + public Score() { + } + public Score(Integer scoreID, Student student, Course course, Integer score) { ScoreID = scoreID; this.student = student; diff --git a/project2/src/main/java/cyou/chenx221/pojo/Student.java b/project2/src/main/java/cyou/chenx221/pojo/Student.java index 32781e7..d5134c0 100644 --- a/project2/src/main/java/cyou/chenx221/pojo/Student.java +++ b/project2/src/main/java/cyou/chenx221/pojo/Student.java @@ -18,7 +18,7 @@ public class Student { private int removed; - public Student(int id) { + public Student(Integer id) { this.id = id; } @@ -102,6 +102,11 @@ public class Student { public Student() { } + public Student(Integer id, String name) { + this.id = id; + this.name = name; + } + public String getClasses() { return classes; } diff --git a/project2/src/main/java/cyou/chenx221/service/ScoreService.java b/project2/src/main/java/cyou/chenx221/service/ScoreService.java index c432d71..f1292a5 100644 --- a/project2/src/main/java/cyou/chenx221/service/ScoreService.java +++ b/project2/src/main/java/cyou/chenx221/service/ScoreService.java @@ -1,8 +1,11 @@ package cyou.chenx221.service; import cyou.chenx221.mapper.ScoreDao; +import cyou.chenx221.pojo.Score; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class ScoreService { private ScoreDao scoreDao; @@ -10,4 +13,8 @@ public class ScoreService { public ScoreService(ScoreDao scoreDao) { this.scoreDao = scoreDao; } + + public List getAllScores() { + return scoreDao.getAllScore(); + } } diff --git a/project2/src/main/resources/mapper/ScoreMapper.xml b/project2/src/main/resources/mapper/ScoreMapper.xml index 2ffba4b..820fd7d 100644 --- a/project2/src/main/resources/mapper/ScoreMapper.xml +++ b/project2/src/main/resources/mapper/ScoreMapper.xml @@ -2,6 +2,28 @@ - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project2/src/main/resources/mybatis-config.xml b/project2/src/main/resources/mybatis-config.xml index fa3bc53..400caaf 100644 --- a/project2/src/main/resources/mybatis-config.xml +++ b/project2/src/main/resources/mybatis-config.xml @@ -13,6 +13,7 @@ + diff --git a/project2/web/WEB-INF/views/dashboard.jsp b/project2/web/WEB-INF/views/dashboard.jsp index f5d011a..014f011 100644 --- a/project2/web/WEB-INF/views/dashboard.jsp +++ b/project2/web/WEB-INF/views/dashboard.jsp @@ -48,9 +48,9 @@
  • +
  • 成绩查看
  • 成绩管理
  • 学生成绩管理
  • -
  • 学生成绩管理
  • diff --git a/project2/web/WEB-INF/views/scoreList.jsp b/project2/web/WEB-INF/views/scoreList.jsp new file mode 100644 index 0000000..7987f95 --- /dev/null +++ b/project2/web/WEB-INF/views/scoreList.jsp @@ -0,0 +1,175 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + + + + + 成绩信息查看 + + + + + + + + + + +
    + +
    + + + + +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    成绩ID学号课程名成绩
    ${score.scoreID}${score.student.id}${score.course.courseName}${score.score}
    +
    +
    +
    +
    +
    + + + + +
    +
    + + + + + + + + + \ No newline at end of file