Compare commits

...

2 Commits

Author SHA1 Message Date
Chenx221 ace18d01cd update for front
Signed-off-by: Chenx221 <chenx221@yandex.com>
2023-06-16 12:36:18 +08:00
Chenx221 885746d827 update
Signed-off-by: Chenx221 <chenx221@yandex.com>
2023-06-16 11:30:15 +08:00
18 changed files with 1583 additions and 2 deletions

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cyou.chenx221.mapper.TeacherDao">
<resultMap id="TeacherResultMap" type="cyou.chenx221.pojo.Teacher">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="sex" column="sex"/>
<result property="birthday" column="birthday"/>
<result property="classes" column="classes"/>
<association property="course" javaType="cyou.chenx221.pojo.Course">
<id property="CourseID" column="CourseID"/>
<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>
</mapper>

View File

@ -14,6 +14,7 @@
<mapper resource="mapper/StudentMapper.xml"/>
<mapper resource="mapper/CourseMapper.xml"/>
<mapper resource="mapper/ScoreMapper.xml"/>
<mapper resource="mapper/TeacherMapper.xml"/>
<!-- 可以添加其他的映射器配置 -->
</mappers>
</configuration>

View File

@ -57,7 +57,7 @@
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="/teacher/manage">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>

View File

@ -0,0 +1,665 @@
<%@ 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>
<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 align-middle">
<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>
<%-- <th scope="col" class="text-center">操作</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>
<%-- <td class="text-center">--%>
<%-- <div class="btn-group" role="group" aria-label="Basic example">--%>
<%-- <c:choose>--%>
<%-- <c:when test="${user.disabled_str == false}">--%>
<%-- <button type="button" class="btn btn-danger"><i--%>
<%-- class="fas fa-ban me-1"></i>禁用账户--%>
<%-- </button>--%>
<%-- </c:when>--%>
<%-- <c:when test="${user.disabled_str == true}">--%>
<%-- <button type="button" class="btn btn-success"><i--%>
<%-- class="fas fa-circle-check me-1"--%>
<%-- onclick="userenabled(${user.id})"></i>启用账户--%>
<%-- </button>--%>
<%-- </c:when>--%>
<%-- </c:choose>--%>
<%-- <button type="button" class="btn btn-primary" onclick="resetPWD(${user.id})"><i--%>
<%-- class="fas fa-arrow-rotate-right me-1"></i>重设密码--%>
<%-- </button>--%>
<%-- </div>--%>
<%-- </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="true">信息修改</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>
<li class="nav-item" role="presentation">
<a class="nav-link fs-6" id="ex1-tab-4" data-mdb-toggle="tab" href="#ex1-tabs-4"
role="tab" aria-controls="ex1-tabs-4" 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="query" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText1" class="form-control"
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">
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
<select name="sex" id="sex-select">
<option value="">请选择性别</option>
<option value="male">男</option>
<option value="female">女</option>
</select>
</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_begin"/>
<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="date" id="typeText5" class="form-control"
name="birthday_end"/>
<label class="form-label" for="typeText5">出生日期(末)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText6" class="form-control"
name="course_id"/>
<label class="form-label" for="typeText6">课程ID</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText7" class="form-control"
name="course_name"/>
<label class="form-label" for="typeText7">课程名(支持部分)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText8" class="form-control"
name="classes"/>
<label class="form-label" for="typeText8">授课班级(一班~五班)</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 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="mod" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText9" class="form-control" required
name="id"/>
<label class="form-label" for="typeText9">教师ID</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="name"/>
<label class="form-label" for="typeText10">姓名</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<label for="sex-select2" style="color: rgba(0,0,0,.6);">性别</label>
<select name="sex" id="sex-select2">
<option value="">请选择性别</option>
<option value="male">男</option>
<option value="female">女</option>
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText12" class="form-control"
name="birthday"/>
<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="number" id="typeText13" class="form-control"
name="course_id"/>
<label class="form-label" for="typeText13">课程ID</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText14" class="form-control"
name="course_name"/>
<label class="form-label" for="typeText14">课程名(支持部分)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText15" class="form-control"
name="classes"/>
<label class="form-label" for="typeText15">授课班级(一班~五班)</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 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-3" role="tabpanel" aria-labelledby="ex1-tab-3">
<div class="card-body" style="min-width: 175px">
<form action="del" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText16" class="form-control"
required name="id"/>
<label class="form-label" for="typeText16">课程ID (必填)</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 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-4" role="tabpanel" aria-labelledby="ex1-tab-4">
<!-- <h5 class="card-header">信息添加</h5> -->
<div class="card-body" style="min-width: 175px">
<form action="add" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText18" class="form-control" required
name="name"/>
<label class="form-label" for="typeText18">姓名</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<label for="sex-select3" style="color: rgba(0,0,0,.6);">性别</label>
<select name="sex" id="sex-select3" required>
<option value="">请选择性别</option>
<option value="male">男</option>
<option value="female">女</option>
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText20" class="form-control" required
name="birthday"/>
<label class="form-label" for="typeText20">出生日期</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText21" class="form-control" required
name="course_id"/>
<label class="form-label" for="typeText21">课程ID</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText23" class="form-control" required
name="classes"/>
<label class="form-label" for="typeText23">授课班级</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 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>
<!-- Modal -->
<div class="modal fade" id="exampleModal3" tabindex="-1" aria-labelledby="exampleModalLabel3"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel3">
Info
</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p id="de_message"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-mdb-dismiss="modal" id="de_button">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>
});
// 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');
// }
// }
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
package cyou.chenx221.controller;
import cyou.chenx221.helper.UsernameHelper;
import cyou.chenx221.pojo.Teacher;
import cyou.chenx221.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/teacher")
public class TeacherController {
private final TeacherService teacherService;
@Autowired
public TeacherController(TeacherService teacherService) {
this.teacherService = teacherService;
}
@GetMapping("/manage")
public String manageTeacherInfo(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
List<Teacher> teacherList = teacherService.getAllTeachers();
model.addAttribute("teacherList", teacherList);
return "teachermanage";
}
}

View File

@ -0,0 +1,11 @@
package cyou.chenx221.mapper;
import cyou.chenx221.pojo.Teacher;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TeacherDao {
List<Teacher> getAllTeachers();
}

View File

@ -0,0 +1,24 @@
package cyou.chenx221.mapper.impl;
import cyou.chenx221.mapper.TeacherDao;
import cyou.chenx221.pojo.Teacher;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class TeacherDaoImpl implements TeacherDao {
private SqlSession sqlSession;
@Autowired
public TeacherDaoImpl(SqlSession sqlSession) {
this.sqlSession = sqlSession;
}
@Override
public List<Teacher> getAllTeachers() {
return sqlSession.selectList("getAllTeachers");
}
}

View File

@ -0,0 +1,114 @@
package cyou.chenx221.pojo;
import java.sql.Date;
public class Teacher {
private Integer id;//教师id (主键)
private String name;//教师名称
private String sex;//性别
private Date birthday;//出生日期
// private Integer course_id;//课程id
// private String course_name;//课程名称//*需要额外处理
private Course course;//课程
private String classes;//班级(目前仅单个班级)
private Integer removed;//移除标志
@Override
public String toString() {
return "Teacher{" +
"id=" + id +
", name='" + name + '\'' +
", sex='" + sex + '\'' +
", birthday=" + birthday +
", course=" + course +
", classes='" + classes + '\'' +
", removed=" + removed +
'}';
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Course getCourse() {
return course;
}
public void setCourse(Course course) {
this.course = course;
}
public String getClasses() {
return classes;
}
public void setClasses(String classes) {
this.classes = classes;
}
public Integer getRemoved() {
return removed;
}
public void setRemoved(Integer removed) {
this.removed = removed;
}
public Teacher(String name, String sex, Date birthday, Course course, String classes) {
this.name = name;
this.sex = sex;
this.birthday = birthday;
this.course = course;
this.classes = classes;
}
public Teacher(Integer id, String classes) {
this.id = id;
this.classes = classes;
}
public Teacher(Integer id) {
this.id = id;
}
public Teacher(Integer id, String name, String sex, Date birthday, Course course, String classes, Integer removed) {
this.id = id;
this.name = name;
this.sex = sex;
this.birthday = birthday;
this.course = course;
this.classes = classes;
this.removed = removed;
}
public Teacher() {
}
}

View File

@ -0,0 +1,20 @@
package cyou.chenx221.service;
import cyou.chenx221.mapper.TeacherDao;
import cyou.chenx221.pojo.Teacher;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TeacherService {
private TeacherDao teacherDao;
public TeacherService(TeacherDao teacherDao) {
this.teacherDao = teacherDao;
}
public List<Teacher> getAllTeachers() {
return teacherDao.getAllTeachers();
}
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cyou.chenx221.mapper.TeacherDao">
<resultMap id="TeacherResultMap" type="cyou.chenx221.pojo.Teacher">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="sex" column="sex"/>
<result property="birthday" column="birthday"/>
<result property="classes" column="classes"/>
<association property="course" javaType="cyou.chenx221.pojo.Course">
<id property="CourseID" column="CourseID"/>
<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>
</mapper>

View File

@ -14,6 +14,7 @@
<mapper resource="mapper/StudentMapper.xml"/>
<mapper resource="mapper/CourseMapper.xml"/>
<mapper resource="mapper/ScoreMapper.xml"/>
<mapper resource="mapper/TeacherMapper.xml"/>
<!-- 可以添加其他的映射器配置 -->
</mappers>
</configuration>

View File

@ -57,7 +57,7 @@
教师管理
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown2">
<li><a class="dropdown-item" href="#">教师信息管理</a></li>
<li><a class="dropdown-item" href="/teacher/manage">教师信息管理</a></li>
<li><a class="dropdown-item" href="#">教师课程管理</a></li>
</ul>
</li>

View File

@ -0,0 +1,665 @@
<%@ 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>
<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 align-middle">
<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>
<%-- <th scope="col" class="text-center">操作</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>
<%-- <td class="text-center">--%>
<%-- <div class="btn-group" role="group" aria-label="Basic example">--%>
<%-- <c:choose>--%>
<%-- <c:when test="${user.disabled_str == false}">--%>
<%-- <button type="button" class="btn btn-danger"><i--%>
<%-- class="fas fa-ban me-1"></i>禁用账户--%>
<%-- </button>--%>
<%-- </c:when>--%>
<%-- <c:when test="${user.disabled_str == true}">--%>
<%-- <button type="button" class="btn btn-success"><i--%>
<%-- class="fas fa-circle-check me-1"--%>
<%-- onclick="userenabled(${user.id})"></i>启用账户--%>
<%-- </button>--%>
<%-- </c:when>--%>
<%-- </c:choose>--%>
<%-- <button type="button" class="btn btn-primary" onclick="resetPWD(${user.id})"><i--%>
<%-- class="fas fa-arrow-rotate-right me-1"></i>重设密码--%>
<%-- </button>--%>
<%-- </div>--%>
<%-- </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="true">信息修改</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>
<li class="nav-item" role="presentation">
<a class="nav-link fs-6" id="ex1-tab-4" data-mdb-toggle="tab" href="#ex1-tabs-4"
role="tab" aria-controls="ex1-tabs-4" 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="query" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText1" class="form-control"
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">
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
<select name="sex" id="sex-select">
<option value="">请选择性别</option>
<option value="male">男</option>
<option value="female">女</option>
</select>
</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_begin"/>
<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="date" id="typeText5" class="form-control"
name="birthday_end"/>
<label class="form-label" for="typeText5">出生日期(末)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText6" class="form-control"
name="course_id"/>
<label class="form-label" for="typeText6">课程ID</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText7" class="form-control"
name="course_name"/>
<label class="form-label" for="typeText7">课程名(支持部分)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText8" class="form-control"
name="classes"/>
<label class="form-label" for="typeText8">授课班级(一班~五班)</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 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="mod" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText9" class="form-control" required
name="id"/>
<label class="form-label" for="typeText9">教师ID</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="name"/>
<label class="form-label" for="typeText10">姓名</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<label for="sex-select2" style="color: rgba(0,0,0,.6);">性别</label>
<select name="sex" id="sex-select2">
<option value="">请选择性别</option>
<option value="male">男</option>
<option value="female">女</option>
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText12" class="form-control"
name="birthday"/>
<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="number" id="typeText13" class="form-control"
name="course_id"/>
<label class="form-label" for="typeText13">课程ID</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText14" class="form-control"
name="course_name"/>
<label class="form-label" for="typeText14">课程名(支持部分)</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText15" class="form-control"
name="classes"/>
<label class="form-label" for="typeText15">授课班级(一班~五班)</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 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-3" role="tabpanel" aria-labelledby="ex1-tab-3">
<div class="card-body" style="min-width: 175px">
<form action="del" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText16" class="form-control"
required name="id"/>
<label class="form-label" for="typeText16">课程ID (必填)</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 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-4" role="tabpanel" aria-labelledby="ex1-tab-4">
<!-- <h5 class="card-header">信息添加</h5> -->
<div class="card-body" style="min-width: 175px">
<form action="add" method="post">
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText18" class="form-control" required
name="name"/>
<label class="form-label" for="typeText18">姓名</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<label for="sex-select3" style="color: rgba(0,0,0,.6);">性别</label>
<select name="sex" id="sex-select3" required>
<option value="">请选择性别</option>
<option value="male">男</option>
<option value="female">女</option>
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="date" id="typeText20" class="form-control" required
name="birthday"/>
<label class="form-label" for="typeText20">出生日期</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="number" id="typeText21" class="form-control" required
name="course_id"/>
<label class="form-label" for="typeText21">课程ID</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">
<input type="text" id="typeText23" class="form-control" required
name="classes"/>
<label class="form-label" for="typeText23">授课班级</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 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>
<!-- Modal -->
<div class="modal fade" id="exampleModal3" tabindex="-1" aria-labelledby="exampleModalLabel3"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel3">
Info
</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p id="de_message"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-mdb-dismiss="modal" id="de_button">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>
});
// 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');
// }
// }
</script>
</body>
</html>