Compare commits
3 Commits
317172aa4b
...
4a4871eccf
Author | SHA1 | Date |
---|---|---|
Chenx221 | 4a4871eccf | |
Chenx221 | f4f86db07a | |
Chenx221 | caa63444eb |
Binary file not shown.
|
@ -0,0 +1,216 @@
|
|||
<%@ 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>教师信息查询结果页</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'">返回
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<button type="button" class="btn btn-primary" onclick="downloadCSV()">导出</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">授课课程ID</th>
|
||||
<th scope="col">授课课程名</th>
|
||||
<th scope="col">授课班级</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="teacher" items="${teacherList}">
|
||||
<tr>
|
||||
<td>${teacher.id}</td>
|
||||
<td>${teacher.name}</td>
|
||||
<td>${teacher.sex}</td>
|
||||
<td>${teacher.birthday}</td>
|
||||
<td>${teacher.course.courseID}</td>
|
||||
<td>${teacher.course.courseName}</td>
|
||||
<td>${teacher.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 downloadCSV() {
|
||||
// 获取文件名
|
||||
var fileName = "${download}";
|
||||
|
||||
// 构建文件下载链接
|
||||
var downloadLink = "/output/get-csv?filename=" + fileName;
|
||||
|
||||
// 创建一个隐藏的<a>元素并设置下载链接
|
||||
var linkElement = document.createElement('a');
|
||||
linkElement.href = downloadLink;
|
||||
linkElement.target = "_blank";
|
||||
linkElement.download = fileName;
|
||||
|
||||
// 将<a>元素添加到DOM树中
|
||||
document.body.appendChild(linkElement);
|
||||
|
||||
// 模拟点击<a>元素来触发下载操作
|
||||
linkElement.click();
|
||||
|
||||
// 从DOM树中移除<a>元素
|
||||
document.body.removeChild(linkElement);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -162,10 +162,10 @@
|
|||
<td class="text-center">
|
||||
<div class="btn-group" role="group" aria-label="Basic example">
|
||||
<button type="button" class="btn btn-danger">
|
||||
<i class="fas fa-pencil me-1"></i>禁用账户
|
||||
<i class="fas fa-pencil"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary">
|
||||
<i class="fas fa-trash me-1"></i>重设密码
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -225,7 +225,7 @@
|
|||
<div class="col-12">
|
||||
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
|
||||
<select name="sex" id="sex-select">
|
||||
<option value="">请选择性别</option>
|
||||
<option value="null">请选择性别</option>
|
||||
<option value="male">男</option>
|
||||
<option value="female">女</option>
|
||||
</select>
|
||||
|
@ -273,7 +273,7 @@
|
|||
<input type="text" id="typeText8" class="form-control"
|
||||
name="classes"/>
|
||||
<label class="form-label"
|
||||
for="typeText8">授课班级(一班~五班)</label>
|
||||
for="typeText8">授课班级(1~5班)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -297,7 +297,7 @@
|
|||
<div class="form-outline">
|
||||
<input type="number" id="typeText9" class="form-control" required
|
||||
name="id"/>
|
||||
<label class="form-label" for="typeText9">教师ID</label>
|
||||
<label class="form-label" for="typeText9">教师ID (必填)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -544,112 +544,104 @@
|
|||
</c:if>
|
||||
});
|
||||
|
||||
// function resetPWD(id) {
|
||||
// $('#typeText5').val(id);
|
||||
// $('#ex1-tab-2').tab('show');
|
||||
// }
|
||||
//
|
||||
// // 监听权限组选择框的变化
|
||||
// document.getElementById('role-select').addEventListener('change', function () {
|
||||
// var roleSelect = document.getElementById('role-select');
|
||||
// var typeText4 = document.getElementById('typeText4');
|
||||
//
|
||||
// // 如果选择的是管理员权限组,则禁用身份ID输入框;否则启用身份ID输入框
|
||||
// typeText4.disabled = roleSelect.value === 'admin';
|
||||
// });
|
||||
//
|
||||
// //实现按钮的点击事件(禁用/启用用户)
|
||||
// $(document).ready(function () {
|
||||
// $('.btn-danger').on('click', function () {
|
||||
// var id = $(this).closest('tr').find('td:first').text();
|
||||
// userdisabled(id);
|
||||
// // console.log(id) // debug
|
||||
// });
|
||||
// });
|
||||
// $(document).ready(function () {
|
||||
// $('.btn-success').on('click', function () {
|
||||
// var id = $(this).closest('tr').find('td:first').text();
|
||||
// userenabled(id);
|
||||
// // console.log(id) // debug
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// //使用ajax在后台发送post禁用/启用用户请求
|
||||
// function userdisabled(id) {
|
||||
// //btn-danger
|
||||
// $.ajax({
|
||||
// url: 'userdisabled',
|
||||
// type: 'post',
|
||||
// data: {
|
||||
// id: id
|
||||
// },
|
||||
// success: function (data) {
|
||||
// if (data.status === 'success') {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// $('#exampleModal3').on('hidden.bs.modal', function () { //针对点击modal外的情况的处理
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// } else {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("close");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// }
|
||||
// },
|
||||
// error: function (xhr, status, error) {
|
||||
// // 处理请求失败的逻辑
|
||||
// console.log('请求失败:', error);
|
||||
// alert('请求请求失败,请重试');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// function userenabled(id) {
|
||||
// $.ajax({
|
||||
// url: 'userenabled',
|
||||
// type: 'post',
|
||||
// data: {
|
||||
// id: id
|
||||
// },
|
||||
// success: function (data) {
|
||||
// if (data.status === 'success') {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// $('#exampleModal3').on('hidden.bs.modal', function () {
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// } else {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("close");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// }
|
||||
// },
|
||||
// error: function (xhr, status, error) {
|
||||
// // 处理请求失败的逻辑
|
||||
// console.log('请求失败:', error);
|
||||
// alert('请求请求失败,请重试');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// //处理成功/失败后的刷新页面/关闭模态框操作
|
||||
// function reloadka(action) {
|
||||
// if (action === 'reload') {
|
||||
// window.location.reload();
|
||||
// } else if (action === 'close') {
|
||||
// $('#exampleModal3').modal('hide');
|
||||
// }
|
||||
// }
|
||||
function resetPWD(id) {
|
||||
$('#typeText5').val(id);
|
||||
$('#ex1-tab-2').tab('show');
|
||||
}
|
||||
|
||||
|
||||
//实现按钮的点击事件(禁用/启用用户)
|
||||
$(document).ready(function () {
|
||||
$('.btn-danger').on('click', function () {
|
||||
var id = $(this).closest('tr').find('td:first').text();
|
||||
userdisabled(id);
|
||||
// console.log(id) // debug
|
||||
});
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('.btn-success').on('click', function () {
|
||||
var id = $(this).closest('tr').find('td:first').text();
|
||||
userenabled(id);
|
||||
// console.log(id) // debug
|
||||
});
|
||||
});
|
||||
|
||||
//使用ajax在后台发送post禁用/启用用户请求
|
||||
function userdisabled(id) {
|
||||
//btn-danger
|
||||
$.ajax({
|
||||
url: 'userdisabled',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.status === 'success') {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("reload");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
$('#exampleModal3').on('hidden.bs.modal', function () { //针对点击modal外的情况的处理
|
||||
reloadka("reload");
|
||||
});
|
||||
} else {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("close");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// 处理请求失败的逻辑
|
||||
console.log('请求失败:', error);
|
||||
alert('请求请求失败,请重试');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function userenabled(id) {
|
||||
$.ajax({
|
||||
url: 'userenabled',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.status === 'success') {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("reload");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
$('#exampleModal3').on('hidden.bs.modal', function () {
|
||||
reloadka("reload");
|
||||
});
|
||||
} else {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("close");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// 处理请求失败的逻辑
|
||||
console.log('请求失败:', error);
|
||||
alert('请求请求失败,请重试');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理成功/失败后的刷新页面/关闭模态框操作
|
||||
function reloadka(action) {
|
||||
if (action === 'reload') {
|
||||
window.location.reload();
|
||||
} else if (action === 'close') {
|
||||
$('#exampleModal3').modal('hide');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -11,29 +11,12 @@
|
|||
Target Server Version : 80033 (8.0.33)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 14/06/2023 15:12:44
|
||||
Date: 16/06/2023 13:52:21
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for admin
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `admin`;
|
||||
CREATE TABLE `admin` (
|
||||
`admin_id` int NOT NULL AUTO_INCREMENT COMMENT '管理员id',
|
||||
`user_id` int NOT NULL COMMENT '用户id',
|
||||
`disabled` int NOT NULL DEFAULT 0 COMMENT '禁用属性(默认 0 false)',
|
||||
PRIMARY KEY (`admin_id`, `user_id`) USING BTREE,
|
||||
INDEX `fk_admin_user`(`user_id` ASC) USING BTREE,
|
||||
CONSTRAINT `fk_admin_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of admin
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for course
|
||||
-- ----------------------------
|
||||
|
@ -44,7 +27,7 @@ CREATE TABLE `course` (
|
|||
`Description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '课程描述',
|
||||
`removed` int NULL DEFAULT 0 COMMENT '移除的课程(default: 0 false)',
|
||||
PRIMARY KEY (`CourseID`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of course
|
||||
|
@ -61,6 +44,7 @@ INSERT INTO `course` VALUES (9, '政治', '政府与公民', 0);
|
|||
INSERT INTO `course` VALUES (10, '经济', '资源与市场', 0);
|
||||
INSERT INTO `course` VALUES (11, '技术', '没有描述', 0);
|
||||
INSERT INTO `course` VALUES (12, '技术2', '描述2', 0);
|
||||
INSERT INTO `course` VALUES (13, '课程2', '描述3', 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for score
|
||||
|
@ -1228,6 +1212,47 @@ INSERT INTO `student` VALUES (1001, '测试数据1', '男', '2023-08-05', '40867
|
|||
INSERT INTO `student` VALUES (1002, '测试2', '男', '2023-09-05', '123', '1班', 0, NULL, 0);
|
||||
INSERT INTO `student` VALUES (1003, '陈', '男', '2023-06-09', '221', '5班', 0, NULL, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for teacher
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `teacher`;
|
||||
CREATE TABLE `teacher` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '教师姓名',
|
||||
`sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '性别',
|
||||
`birthday` date NULL DEFAULT NULL COMMENT '出生日期',
|
||||
`course_id` int NULL DEFAULT NULL COMMENT '所教课程',
|
||||
`classes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '班级',
|
||||
`removed` int NULL DEFAULT 0 COMMENT '移除字段(default:0 false)',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `fk_teacher_course`(`course_id` ASC) USING BTREE,
|
||||
CONSTRAINT `fk_teacher_course` FOREIGN KEY (`course_id`) REFERENCES `course` (`CourseID`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of teacher
|
||||
-- ----------------------------
|
||||
INSERT INTO `teacher` VALUES (1, '韦秀英', '女', '1989-01-01', 8, '1班', 0);
|
||||
INSERT INTO `teacher` VALUES (2, '蔡岚', '女', '1997-08-14', 1, '5班', 0);
|
||||
INSERT INTO `teacher` VALUES (3, '蒋岚', '女', '1998-09-28', 9, '3班', 0);
|
||||
INSERT INTO `teacher` VALUES (4, '侯嘉伦', '男', '1980-05-07', 13, '3班', 0);
|
||||
INSERT INTO `teacher` VALUES (5, '毛子异', '男', '1995-05-03', 12, '1班', 0);
|
||||
INSERT INTO `teacher` VALUES (6, '林子异', '男', '1985-02-25', 7, '2班', 0);
|
||||
INSERT INTO `teacher` VALUES (7, '汤杰宏', '男', '1995-03-13', 6, '3班', 0);
|
||||
INSERT INTO `teacher` VALUES (8, '邵安琪', '女', '1987-06-10', 11, '5班', 0);
|
||||
INSERT INTO `teacher` VALUES (9, '毛云熙', '男', '1995-06-18', 3, '1班', 0);
|
||||
INSERT INTO `teacher` VALUES (10, '曹安琪', '女', '1980-11-13', 4, '1班', 0);
|
||||
INSERT INTO `teacher` VALUES (11, '胡安琪', '女', '1988-05-23', 10, '1班', 0);
|
||||
INSERT INTO `teacher` VALUES (12, '熊詩涵', '女', '1981-09-10', 5, '4班', 0);
|
||||
INSERT INTO `teacher` VALUES (13, '贺詩涵', '女', '1998-11-06', 2, '2班', 0);
|
||||
INSERT INTO `teacher` VALUES (14, '郑安琪', '女', '1995-05-31', 10, '2班', 0);
|
||||
INSERT INTO `teacher` VALUES (15, '田云熙', '男', '1990-06-07', 9, '4班', 0);
|
||||
INSERT INTO `teacher` VALUES (16, '常震南', '男', '1993-08-19', 3, '2班', 0);
|
||||
INSERT INTO `teacher` VALUES (17, '刘秀英', '女', '1999-02-18', 9, '2班', 0);
|
||||
INSERT INTO `teacher` VALUES (18, '孟宇宁', '男', '1984-12-24', 10, '1班', 0);
|
||||
INSERT INTO `teacher` VALUES (19, '吕睿', '男', '1989-02-22', 1, '1班', 0);
|
||||
INSERT INTO `teacher` VALUES (20, '段嘉伦', '男', '1995-02-08', 10, '1班', 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user
|
||||
-- ----------------------------
|
||||
|
@ -1236,19 +1261,22 @@ CREATE TABLE `user` (
|
|||
`id` int NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户名',
|
||||
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '密码',
|
||||
`roles` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'admin' COMMENT '角色(default: admin)',
|
||||
`roles` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'admin' COMMENT '角色(admin,student,teacher)',
|
||||
`disabled` int NULL DEFAULT 0 COMMENT '禁用(default: 0 false)',
|
||||
`detail` int NULL DEFAULT NULL COMMENT 'link to roles id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user
|
||||
-- ----------------------------
|
||||
INSERT INTO `user` VALUES (1, 'admin', '8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918', 'admin', 0);
|
||||
INSERT INTO `user` VALUES (2, 'guest', '84983c60f7daadc1cb8698621f802c0d9f9a3c3c295c810748fb048115c186ec', 'admin', 1);
|
||||
INSERT INTO `user` VALUES (3, 'chenx221', '62982ab94542113a449fc9528779583bb6b93988ac4678c3fd6c010b66e7a851', 'admin', 0);
|
||||
INSERT INTO `user` VALUES (4, 'chenx2210', '2bd27a9cb9135ff37aee523b7e439873a46da4d5b482145927b991a95baf43bb', 'admin', 0);
|
||||
INSERT INTO `user` VALUES (5, 'newuser1', '7dcf407fa84a0e0519c7991154c4148de0244d7589020c0d9842db9efad82094', 'admin', 0);
|
||||
INSERT INTO `user` VALUES (6, 'guest2', '6b93ccba414ac1d0ae1e77f3fac560c748a6701ed6946735a49d463351518e16', 'admin', 0);
|
||||
INSERT INTO `user` VALUES (1, 'admin', '8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918', 'admin', 0, NULL);
|
||||
INSERT INTO `user` VALUES (2, 'guest', '84983c60f7daadc1cb8698621f802c0d9f9a3c3c295c810748fb048115c186ec', 'admin', 1, NULL);
|
||||
INSERT INTO `user` VALUES (3, 'chenx221', '62982ab94542113a449fc9528779583bb6b93988ac4678c3fd6c010b66e7a851', 'admin', 1, NULL);
|
||||
INSERT INTO `user` VALUES (4, 'chenx2210', '2bd27a9cb9135ff37aee523b7e439873a46da4d5b482145927b991a95baf43bb', 'admin', 0, NULL);
|
||||
INSERT INTO `user` VALUES (5, 'newuser1', '7dcf407fa84a0e0519c7991154c4148de0244d7589020c0d9842db9efad82094', 'admin', 0, NULL);
|
||||
INSERT INTO `user` VALUES (6, 'guest2', '6b93ccba414ac1d0ae1e77f3fac560c748a6701ed6946735a49d463351518e16', 'admin', 0, NULL);
|
||||
INSERT INTO `user` VALUES (7, 'student1', '49fe07d0f041bced9ba827a10c2cd31b2089229d4b4e3a63b074ed7a4370e88f', 'student', 0, 0);
|
||||
INSERT INTO `user` VALUES (8, 'student2', '2d850eb5460ffb6bb9ae11186a2d78cc22d9df387f9cdbd3a297e0d1ea08a54b', 'student', 0, 4);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
package cyou.chenx221.controller;
|
||||
|
||||
import cyou.chenx221.helper.CsvHelper;
|
||||
import cyou.chenx221.helper.UsernameHelper;
|
||||
import cyou.chenx221.pojo.Course;
|
||||
import cyou.chenx221.pojo.Score;
|
||||
import cyou.chenx221.pojo.Student;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Date;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
|
@ -31,4 +42,71 @@ public class TeacherController {
|
|||
model.addAttribute("teacherList", teacherList);
|
||||
return "teachermanage";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")
|
||||
public String postQuery(@RequestParam(value = "id", defaultValue = "-1", required = false) int id,//教师id
|
||||
@RequestParam(value = "name", defaultValue = "null", required = false) String name,//教师姓名
|
||||
@RequestParam(value = "sex", defaultValue = "null", required = false) String sex,//性别
|
||||
@RequestParam(value = "birthday_begin", defaultValue = "null", required = false) String birthday_begin_str,//日期起始
|
||||
@RequestParam(value = "birthday_end", defaultValue = "null", required = false) String birthday_end_str,//日期结束
|
||||
@RequestParam(value = "course_id", defaultValue = "-1", required = false) int course_id,//课程ID
|
||||
@RequestParam(value = "course_name", defaultValue = "null", required = false) String course_name,//课程名
|
||||
@RequestParam(value = "classes", defaultValue = "null", required = false) String classes,//授课班级
|
||||
Model model) {
|
||||
|
||||
//username helper start
|
||||
String username = new UsernameHelper().getCurrentUsername();
|
||||
if (username != null) {
|
||||
model.addAttribute("username", username);
|
||||
}
|
||||
//username helper end
|
||||
|
||||
String pattern = "yyyy-MM-dd"; // 日期字符串的格式,与HTML的input type为date的格式相对应
|
||||
DateFormat dateFormat = new SimpleDateFormat(pattern);
|
||||
Date birthdayBegin = null, birthdayEnd = null;
|
||||
try {
|
||||
if (!birthday_begin_str.equals("null")) {
|
||||
java.util.Date parsedBeginDate = dateFormat.parse(birthday_begin_str);
|
||||
birthdayBegin = new Date(parsedBeginDate.getTime());
|
||||
}
|
||||
if (!birthday_end_str.equals("null")) {
|
||||
java.util.Date parsedEndDate = dateFormat.parse(birthday_end_str);
|
||||
birthdayEnd = new Date(parsedEndDate.getTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (name.equals("null")) {
|
||||
name = null;
|
||||
}
|
||||
if (sex.equals("null")) {
|
||||
sex = null;
|
||||
}
|
||||
if (course_name.equals("null")) {
|
||||
course_name = null;
|
||||
}
|
||||
if (classes.equals("null")) {
|
||||
classes = null;
|
||||
}
|
||||
|
||||
String classesPattern = "[1-5]班";// 使用正则表达式验证班级格式
|
||||
|
||||
if (id <= 0 && name == null && sex == null && birthdayBegin == null && birthdayEnd == null && course_id <= 0 && course_name == null && classes == null) {
|
||||
model.addAttribute("errorMessage", "ID非法或查询条件全为空");
|
||||
return "redirect:/teacher/manage";
|
||||
} else if (birthdayBegin != null && birthdayEnd != null) {
|
||||
if (birthdayBegin.compareTo(birthdayEnd) > 0) {//birthdayBegin > birthdayEnd
|
||||
model.addAttribute("errorMessage", "日期范围异常");
|
||||
return "redirect:/teacher/manage";
|
||||
}
|
||||
}
|
||||
Teacher teacher = new Teacher(id, name, sex, (course_id == -1 && course_name == null ? null : (new Course(course_id, course_name))), classes, birthdayBegin, birthdayEnd);
|
||||
List<Teacher> teachers = teacherService.getQueryTeachers(teacher);
|
||||
|
||||
// scores = scoreService.getQueryScores(score);
|
||||
// String download = new CsvHelper().generateScoreCSVFile(scores);
|
||||
// model.addAttribute("download", download);
|
||||
// model.addAttribute("scores", scores);
|
||||
return "scoreQueryResult";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface TeacherDao {
|
||||
List<Teacher> getAllTeachers();
|
||||
|
||||
List<Teacher> getQueryTeachers(Teacher teacher);
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class TeacherDaoImpl implements TeacherDao {
|
|||
public List<Teacher> getAllTeachers() {
|
||||
return sqlSession.selectList("getAllTeachers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Teacher> getQueryTeachers(Teacher teacher) {
|
||||
return sqlSession.selectList("getQueryTeachers",teacher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,34 @@ public class Teacher {
|
|||
private Course course;//课程
|
||||
private String classes;//班级(目前仅单个班级)
|
||||
private Integer removed;//移除标志
|
||||
private Date birthdayBegin;
|
||||
private Date birthdayEnd;
|
||||
|
||||
public Date getBirthdayBegin() {
|
||||
return birthdayBegin;
|
||||
}
|
||||
|
||||
public void setBirthdayBegin(Date birthdayBegin) {
|
||||
this.birthdayBegin = birthdayBegin;
|
||||
}
|
||||
|
||||
public Date getBirthdayEnd() {
|
||||
return birthdayEnd;
|
||||
}
|
||||
|
||||
public void setBirthdayEnd(Date birthdayEnd) {
|
||||
this.birthdayEnd = birthdayEnd;
|
||||
}
|
||||
|
||||
public Teacher(Integer id, String name, String sex, Course course, String classes, Date birthdayBegin, Date birthdayEnd) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.sex = sex;
|
||||
this.course = course;
|
||||
this.classes = classes;
|
||||
this.birthdayBegin = birthdayBegin;
|
||||
this.birthdayEnd = birthdayEnd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -17,4 +17,8 @@ public class TeacherService {
|
|||
public List<Teacher> getAllTeachers() {
|
||||
return teacherDao.getAllTeachers();
|
||||
}
|
||||
|
||||
public List<Teacher> getQueryTeachers(Teacher teacher) {
|
||||
return teacherDao.getQueryTeachers(teacher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,41 @@
|
|||
<result property="CourseName" column="CourseName"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<select id="getAllTeachers" resultMap="TeacherResultMap">
|
||||
SELECT id, name, sex, birthday, classes, c.CourseID, c.CourseName
|
||||
FROM teacher t
|
||||
JOIN course c ON c.CourseID = t.course_id
|
||||
WHERE t.removed = 0;
|
||||
</select>
|
||||
|
||||
<select id="getQueryTeachers" parameterType="cyou.chenx221.pojo.Teacher" resultMap="TeacherResultMap">
|
||||
SELECT id, name, sex, birthday, classes, c.CourseID, c.CourseName
|
||||
FROM teacher t
|
||||
JOIN course c ON c.CourseID = t.course_id
|
||||
WHERE t.removed = 0
|
||||
<trim prefix="AND" prefixOverrides="AND | OR">
|
||||
<if test="id != -1">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
AND sex = #{sex}
|
||||
</if>
|
||||
<if test="course !=null">
|
||||
<if test="course.CourseID != null">
|
||||
AND c.CourseID = #{course.courseID}
|
||||
</if>
|
||||
<if test="course.CourseName != null">
|
||||
AND c.CourseName LIKE CONCAT('%', #{course.courseName}, '%')
|
||||
</if>
|
||||
</if>
|
||||
<if test="classes != null">
|
||||
AND classes = #{classes}
|
||||
</if>
|
||||
# 待添加
|
||||
</trim>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,216 @@
|
|||
<%@ 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>教师信息查询结果页</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'">返回
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<button type="button" class="btn btn-primary" onclick="downloadCSV()">导出</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">授课课程ID</th>
|
||||
<th scope="col">授课课程名</th>
|
||||
<th scope="col">授课班级</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="teacher" items="${teacherList}">
|
||||
<tr>
|
||||
<td>${teacher.id}</td>
|
||||
<td>${teacher.name}</td>
|
||||
<td>${teacher.sex}</td>
|
||||
<td>${teacher.birthday}</td>
|
||||
<td>${teacher.course.courseID}</td>
|
||||
<td>${teacher.course.courseName}</td>
|
||||
<td>${teacher.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 downloadCSV() {
|
||||
// 获取文件名
|
||||
var fileName = "${download}";
|
||||
|
||||
// 构建文件下载链接
|
||||
var downloadLink = "/output/get-csv?filename=" + fileName;
|
||||
|
||||
// 创建一个隐藏的<a>元素并设置下载链接
|
||||
var linkElement = document.createElement('a');
|
||||
linkElement.href = downloadLink;
|
||||
linkElement.target = "_blank";
|
||||
linkElement.download = fileName;
|
||||
|
||||
// 将<a>元素添加到DOM树中
|
||||
document.body.appendChild(linkElement);
|
||||
|
||||
// 模拟点击<a>元素来触发下载操作
|
||||
linkElement.click();
|
||||
|
||||
// 从DOM树中移除<a>元素
|
||||
document.body.removeChild(linkElement);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -162,10 +162,10 @@
|
|||
<td class="text-center">
|
||||
<div class="btn-group" role="group" aria-label="Basic example">
|
||||
<button type="button" class="btn btn-danger">
|
||||
<i class="fas fa-pencil me-1"></i>禁用账户
|
||||
<i class="fas fa-pencil"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary">
|
||||
<i class="fas fa-trash me-1"></i>重设密码
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -225,7 +225,7 @@
|
|||
<div class="col-12">
|
||||
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
|
||||
<select name="sex" id="sex-select">
|
||||
<option value="">请选择性别</option>
|
||||
<option value="null">请选择性别</option>
|
||||
<option value="male">男</option>
|
||||
<option value="female">女</option>
|
||||
</select>
|
||||
|
@ -273,7 +273,7 @@
|
|||
<input type="text" id="typeText8" class="form-control"
|
||||
name="classes"/>
|
||||
<label class="form-label"
|
||||
for="typeText8">授课班级(一班~五班)</label>
|
||||
for="typeText8">授课班级(1~5班)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -297,7 +297,7 @@
|
|||
<div class="form-outline">
|
||||
<input type="number" id="typeText9" class="form-control" required
|
||||
name="id"/>
|
||||
<label class="form-label" for="typeText9">教师ID</label>
|
||||
<label class="form-label" for="typeText9">教师ID (必填)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -544,112 +544,104 @@
|
|||
</c:if>
|
||||
});
|
||||
|
||||
// function resetPWD(id) {
|
||||
// $('#typeText5').val(id);
|
||||
// $('#ex1-tab-2').tab('show');
|
||||
// }
|
||||
//
|
||||
// // 监听权限组选择框的变化
|
||||
// document.getElementById('role-select').addEventListener('change', function () {
|
||||
// var roleSelect = document.getElementById('role-select');
|
||||
// var typeText4 = document.getElementById('typeText4');
|
||||
//
|
||||
// // 如果选择的是管理员权限组,则禁用身份ID输入框;否则启用身份ID输入框
|
||||
// typeText4.disabled = roleSelect.value === 'admin';
|
||||
// });
|
||||
//
|
||||
// //实现按钮的点击事件(禁用/启用用户)
|
||||
// $(document).ready(function () {
|
||||
// $('.btn-danger').on('click', function () {
|
||||
// var id = $(this).closest('tr').find('td:first').text();
|
||||
// userdisabled(id);
|
||||
// // console.log(id) // debug
|
||||
// });
|
||||
// });
|
||||
// $(document).ready(function () {
|
||||
// $('.btn-success').on('click', function () {
|
||||
// var id = $(this).closest('tr').find('td:first').text();
|
||||
// userenabled(id);
|
||||
// // console.log(id) // debug
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// //使用ajax在后台发送post禁用/启用用户请求
|
||||
// function userdisabled(id) {
|
||||
// //btn-danger
|
||||
// $.ajax({
|
||||
// url: 'userdisabled',
|
||||
// type: 'post',
|
||||
// data: {
|
||||
// id: id
|
||||
// },
|
||||
// success: function (data) {
|
||||
// if (data.status === 'success') {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// $('#exampleModal3').on('hidden.bs.modal', function () { //针对点击modal外的情况的处理
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// } else {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("close");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// }
|
||||
// },
|
||||
// error: function (xhr, status, error) {
|
||||
// // 处理请求失败的逻辑
|
||||
// console.log('请求失败:', error);
|
||||
// alert('请求请求失败,请重试');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// function userenabled(id) {
|
||||
// $.ajax({
|
||||
// url: 'userenabled',
|
||||
// type: 'post',
|
||||
// data: {
|
||||
// id: id
|
||||
// },
|
||||
// success: function (data) {
|
||||
// if (data.status === 'success') {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// $('#exampleModal3').on('hidden.bs.modal', function () {
|
||||
// reloadka("reload");
|
||||
// });
|
||||
// } else {
|
||||
// $('#de_message').text(data.message);
|
||||
// $('#de_button').on('click', function () {
|
||||
// reloadka("close");
|
||||
// });
|
||||
// $('#exampleModal3').modal('show');
|
||||
// }
|
||||
// },
|
||||
// error: function (xhr, status, error) {
|
||||
// // 处理请求失败的逻辑
|
||||
// console.log('请求失败:', error);
|
||||
// alert('请求请求失败,请重试');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// //处理成功/失败后的刷新页面/关闭模态框操作
|
||||
// function reloadka(action) {
|
||||
// if (action === 'reload') {
|
||||
// window.location.reload();
|
||||
// } else if (action === 'close') {
|
||||
// $('#exampleModal3').modal('hide');
|
||||
// }
|
||||
// }
|
||||
function resetPWD(id) {
|
||||
$('#typeText5').val(id);
|
||||
$('#ex1-tab-2').tab('show');
|
||||
}
|
||||
|
||||
|
||||
//实现按钮的点击事件(禁用/启用用户)
|
||||
$(document).ready(function () {
|
||||
$('.btn-danger').on('click', function () {
|
||||
var id = $(this).closest('tr').find('td:first').text();
|
||||
userdisabled(id);
|
||||
// console.log(id) // debug
|
||||
});
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('.btn-success').on('click', function () {
|
||||
var id = $(this).closest('tr').find('td:first').text();
|
||||
userenabled(id);
|
||||
// console.log(id) // debug
|
||||
});
|
||||
});
|
||||
|
||||
//使用ajax在后台发送post禁用/启用用户请求
|
||||
function userdisabled(id) {
|
||||
//btn-danger
|
||||
$.ajax({
|
||||
url: 'userdisabled',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.status === 'success') {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("reload");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
$('#exampleModal3').on('hidden.bs.modal', function () { //针对点击modal外的情况的处理
|
||||
reloadka("reload");
|
||||
});
|
||||
} else {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("close");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// 处理请求失败的逻辑
|
||||
console.log('请求失败:', error);
|
||||
alert('请求请求失败,请重试');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function userenabled(id) {
|
||||
$.ajax({
|
||||
url: 'userenabled',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.status === 'success') {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("reload");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
$('#exampleModal3').on('hidden.bs.modal', function () {
|
||||
reloadka("reload");
|
||||
});
|
||||
} else {
|
||||
$('#de_message').text(data.message);
|
||||
$('#de_button').on('click', function () {
|
||||
reloadka("close");
|
||||
});
|
||||
$('#exampleModal3').modal('show');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// 处理请求失败的逻辑
|
||||
console.log('请求失败:', error);
|
||||
alert('请求请求失败,请重试');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理成功/失败后的刷新页面/关闭模态框操作
|
||||
function reloadka(action) {
|
||||
if (action === 'reload') {
|
||||
window.location.reload();
|
||||
} else if (action === 'close') {
|
||||
$('#exampleModal3').modal('hide');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
Loading…
Reference in New Issue