diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/controller/TeacherController.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/controller/TeacherController.class new file mode 100644 index 0000000..e683420 Binary files /dev/null and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/controller/TeacherController.class differ diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/TeacherDao.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/TeacherDao.class new file mode 100644 index 0000000..4d3387b Binary files /dev/null and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/TeacherDao.class differ diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/impl/TeacherDaoImpl.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/impl/TeacherDaoImpl.class new file mode 100644 index 0000000..dc62e88 Binary files /dev/null and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/mapper/impl/TeacherDaoImpl.class differ diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Teacher.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Teacher.class new file mode 100644 index 0000000..4150b7d Binary files /dev/null and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/pojo/Teacher.class differ diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/service/TeacherService.class b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/service/TeacherService.class new file mode 100644 index 0000000..7e9f4f4 Binary files /dev/null and b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/cyou/chenx221/service/TeacherService.class differ diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/TeacherMapper.xml b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/TeacherMapper.xml new file mode 100644 index 0000000..e18e331 --- /dev/null +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/classes/mapper/TeacherMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ 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 400caaf..6f46284 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 @@ -14,6 +14,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 3a1ace2..ccacae7 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 @@ -57,7 +57,7 @@ 教师管理 diff --git a/project2/out/artifacts/project2_war_exploded/WEB-INF/views/teachermanage.jsp b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/teachermanage.jsp new file mode 100644 index 0000000..7eff1e2 --- /dev/null +++ b/project2/out/artifacts/project2_war_exploded/WEB-INF/views/teachermanage.jsp @@ -0,0 +1,507 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + + + + + 教师信息管理 + + + + + + + + + + + +
+ +
+ + + + +
+
+
+
+ +
+ + + + + + + + + + +<%-- --%> + + + + + + + + + + + + +<%-- --%> + + + +
教师ID姓名性别出生日期授课课程ID授课课程名授课班级操作
${teacher.id}${teacher.name}${teacher.sex}${teacher.birthday}${teacher.course.courseID}${teacher.course.courseName}${teacher.classes}--%> +<%--
--%> +<%-- --%> +<%-- --%> +<%-- --%> +<%-- --%> +<%-- --%> +<%-- --%> +<%-- --%> +<%-- --%> +<%-- --%> +<%--
--%> +<%--
+
+
+
+ + + +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+ + + + + + +
+ + +
+
+ + + + + + \ No newline at end of file diff --git a/project2/src/main/java/cyou/chenx221/controller/TeacherController.java b/project2/src/main/java/cyou/chenx221/controller/TeacherController.java new file mode 100644 index 0000000..0964f00 --- /dev/null +++ b/project2/src/main/java/cyou/chenx221/controller/TeacherController.java @@ -0,0 +1,34 @@ +package cyou.chenx221.controller; + +import cyou.chenx221.helper.UsernameHelper; +import cyou.chenx221.pojo.Teacher; +import cyou.chenx221.service.TeacherService; +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; + +import java.util.List; + +@Controller +@RequestMapping("/teacher") +public class TeacherController { + private final TeacherService teacherService; + + @Autowired + public TeacherController(TeacherService teacherService) { + this.teacherService = teacherService; + } + + @GetMapping("/manage") + public String manageTeacherInfo(Model model) { + String username = new UsernameHelper().getCurrentUsername(); + if (username != null) { + model.addAttribute("username", username); + } + List teacherList = teacherService.getAllTeachers(); + model.addAttribute("teacherList", teacherList); + return "teachermanage"; + } +} diff --git a/project2/src/main/java/cyou/chenx221/mapper/TeacherDao.java b/project2/src/main/java/cyou/chenx221/mapper/TeacherDao.java new file mode 100644 index 0000000..e0dc850 --- /dev/null +++ b/project2/src/main/java/cyou/chenx221/mapper/TeacherDao.java @@ -0,0 +1,11 @@ +package cyou.chenx221.mapper; + +import cyou.chenx221.pojo.Teacher; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface TeacherDao { + List getAllTeachers(); +} diff --git a/project2/src/main/java/cyou/chenx221/mapper/impl/TeacherDaoImpl.java b/project2/src/main/java/cyou/chenx221/mapper/impl/TeacherDaoImpl.java new file mode 100644 index 0000000..12f8a7b --- /dev/null +++ b/project2/src/main/java/cyou/chenx221/mapper/impl/TeacherDaoImpl.java @@ -0,0 +1,24 @@ +package cyou.chenx221.mapper.impl; + +import cyou.chenx221.mapper.TeacherDao; +import cyou.chenx221.pojo.Teacher; +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 TeacherDaoImpl implements TeacherDao { + private SqlSession sqlSession; + + @Autowired + public TeacherDaoImpl(SqlSession sqlSession) { + this.sqlSession = sqlSession; + } + + @Override + public List getAllTeachers() { + return sqlSession.selectList("getAllTeachers"); + } +} diff --git a/project2/src/main/java/cyou/chenx221/pojo/Teacher.java b/project2/src/main/java/cyou/chenx221/pojo/Teacher.java new file mode 100644 index 0000000..d3d85cc --- /dev/null +++ b/project2/src/main/java/cyou/chenx221/pojo/Teacher.java @@ -0,0 +1,114 @@ +package cyou.chenx221.pojo; + +import java.sql.Date; + +public class Teacher { + private Integer id;//教师id (主键) + private String name;//教师名称 + private String sex;//性别 + private Date birthday;//出生日期 + // private Integer course_id;//课程id +// private String course_name;//课程名称//*需要额外处理 + private Course course;//课程 + private String classes;//班级(目前仅单个班级) + private Integer removed;//移除标志 + + @Override + public String toString() { + return "Teacher{" + + "id=" + id + + ", name='" + name + '\'' + + ", sex='" + sex + '\'' + + ", birthday=" + birthday + + ", course=" + course + + ", classes='" + classes + '\'' + + ", removed=" + removed + + '}'; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public Date getBirthday() { + return birthday; + } + + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + public Course getCourse() { + return course; + } + + public void setCourse(Course course) { + this.course = course; + } + + public String getClasses() { + return classes; + } + + public void setClasses(String classes) { + this.classes = classes; + } + + public Integer getRemoved() { + return removed; + } + + public void setRemoved(Integer removed) { + this.removed = removed; + } + + public Teacher(String name, String sex, Date birthday, Course course, String classes) { + this.name = name; + this.sex = sex; + this.birthday = birthday; + this.course = course; + this.classes = classes; + } + + public Teacher(Integer id, String classes) { + this.id = id; + this.classes = classes; + } + + public Teacher(Integer id) { + this.id = id; + } + + public Teacher(Integer id, String name, String sex, Date birthday, Course course, String classes, Integer removed) { + this.id = id; + this.name = name; + this.sex = sex; + this.birthday = birthday; + this.course = course; + this.classes = classes; + this.removed = removed; + } + + public Teacher() { + } +} diff --git a/project2/src/main/java/cyou/chenx221/service/TeacherService.java b/project2/src/main/java/cyou/chenx221/service/TeacherService.java new file mode 100644 index 0000000..f8ecf42 --- /dev/null +++ b/project2/src/main/java/cyou/chenx221/service/TeacherService.java @@ -0,0 +1,20 @@ +package cyou.chenx221.service; + +import cyou.chenx221.mapper.TeacherDao; +import cyou.chenx221.pojo.Teacher; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class TeacherService { + private TeacherDao teacherDao; + + public TeacherService(TeacherDao teacherDao) { + this.teacherDao = teacherDao; + } + + public List getAllTeachers() { + return teacherDao.getAllTeachers(); + } +} diff --git a/project2/src/main/resources/mapper/TeacherMapper.xml b/project2/src/main/resources/mapper/TeacherMapper.xml new file mode 100644 index 0000000..e18e331 --- /dev/null +++ b/project2/src/main/resources/mapper/TeacherMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ 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 400caaf..6f46284 100644 --- a/project2/src/main/resources/mybatis-config.xml +++ b/project2/src/main/resources/mybatis-config.xml @@ -14,6 +14,7 @@ + diff --git a/project2/web/WEB-INF/views/dashboard.jsp b/project2/web/WEB-INF/views/dashboard.jsp index 3a1ace2..ccacae7 100644 --- a/project2/web/WEB-INF/views/dashboard.jsp +++ b/project2/web/WEB-INF/views/dashboard.jsp @@ -57,7 +57,7 @@ 教师管理 diff --git a/project2/web/WEB-INF/views/teachermanage.jsp b/project2/web/WEB-INF/views/teachermanage.jsp new file mode 100644 index 0000000..d0c5be6 --- /dev/null +++ b/project2/web/WEB-INF/views/teachermanage.jsp @@ -0,0 +1,644 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> + + + + + + + + 教师信息管理 + + + + + + + + + + + +
+ +
+ + + + +
+
+
+
+ +
+ + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + <%-- --%> + + + +
教师ID姓名性别出生日期授课课程ID授课课程名授课班级操作
${teacher.id}${teacher.name}${teacher.sex}${teacher.birthday}${teacher.course.courseID}${teacher.course.courseName}${teacher.classes}--%> + <%--
--%> + <%-- --%> + <%-- --%> + <%-- --%> + <%-- --%> + <%-- --%> + <%-- --%> + <%-- --%> + <%-- --%> + <%-- --%> + <%--
--%> + <%--
+
+
+
+ + + +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ + +
+
+
+
+
+ + + + + + +
+ + +
+
+ + + + + + \ No newline at end of file