Signed-off-by: Chenx221 <chenx221@yandex.com>
This commit is contained in:
Chenx221 2023-06-18 12:05:44 +08:00
parent d3aea486af
commit 285e5fa17b
38 changed files with 2018 additions and 31 deletions

View File

@ -70,5 +70,9 @@
VALUES (#{name}, #{birthday}, #{sex}, #{phone}, #{classes}) VALUES (#{name}, #{birthday}, #{sex}, #{phone}, #{classes})
</insert> </insert>
<select id="getAllStudentsT" parameterType="String" resultType="cyou.chenx221.pojo.Student">
SELECT *
FROM student
WHERE removed = 0 AND classes = #{classes}
</select>
</mapper> </mapper>

View File

@ -88,4 +88,9 @@
VALUES (#{name}, #{sex}, #{birthday}, #{course.CourseID}, #{classes}) VALUES (#{name}, #{sex}, #{birthday}, #{course.CourseID}, #{classes})
</insert> </insert>
<select id="getClassesById" parameterType="int" resultType="String">
SELECT classes
FROM teacher
WHERE id = #{id};
</select>
</mapper> </mapper>

View File

@ -40,4 +40,9 @@
SET disabled = 0 SET disabled = 0
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="getDetailByUsername" parameterType="String" resultType="int">
SELECT detail
FROM user
WHERE username = #{username}
</select>
</mapper> </mapper>

View File

@ -23,12 +23,12 @@
<security:intercept-url pattern="/dashboard" access="hasRole('admin')"/> <security:intercept-url pattern="/dashboard" access="hasRole('admin')"/>
<security:intercept-url pattern="/dashboard-t" access="hasRole('teacher')"/> <security:intercept-url pattern="/dashboard-t" access="hasRole('teacher')"/>
<security:intercept-url pattern="/dashboard-s" access="hasRole('student')"/> <security:intercept-url pattern="/dashboard-s" access="hasRole('student')"/>
<security:intercept-url pattern="/student/**" access="hasRole('admin')"/> <security:intercept-url pattern="/student/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/course/**" access="hasRole('admin')"/> <security:intercept-url pattern="/course/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/score/**" access="hasRole('admin')"/> <security:intercept-url pattern="/score/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/output/**" access="hasRole('admin')"/> <security:intercept-url pattern="/output/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/system/**" access="hasRole('admin')"/> <security:intercept-url pattern="/system/**" access="hasRole('admin')"/>
<security:intercept-url pattern="/user/**" access="hasRole('admin')"/> <security:intercept-url pattern="/user/**" access="hasAnyRole('admin','teacher')"/>
<!-- 未登录状态下会自动跳转到/login登录页--> <!-- 未登录状态下会自动跳转到/login登录页-->
<security:form-login login-page="/login" <security:form-login login-page="/login"
default-target-url="/dashboard" default-target-url="/dashboard"

View File

@ -40,10 +40,9 @@
学生管理 学生管理
</a> </a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1"> <ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="/student/all">学生信息显示</a></li> <li><a class="dropdown-item" href="/student/all_t">学生信息显示</a></li>
<li><a class="dropdown-item" href="/student/queryinfo">学生信息查询</a></li> <li><a class="dropdown-item" href="/student/queryinfo_t">学生信息查询</a></li>
<li><a class="dropdown-item" href="/student/modstep1">学生信息修改(旧)</a></li> <li><a class="dropdown-item" href="/student/infomodv2_t">学生信息修改</a></li>
<li><a class="dropdown-item" href="/student/infomodv2">学生信息修改</a></li>
<li> <li>
<hr class="dropdown-divider" /> <hr class="dropdown-divider" />
</li> </li>

View File

@ -133,7 +133,10 @@
<div> <div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard'">返回 <button type="button" class="btn btn-primary" onclick="function goBack() {
window.history.back(); //返回上一页
}
goBack()">返回
</button> </button>
</div> </div>
</div> </div>

View File

@ -0,0 +1,279 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<title>学生信息查询</title>
<script src="${pageContext.request.contextPath}/resources/js/jquery-3.7.0.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css"/>
<style>
.table-container {
min-width: 80vw;
min-height: 80vh;
align-items: center;
justify-content: center;
}
.table-container table {
width: 100%;
height: 100%;
}
</style>
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="#">学生信息查询</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">用户管理</a></li>
<li><a class="dropdown-item" href="#">日志管理</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center">
<button type="button" class="btn btn-primary" onclick="function goBack() {
window.history.back(); //返回上一页
}
goBack()">返回
</button>
<div class="card">
<div class="card-body p-4 p-md-5">
<h3 class="mb-2 pb-2">数据查询</h3>
<!-- Button triggers collapse -->
<a
class="btn btn-primary mb-3"
data-mdb-toggle="collapse"
href="#collapseWithScrollbar"
role="button"
aria-expanded="false"
aria-controls="collapseExample"
>
<i class="fas fa-circle-question"></i>
帮助信息
</a>
<!-- Collapsed content -->
<div class="collapse scroll-section" id="collapseWithScrollbar" style="max-width: 500px">
<div class="note note-primary mb-3">
<strong>提示:</strong> 这里的查询分成两类,班级查询与其他信息查询独立
</div>
</div>
<form action="query" method="post">
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="text" id="firstName" class="form-control" name="name"/>
<label class="form-label" for="firstName">名字</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="date" class="form-control" id="birthdayDate" name="birthday"/>
<label for="birthdayDate" class="form-label">出生日期</label>
</div>
</div>
<div class="col-md-6 mb-4">
<h6 class="mb-2 pb-1">性别: </h6>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions"
id="femaleGender" value="女"/>
<label class="form-check-label" for="femaleGender">女</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions"
id="maleGender" value="男"/>
<label class="form-check-label" for="maleGender">男</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="number" id="id" class="form-control" name="student-id"/>
<label class="form-label" for="id">学号</label>
</div>
</div>
<%-- Pending 改造 拖条↑--%>
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="text" id="phoneNumber" class="form-control" name="phone"/>
<label class="form-label" for="phoneNumber">联系方式</label>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<%-- <h6 class="mb-3">班级</h6>--%>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox1"
name="classes"
value="1班"/>
<label class="form-check-label" for="inlineCheckbox1">1班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox2"
name="classes"
value="2班"/>
<label class="form-check-label" for="inlineCheckbox2">2班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox3"
name="classes"
value="3班"/>
<label class="form-check-label" for="inlineCheckbox3">3班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox4"
name="classes"
value="4班"/>
<label class="form-check-label" for="inlineCheckbox4">4班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox5"
name="classes"
value="5班"/>
<label class="form-check-label" for="inlineCheckbox5">5班</label>
</div>
<div class="mt-4">
<input class="btn btn-warning btn-lg" type="submit" value="提交"/>
<%-- <button type="reset" class="btn btn-secondary">重置</button>--%>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
<script>
$(document).ready(function() {
// 获取上级传入的classes属性值
var classes = "${classes}";
// 检查classes是否是单个班级
if (classes.includes("班")) {
// 根据classes的值构建对应的复选框id
var checkboxId = "#inlineCheckbox" + classes.charAt(0);
// 根据id勾选复选框
$(checkboxId).prop('checked', true);
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,202 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<title>学生信息查看</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css"/>
<style>
.table-container {
min-width: 80vw; /* 设置最小宽度为视窗宽度的80% */
min-height: 80vh; /* 设置最小高度为视窗高度的80% */
/*display: flex;*/
align-items: center;
justify-content: center;
}
.table-container table {
width: 100%;
height: 100%;
}
</style>
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="#">学生信息查询</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">用户管理</a></li>
<li><a class="dropdown-item" href="#">日志管理</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center">
<div>
<div class="row">
<div class="col-12">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard-t'">返回
</button>
</div>
</div>
<div class="row">
<div class="col-12">
<button type="button" class="btn btn-primary" onclick="exportCSV('${classes}')">导出</button>
</div>
</div>
</div>
<div class="table-container rounded-4 shadow-3-strong"
style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px;">
<table class="table table-striped table-hover border-primary">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">姓名</th>
<th scope="col">性别</th>
<th scope="col">出生日期</th>
<th scope="col">联系方式</th>
<th scope="col">班级</th>
</tr>
</thead>
<tbody>
<c:forEach var="student" items="${students}">
<tr>
<td>${student.id}</td>
<td>${student.name}</td>
<td>${student.sex}</td>
<td>${student.birthday}</td>
<td>${student.phone}</td>
<td>${student.classes}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
<script>
function exportCSV(classes) {
// 构造请求 URL根据需要导出的类型传递参数
var exportUrl = '/output/export-csv?type=student&classes='+classes; // 示例:导出学生数据
var link = document.createElement('a');
link.href = exportUrl;
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
</body>
</html>

View File

@ -130,7 +130,11 @@
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;"> style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);"> <div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center"> <div class="container d-flex justify-content-center">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard'">返回</button> <button type="button" class="btn btn-primary" onclick="function goBack() {
window.history.back(); //返回上一页
}
goBack()">返回
</button>
<div class="table-container rounded-4 shadow-3-strong" <div class="table-container rounded-4 shadow-3-strong"
style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px;"> style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px;">
<table class="table table-striped table-hover border-primary"> <table class="table table-striped table-hover border-primary">

View File

@ -0,0 +1,437 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<title>学生信息修改v2</title>
<script src="${pageContext.request.contextPath}/resources/js/jquery-3.7.0.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css"/>
<style>
.table-container {
min-width: 60vw;
/* 设置最小宽度为视窗宽度的80% */
min-height: 80vh;
/* 设置最小高度为视窗高度的80% */
/*display: flex;*/
align-items: center;
justify-content: center;
}
.table-container table {
width: 100%;
height: 100%;
}
</style>
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="#">学生信息查询</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">用户管理</a></li>
<li><a class="dropdown-item" href="#">日志管理</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard'">返回</button>
<div class="table-container rounded-4 shadow-3-strong"
style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px">
<table class="table table-striped table-hover border-primary">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">姓名</th>
<th scope="col">性别</th>
<th scope="col">出生日期</th>
<th scope="col">联系方式</th>
<th scope="col">班级</th>
</tr>
</thead>
<tbody>
<c:forEach var="student" items="${students}">
<tr>
<td>${student.id}</td>
<td>${student.name}</td>
<td>${student.sex}</td>
<td>${student.birthday}</td>
<td>${student.phone}</td>
<td>${student.classes}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div class="container">
<div class="card rounded-4 shadow-3-strong" style="min-width: 244px">
<!-- Tabs navs -->
<ul class="nav nav-tabs" id="ex1" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active fs-6" id="ex1-tab-1" data-mdb-toggle="tab" href="#ex1-tabs-1"
role="tab" aria-controls="ex1-tabs-1" aria-selected="true">信息修改</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link fs-6" id="ex1-tab-2" data-mdb-toggle="tab" href="#ex1-tabs-2"
role="tab" aria-controls="ex1-tabs-2" aria-selected="false">信息删除</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link fs-6" id="ex1-tab-3" data-mdb-toggle="tab" href="#ex1-tabs-3"
role="tab" aria-controls="ex1-tabs-3" aria-selected="false">信息添加</a>
</li>
</ul>
<!-- Tabs navs -->
<hr class="hr" style="margin: 1px"/>
<!-- Tabs content -->
<div class="tab-content" id="ex1-content">
<div class="tab-pane fade show active" id="ex1-tabs-1" role="tabpanel"
aria-labelledby="ex1-tab-1">
<div class="card-body" style="min-width: 175px">
<form action="modinfo" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText1" class="form-control"
required name="id"/>
<label class="form-label" for="typeText1">ID (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText2" class="form-control"
name="name"/>
<label class="form-label" for="typeText2">姓名</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText3" class="form-control"
name="sex"/>
<label class="form-label" for="typeText3">性别 (男/女)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText4" class="form-control"
name="birthday"/>
<label class="form-label" for="typeText4">出生日期</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText5" class="form-control"
name="phone"/>
<label class="form-label" for="typeText5">联系方式</label>
</div>
</div>
</div>
<div class="row mb-2" style="display: none">
<div class="col-12">
<div class="form-outline">
<input type="text" id="hidden_del_clas" class="form-control"
required name="cla" value="${classes}"/>
<label class="form-label" for="hidden_del_clas">班级</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary"
data-mdb-toggle="tooltip" data-mdb-placement="top"
title="留空为不做修改">更改
</button>
</div>
<div class="col-lg-6 text-center">
<button type="reset" class="btn btn-secondary">重置</button>
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane fade" id="ex1-tabs-2" role="tabpanel" aria-labelledby="ex1-tab-2">
<div class="card-body" style="min-width: 175px">
<form action="delinfoT" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText7" class="form-control"
required name="id"/>
<label class="form-label" for="typeText7">ID (必填)</label>
</div>
</div>
</div>
<div class="row mb-2" style="display: none">
<div class="col-12">
<div class="form-outline">
<input type="text" id="hidden_del_class" class="form-control"
required name="cla" value="${classes}"/>
<label class="form-label" for="hidden_del_class">班级</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary">删除</button>
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane fade" id="ex1-tabs-3" role="tabpanel" aria-labelledby="ex1-tab-3">
<!-- <h5 class="card-header">信息添加</h5> -->
<div class="card-body" style="min-width: 175px">
<form action="addinfo" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText9" class="form-control"
name="name"/>
<label class="form-label" for="typeText9">姓名 (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText10" class="form-control"
name="sex"/>
<label class="form-label" for="typeText10">性别 (必填)
(男/女)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText11" class="form-control"
name="birthday"/>
<label class="form-label" for="typeText11">出生日期 (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText12" class="form-control"
name="phone"/>
<label class="form-label" for="typeText12">联系方式 (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText13" class="form-control"
name="classes" readonly value="${classes}"/>
<label class="form-label" for="typeText13">班级 (只读)</label>
</div>
</div>
</div>
<div class="row mb-2" style="display: none">
<div class="col-12">
<div class="form-outline">
<input type="text" id="spec_1" class="form-control"
name="spec" value="ok"/>
<label class="form-label" for="spec_1">隐藏的属性</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary"
data-mdb-toggle="tooltip" data-mdb-placement="top"
title="留空为不做修改">添加
</button>
</div>
<div class="col-lg-6 text-center">
<button type="reset" class="btn btn-secondary">重置</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Tabs content -->
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
<i class="fas fa-circle-exclamation me-2"></i>错误
</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<c:if test="${not empty errorMessage}">
${errorMessage}
</c:if>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-mdb-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal2" tabindex="-1" aria-labelledby="exampleModalLabel2"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel2">
<i class="fas fa-circle-check me-2"></i>成功
</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<c:if test="${not empty successMessage}">
${successMessage}
</c:if>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-mdb-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
<script>
$(document).ready(function () {
// 判断模型中是否存在错误信息
<c:if test="${not empty errorMessage && errorMessage ne 'null'}">
$('#exampleModal').modal('show');
</c:if>
<c:if test="${not empty successMessage && successMessage ne 'null'}">
$('#exampleModal2').modal('show');
</c:if>
});
</script>
</body>
</html>

View File

@ -40,7 +40,10 @@ public class OutputController {
private TeacherService teacherService; private TeacherService teacherService;
@GetMapping("/export-csv") @GetMapping("/export-csv")
public void exportCSV(HttpServletResponse response, @RequestParam("type") String type) throws IOException { public void exportCSV(HttpServletResponse response,
@RequestParam("type") String type,
@RequestParam(value = "classes",required = false,defaultValue = "null") String classes
) throws IOException {
response.setHeader("Content-Disposition", "attachment; filename=export.csv"); response.setHeader("Content-Disposition", "attachment; filename=export.csv");
response.setContentType("text/csv; charset=UTF-8"); // 设置字符编码为UTF-8 response.setContentType("text/csv; charset=UTF-8"); // 设置字符编码为UTF-8
response.setCharacterEncoding("UTF-8"); // 设置响应字符编码为UTF-8 response.setCharacterEncoding("UTF-8"); // 设置响应字符编码为UTF-8
@ -51,7 +54,12 @@ public class OutputController {
switch (type) { switch (type) {
case "student" -> { case "student" -> {
headers = Arrays.asList("学生ID", "学生姓名", "性别", "出生日期", "联系方式", "班级"); headers = Arrays.asList("学生ID", "学生姓名", "性别", "出生日期", "联系方式", "班级");
List<Student> students = studentService.getAllStudents(); // 根据实际情况获取学生数据 List<Student> students;
if(classes.equals("null")){
students = studentService.getAllStudents(); // 根据实际情况获取学生数据
}else {
students = studentService.getAllStudentsT(classes);
}
data = transformStudentsToData(students); data = transformStudentsToData(students);
} }
case "course" -> { case "course" -> {

View File

@ -1,8 +1,10 @@
package cyou.chenx221.controller; package cyou.chenx221.controller;
import cyou.chenx221.helper.UsernameHelper; import cyou.chenx221.helper.UsernameHelper;
import cyou.chenx221.mapper.UserMapper;
import cyou.chenx221.pojo.Student; import cyou.chenx221.pojo.Student;
import cyou.chenx221.service.StudentService; import cyou.chenx221.service.StudentService;
import cyou.chenx221.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -18,12 +20,16 @@ import java.util.List;
@RequestMapping("/student") @RequestMapping("/student")
public class StudentController { public class StudentController {
private final StudentService studentService; private final StudentService studentService;
private final TeacherService teacherService;
@Autowired @Autowired
public StudentController(StudentService studentService) { private UserMapper userMapper;
this.studentService = studentService;
}
@Autowired
public StudentController(StudentService studentService, TeacherService teacherService) {
this.studentService = studentService;
this.teacherService = teacherService;
}
@GetMapping("/all")//学生信息查询不带条件(排除removed的学生 @GetMapping("/all")//学生信息查询不带条件(排除removed的学生
public String getAllStudents(Model model) { public String getAllStudents(Model model) {
@ -36,6 +42,19 @@ public class StudentController {
return "studentList"; // 重定向到 dashboard 页面 return "studentList"; // 重定向到 dashboard 页面
} }
@GetMapping("/all_t")//学生信息查询不带条件(排除removed的学生
public String getAllStudentsT(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
String classes = teacherService.getClassesById(userMapper.getDetailByUsername(username));
List<Student> students = studentService.getAllStudentsT(classes);
model.addAttribute("classes", classes);
model.addAttribute("students", students);
return "studentList_t";
}
@GetMapping("/queryinfo")//处理访问学生信息查询 @GetMapping("/queryinfo")//处理访问学生信息查询
public String getQueryInfo(Model model) { public String getQueryInfo(Model model) {
String username = new UsernameHelper().getCurrentUsername(); String username = new UsernameHelper().getCurrentUsername();
@ -45,6 +64,16 @@ public class StudentController {
return "studentListQuery"; return "studentListQuery";
} }
@GetMapping("/queryinfo_t")//处理访问学生信息查询
public String getQueryInfoT(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
model.addAttribute("classes", teacherService.getClassesById(userMapper.getDetailByUsername(username)));
return "studentListQuery_t";
}
@PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")//学生信息查询带条件 @PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")//学生信息查询带条件
public String getQueryStudents(@RequestParam(value = "name", defaultValue = "null", required = false) String name, public String getQueryStudents(@RequestParam(value = "name", defaultValue = "null", required = false) String name,
@RequestParam(value = "birthday", defaultValue = "null", required = false) String birthdayStr, @RequestParam(value = "birthday", defaultValue = "null", required = false) String birthdayStr,
@ -116,6 +145,7 @@ public class StudentController {
@RequestParam(value = "id", defaultValue = "-1", required = false) int id, @RequestParam(value = "id", defaultValue = "-1", required = false) int id,
@RequestParam(value = "phone", defaultValue = "null", required = false) String phone, @RequestParam(value = "phone", defaultValue = "null", required = false) String phone,
@RequestParam(value = "classes", defaultValue = "", required = false) String classes, @RequestParam(value = "classes", defaultValue = "", required = false) String classes,
@RequestParam(value = "cla", defaultValue = "null", required = false) String cla,
Model model) { Model model) {
Date birthday = null; Date birthday = null;
if (!"null".equals(birthdayStr)) { if (!"null".equals(birthdayStr)) {
@ -135,7 +165,11 @@ public class StudentController {
studentService.updateStudent(student); studentService.updateStudent(student);
model.addAttribute("successMessage", "学生信息修改成功"); model.addAttribute("successMessage", "学生信息修改成功");
} }
if (cla.equals("null")) {
return "redirect:/student/infomodv2"; return "redirect:/student/infomodv2";
} else {
return "redirect:/student/infomodv2_t";
}
} }
@GetMapping("/infomodv2")//处理学生信息修改页 @GetMapping("/infomodv2")//处理学生信息修改页
@ -154,6 +188,24 @@ public class StudentController {
return "studentinfomodv2"; return "studentinfomodv2";
} }
@GetMapping("/infomodv2_t")//处理学生信息修改页
public String getInfoModv2T(@RequestParam(value = "successMessage", required = false, defaultValue = "null") String successMessage,
@RequestParam(value = "errorMessage", required = false, defaultValue = "null") String errorMessage,
Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
String classes = teacherService.getClassesById(userMapper.getDetailByUsername(username));
List<Student> students = studentService.getAllStudentsT(classes);
model.addAttribute("classes", classes);
model.addAttribute("students", students);
// 将消息添加到Model中
model.addAttribute("successMessage", successMessage);
model.addAttribute("errorMessage", errorMessage);
return "studentinfomodv2_t";
}
@PostMapping(value = "/delinfo", produces = "application/x-www-form-urlencoded;charset=UTF-8") @PostMapping(value = "/delinfo", produces = "application/x-www-form-urlencoded;charset=UTF-8")
public String UpdateModInfo(@RequestParam(value = "id") int id, public String UpdateModInfo(@RequestParam(value = "id") int id,
Model model) { Model model) {
@ -168,12 +220,33 @@ public class StudentController {
return "redirect:/student/infomodv2"; return "redirect:/student/infomodv2";
} }
@PostMapping(value = "/delinfoT", produces = "application/x-www-form-urlencoded;charset=UTF-8")
public String UpdateModInfoT(@RequestParam(value = "id") int id,
@RequestParam(value = "cla") String classes,
Model model) {
Student temp = studentService.getStudentById(id);
if (id <= 0 || temp == null) {
model.addAttribute("errorMessage", "学生信息删除失败,可能是ID非法或者学生已删除");
} else {
if (temp.getClasses().equals(classes)) {
studentService.deleteStudent(id);
model.addAttribute("successMessage", "学生信息删除成功");
} else {
model.addAttribute("errorMessage", "学生信息删除失败,这名学生不属于您的班级");
}
}
return "redirect:/student/infomodv2_t";
}
@PostMapping(value = "/addinfo", produces = "application/x-www-form-urlencoded;charset=UTF-8") @PostMapping(value = "/addinfo", produces = "application/x-www-form-urlencoded;charset=UTF-8")
public String InsertStudentInfo(@RequestParam(value = "name") String name, public String InsertStudentInfo(@RequestParam(value = "name") String name,
@RequestParam(value = "birthday") Date birthday, @RequestParam(value = "birthday") Date birthday,
@RequestParam(value = "sex") String sex, @RequestParam(value = "sex") String sex,
@RequestParam(value = "phone") String phone, @RequestParam(value = "phone") String phone,
@RequestParam(value = "classes") String classes, @RequestParam(value = "classes") String classes,
@RequestParam(value = "spec" ,defaultValue = "null", required = false) String spec,
Model model) { Model model) {
Student student; Student student;
String classesPattern = "[1-5]班";// 使用正则表达式验证班级格式 String classesPattern = "[1-5]班";// 使用正则表达式验证班级格式
@ -188,6 +261,10 @@ public class StudentController {
studentService.insertStudent(student); studentService.insertStudent(student);
model.addAttribute("successMessage", "学生信息添加成功"); model.addAttribute("successMessage", "学生信息添加成功");
} }
if(spec.equals("null")){
return "redirect:/student/infomodv2"; return "redirect:/student/infomodv2";
}else {
return "redirect:/student/infomodv2_t";
}
} }
} }

View File

@ -15,4 +15,6 @@ public interface StudentDao {
List<Student> getQueryStudents(Student student); List<Student> getQueryStudents(Student student);
List<Student> getQueryStudents2(Student student); List<Student> getQueryStudents2(Student student);
void updateStudent(Student student); void updateStudent(Student student);
List<Student> getAllStudentsT(String classes);
} }

View File

@ -17,4 +17,7 @@ public interface TeacherDao {
int deleteTeacher(int id); int deleteTeacher(int id);
int addTeacher(Teacher teacher); int addTeacher(Teacher teacher);
String getClassesById(int id);
} }

View File

@ -23,4 +23,6 @@ public interface UserMapper {
int disabledUser(int id); int disabledUser(int id);
int enabledUser(int id); int enabledUser(int id);
int getDetailByUsername(String username);
} }

View File

@ -27,6 +27,11 @@ public class StudentDaoImpl implements StudentDao {
sqlSession.update("updateStudent", student); sqlSession.update("updateStudent", student);
} }
@Override
public List<Student> getAllStudentsT(String classes) {
return sqlSession.selectList("getAllStudentsT", classes);
}
@Override @Override
public void deleteStudent(int id) { public void deleteStudent(int id) {
sqlSession.update("deleteStudent", id); sqlSession.update("deleteStudent", id);

View File

@ -42,4 +42,9 @@ public class TeacherDaoImpl implements TeacherDao {
return sqlSession.insert("addTeacher", teacher); return sqlSession.insert("addTeacher", teacher);
} }
@Override
public String getClassesById(int id) {
return sqlSession.selectOne("getClassesById", id);
}
} }

View File

@ -45,4 +45,8 @@ public class StudentService {
public void insertStudent(Student student) { public void insertStudent(Student student) {
studentDao.insertStudent(student); studentDao.insertStudent(student);
} }
public List<Student> getAllStudentsT(String classes) {
return studentDao.getAllStudentsT(classes);
}
} }

View File

@ -34,4 +34,9 @@ public class TeacherService {
public int addTeacher(Teacher teacher) { public int addTeacher(Teacher teacher) {
return teacherDao.addTeacher(teacher); return teacherDao.addTeacher(teacher);
} }
public String getClassesById(int id) {
return teacherDao.getClassesById(id);
}
} }

View File

@ -70,5 +70,9 @@
VALUES (#{name}, #{birthday}, #{sex}, #{phone}, #{classes}) VALUES (#{name}, #{birthday}, #{sex}, #{phone}, #{classes})
</insert> </insert>
<select id="getAllStudentsT" parameterType="String" resultType="cyou.chenx221.pojo.Student">
SELECT *
FROM student
WHERE removed = 0 AND classes = #{classes}
</select>
</mapper> </mapper>

View File

@ -88,4 +88,9 @@
VALUES (#{name}, #{sex}, #{birthday}, #{course.CourseID}, #{classes}) VALUES (#{name}, #{sex}, #{birthday}, #{course.CourseID}, #{classes})
</insert> </insert>
<select id="getClassesById" parameterType="int" resultType="String">
SELECT classes
FROM teacher
WHERE id = #{id};
</select>
</mapper> </mapper>

View File

@ -40,4 +40,9 @@
SET disabled = 0 SET disabled = 0
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="getDetailByUsername" parameterType="String" resultType="int">
SELECT detail
FROM user
WHERE username = #{username}
</select>
</mapper> </mapper>

View File

@ -23,12 +23,12 @@
<security:intercept-url pattern="/dashboard" access="hasRole('admin')"/> <security:intercept-url pattern="/dashboard" access="hasRole('admin')"/>
<security:intercept-url pattern="/dashboard-t" access="hasRole('teacher')"/> <security:intercept-url pattern="/dashboard-t" access="hasRole('teacher')"/>
<security:intercept-url pattern="/dashboard-s" access="hasRole('student')"/> <security:intercept-url pattern="/dashboard-s" access="hasRole('student')"/>
<security:intercept-url pattern="/student/**" access="hasRole('admin')"/> <security:intercept-url pattern="/student/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/course/**" access="hasRole('admin')"/> <security:intercept-url pattern="/course/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/score/**" access="hasRole('admin')"/> <security:intercept-url pattern="/score/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/output/**" access="hasRole('admin')"/> <security:intercept-url pattern="/output/**" access="hasAnyRole('admin','teacher')"/>
<security:intercept-url pattern="/system/**" access="hasRole('admin')"/> <security:intercept-url pattern="/system/**" access="hasRole('admin')"/>
<security:intercept-url pattern="/user/**" access="hasRole('admin')"/> <security:intercept-url pattern="/user/**" access="hasAnyRole('admin','teacher')"/>
<!-- 未登录状态下会自动跳转到/login登录页--> <!-- 未登录状态下会自动跳转到/login登录页-->
<security:form-login login-page="/login" <security:form-login login-page="/login"
default-target-url="/dashboard" default-target-url="/dashboard"

View File

@ -40,10 +40,9 @@
学生管理 学生管理
</a> </a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1"> <ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="/student/all">学生信息显示</a></li> <li><a class="dropdown-item" href="/student/all_t">学生信息显示</a></li>
<li><a class="dropdown-item" href="/student/queryinfo">学生信息查询</a></li> <li><a class="dropdown-item" href="/student/queryinfo_t">学生信息查询</a></li>
<li><a class="dropdown-item" href="/student/modstep1">学生信息修改(旧)</a></li> <li><a class="dropdown-item" href="/student/infomodv2_t">学生信息修改</a></li>
<li><a class="dropdown-item" href="/student/infomodv2">学生信息修改</a></li>
<li> <li>
<hr class="dropdown-divider" /> <hr class="dropdown-divider" />
</li> </li>

View File

@ -133,7 +133,10 @@
<div> <div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard'">返回 <button type="button" class="btn btn-primary" onclick="function goBack() {
window.history.back(); //返回上一页
}
goBack()">返回
</button> </button>
</div> </div>
</div> </div>

View File

@ -0,0 +1,279 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<title>学生信息查询</title>
<script src="${pageContext.request.contextPath}/resources/js/jquery-3.7.0.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css"/>
<style>
.table-container {
min-width: 80vw;
min-height: 80vh;
align-items: center;
justify-content: center;
}
.table-container table {
width: 100%;
height: 100%;
}
</style>
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="#">学生信息查询</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">用户管理</a></li>
<li><a class="dropdown-item" href="#">日志管理</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center">
<button type="button" class="btn btn-primary" onclick="function goBack() {
window.history.back(); //返回上一页
}
goBack()">返回
</button>
<div class="card">
<div class="card-body p-4 p-md-5">
<h3 class="mb-2 pb-2">数据查询</h3>
<!-- Button triggers collapse -->
<a
class="btn btn-primary mb-3"
data-mdb-toggle="collapse"
href="#collapseWithScrollbar"
role="button"
aria-expanded="false"
aria-controls="collapseExample"
>
<i class="fas fa-circle-question"></i>
帮助信息
</a>
<!-- Collapsed content -->
<div class="collapse scroll-section" id="collapseWithScrollbar" style="max-width: 500px">
<div class="note note-primary mb-3">
<strong>提示:</strong> 这里的查询分成两类,班级查询与其他信息查询独立
</div>
</div>
<form action="query" method="post">
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="text" id="firstName" class="form-control" name="name"/>
<label class="form-label" for="firstName">名字</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="date" class="form-control" id="birthdayDate" name="birthday"/>
<label for="birthdayDate" class="form-label">出生日期</label>
</div>
</div>
<div class="col-md-6 mb-4">
<h6 class="mb-2 pb-1">性别: </h6>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions"
id="femaleGender" value="女"/>
<label class="form-check-label" for="femaleGender">女</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions"
id="maleGender" value="男"/>
<label class="form-check-label" for="maleGender">男</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="number" id="id" class="form-control" name="student-id"/>
<label class="form-label" for="id">学号</label>
</div>
</div>
<%-- Pending 改造 拖条↑--%>
<div class="col-md-6 mb-4">
<div class="form-outline">
<input type="text" id="phoneNumber" class="form-control" name="phone"/>
<label class="form-label" for="phoneNumber">联系方式</label>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<%-- <h6 class="mb-3">班级</h6>--%>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox1"
name="classes"
value="1班"/>
<label class="form-check-label" for="inlineCheckbox1">1班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox2"
name="classes"
value="2班"/>
<label class="form-check-label" for="inlineCheckbox2">2班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox3"
name="classes"
value="3班"/>
<label class="form-check-label" for="inlineCheckbox3">3班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox4"
name="classes"
value="4班"/>
<label class="form-check-label" for="inlineCheckbox4">4班</label>
</div>
<div class="form-check form-check-inline" style="display: none">
<input class="form-check-input" type="checkbox" id="inlineCheckbox5"
name="classes"
value="5班"/>
<label class="form-check-label" for="inlineCheckbox5">5班</label>
</div>
<div class="mt-4">
<input class="btn btn-warning btn-lg" type="submit" value="提交"/>
<%-- <button type="reset" class="btn btn-secondary">重置</button>--%>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
<script>
$(document).ready(function() {
// 获取上级传入的classes属性值
var classes = "${classes}";
// 检查classes是否是单个班级
if (classes.includes("班")) {
// 根据classes的值构建对应的复选框id
var checkboxId = "#inlineCheckbox" + classes.charAt(0);
// 根据id勾选复选框
$(checkboxId).prop('checked', true);
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,202 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<title>学生信息查看</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css"/>
<style>
.table-container {
min-width: 80vw; /* 设置最小宽度为视窗宽度的80% */
min-height: 80vh; /* 设置最小高度为视窗高度的80% */
/*display: flex;*/
align-items: center;
justify-content: center;
}
.table-container table {
width: 100%;
height: 100%;
}
</style>
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="#">学生信息查询</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">用户管理</a></li>
<li><a class="dropdown-item" href="#">日志管理</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center">
<div>
<div class="row">
<div class="col-12">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard-t'">返回
</button>
</div>
</div>
<div class="row">
<div class="col-12">
<button type="button" class="btn btn-primary" onclick="exportCSV('${classes}')">导出</button>
</div>
</div>
</div>
<div class="table-container rounded-4 shadow-3-strong"
style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px;">
<table class="table table-striped table-hover border-primary">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">姓名</th>
<th scope="col">性别</th>
<th scope="col">出生日期</th>
<th scope="col">联系方式</th>
<th scope="col">班级</th>
</tr>
</thead>
<tbody>
<c:forEach var="student" items="${students}">
<tr>
<td>${student.id}</td>
<td>${student.name}</td>
<td>${student.sex}</td>
<td>${student.birthday}</td>
<td>${student.phone}</td>
<td>${student.classes}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
<script>
function exportCSV(classes) {
// 构造请求 URL根据需要导出的类型传递参数
var exportUrl = '/output/export-csv?type=student&classes='+classes; // 示例:导出学生数据
var link = document.createElement('a');
link.href = exportUrl;
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
</body>
</html>

View File

@ -130,7 +130,11 @@
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;"> style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);"> <div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center"> <div class="container d-flex justify-content-center">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard'">返回</button> <button type="button" class="btn btn-primary" onclick="function goBack() {
window.history.back(); //返回上一页
}
goBack()">返回
</button>
<div class="table-container rounded-4 shadow-3-strong" <div class="table-container rounded-4 shadow-3-strong"
style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px;"> style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px;">
<table class="table table-striped table-hover border-primary"> <table class="table table-striped table-hover border-primary">

View File

@ -0,0 +1,437 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<title>学生信息修改v2</title>
<script src="${pageContext.request.contextPath}/resources/js/jquery-3.7.0.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/mdb.min.css"/>
<style>
.table-container {
min-width: 60vw;
/* 设置最小宽度为视窗宽度的80% */
min-height: 80vh;
/* 设置最小高度为视窗高度的80% */
/*display: flex;*/
align-items: center;
justify-content: center;
}
.table-container table {
width: 100%;
height: 100%;
}
</style>
</head>
<body style="font-family: 'Noto Sans SC Regular',serif">
<!--Main Navigation-->
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="z-index: 1;min-height: 58.59px">
<div class="container">
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<i class="fas fa-chalkboard-user me-2"></i>
教务管理系统
</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">首页</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
学生管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown1">
<li><a class="dropdown-item" href="#">学生信息查询</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li><a class="dropdown-item" href="#">学生信息管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li><a class="dropdown-item" href="#">学生成绩管理</a></li>
<li>
<hr class="dropdown-divider"/>
</li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
<li><a class="dropdown-item" href="#">学生选课管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown3" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
课程管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown3">
<li><a class="dropdown-item" href="#">课程信息管理</a></li>
<li><a class="dropdown-item" href="#">课程安排管理</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown4" role="button"
data-mdb-toggle="dropdown" aria-expanded="false">
系统管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown4">
<li><a class="dropdown-item" href="#">个人设定</a></li>
<li><a class="dropdown-item" href="#">用户管理</a></li>
<li><a class="dropdown-item" href="#">日志管理</a></li>
<li><a class="dropdown-item" href="#">版本信息</a></li>
</ul>
</li>
</ul>
</div>
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#"
id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fas fa-circle-user fa-lg me-1"></i>
${username}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="${pageContext.request.contextPath}/logout">登出</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--Main Navigation-->
<!--Main layout-->
<main>
<div class="bg-image shadow-2-strong vh-100"
style="background-image: url('${pageContext.request.contextPath}/resources/img/jason-blackeye-nyL-rzwP-Mk-unsplash.jpg'); margin-top: -58.59px;">
<div class="mask d-flex align-items-center h-100" style="background-color: hsla(0, 0%, 100%, 0.5);">
<div class="container d-flex justify-content-center">
<button type="button" class="btn btn-primary" onclick="location.href='../dashboard'">返回</button>
<div class="table-container rounded-4 shadow-3-strong"
style="background-color: rgba(255,255,255,0.9); overflow-y: auto; max-height: 400px">
<table class="table table-striped table-hover border-primary">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">姓名</th>
<th scope="col">性别</th>
<th scope="col">出生日期</th>
<th scope="col">联系方式</th>
<th scope="col">班级</th>
</tr>
</thead>
<tbody>
<c:forEach var="student" items="${students}">
<tr>
<td>${student.id}</td>
<td>${student.name}</td>
<td>${student.sex}</td>
<td>${student.birthday}</td>
<td>${student.phone}</td>
<td>${student.classes}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div class="container">
<div class="card rounded-4 shadow-3-strong" style="min-width: 244px">
<!-- Tabs navs -->
<ul class="nav nav-tabs" id="ex1" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active fs-6" id="ex1-tab-1" data-mdb-toggle="tab" href="#ex1-tabs-1"
role="tab" aria-controls="ex1-tabs-1" aria-selected="true">信息修改</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link fs-6" id="ex1-tab-2" data-mdb-toggle="tab" href="#ex1-tabs-2"
role="tab" aria-controls="ex1-tabs-2" aria-selected="false">信息删除</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link fs-6" id="ex1-tab-3" data-mdb-toggle="tab" href="#ex1-tabs-3"
role="tab" aria-controls="ex1-tabs-3" aria-selected="false">信息添加</a>
</li>
</ul>
<!-- Tabs navs -->
<hr class="hr" style="margin: 1px"/>
<!-- Tabs content -->
<div class="tab-content" id="ex1-content">
<div class="tab-pane fade show active" id="ex1-tabs-1" role="tabpanel"
aria-labelledby="ex1-tab-1">
<div class="card-body" style="min-width: 175px">
<form action="modinfo" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText1" class="form-control"
required name="id"/>
<label class="form-label" for="typeText1">ID (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText2" class="form-control"
name="name"/>
<label class="form-label" for="typeText2">姓名</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText3" class="form-control"
name="sex"/>
<label class="form-label" for="typeText3">性别 (男/女)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText4" class="form-control"
name="birthday"/>
<label class="form-label" for="typeText4">出生日期</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText5" class="form-control"
name="phone"/>
<label class="form-label" for="typeText5">联系方式</label>
</div>
</div>
</div>
<div class="row mb-2" style="display: none">
<div class="col-12">
<div class="form-outline">
<input type="text" id="hidden_del_clas" class="form-control"
required name="cla" value="${classes}"/>
<label class="form-label" for="hidden_del_clas">班级</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary"
data-mdb-toggle="tooltip" data-mdb-placement="top"
title="留空为不做修改">更改
</button>
</div>
<div class="col-lg-6 text-center">
<button type="reset" class="btn btn-secondary">重置</button>
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane fade" id="ex1-tabs-2" role="tabpanel" aria-labelledby="ex1-tab-2">
<div class="card-body" style="min-width: 175px">
<form action="delinfoT" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText7" class="form-control"
required name="id"/>
<label class="form-label" for="typeText7">ID (必填)</label>
</div>
</div>
</div>
<div class="row mb-2" style="display: none">
<div class="col-12">
<div class="form-outline">
<input type="text" id="hidden_del_class" class="form-control"
required name="cla" value="${classes}"/>
<label class="form-label" for="hidden_del_class">班级</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary">删除</button>
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane fade" id="ex1-tabs-3" role="tabpanel" aria-labelledby="ex1-tab-3">
<!-- <h5 class="card-header">信息添加</h5> -->
<div class="card-body" style="min-width: 175px">
<form action="addinfo" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText9" class="form-control"
name="name"/>
<label class="form-label" for="typeText9">姓名 (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText10" class="form-control"
name="sex"/>
<label class="form-label" for="typeText10">性别 (必填)
(男/女)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText11" class="form-control"
name="birthday"/>
<label class="form-label" for="typeText11">出生日期 (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText12" class="form-control"
name="phone"/>
<label class="form-label" for="typeText12">联系方式 (必填)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText13" class="form-control"
name="classes" readonly value="${classes}"/>
<label class="form-label" for="typeText13">班级 (只读)</label>
</div>
</div>
</div>
<div class="row mb-2" style="display: none">
<div class="col-12">
<div class="form-outline">
<input type="text" id="spec_1" class="form-control"
name="spec" value="ok"/>
<label class="form-label" for="spec_1">隐藏的属性</label>
</div>
</div>
</div>
<div class="row mb-2 mt-4">
<div class="col-lg-6 text-center">
<button type="submit" class="btn btn-primary"
data-mdb-toggle="tooltip" data-mdb-placement="top"
title="留空为不做修改">添加
</button>
</div>
<div class="col-lg-6 text-center">
<button type="reset" class="btn btn-secondary">重置</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Tabs content -->
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
<i class="fas fa-circle-exclamation me-2"></i>错误
</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<c:if test="${not empty errorMessage}">
${errorMessage}
</c:if>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-mdb-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal2" tabindex="-1" aria-labelledby="exampleModalLabel2"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel2">
<i class="fas fa-circle-check me-2"></i>成功
</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<c:if test="${not empty successMessage}">
${successMessage}
</c:if>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-mdb-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
</main>
<!--Main layout-->
<!-- Footer -->
<footer class="bg-link text-center text-lg-start ">
</footer>
<!-- Footer -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/mdb.min.js"></script>
<script>
$(document).ready(function () {
// 判断模型中是否存在错误信息
<c:if test="${not empty errorMessage && errorMessage ne 'null'}">
$('#exampleModal').modal('show');
</c:if>
<c:if test="${not empty successMessage && successMessage ne 'null'}">
$('#exampleModal2').modal('show');
</c:if>
});
</script>
</body>
</html>