up
Signed-off-by: Chenx221 <chenx221@yandex.com>
This commit is contained in:
parent
f4f86db07a
commit
4a4871eccf
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>
|
@ -225,7 +225,7 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
|
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
|
||||||
<select name="sex" id="sex-select">
|
<select name="sex" id="sex-select">
|
||||||
<option value="">请选择性别</option>
|
<option value="null">请选择性别</option>
|
||||||
<option value="male">男</option>
|
<option value="male">男</option>
|
||||||
<option value="female">女</option>
|
<option value="female">女</option>
|
||||||
</select>
|
</select>
|
||||||
@ -273,7 +273,7 @@
|
|||||||
<input type="text" id="typeText8" class="form-control"
|
<input type="text" id="typeText8" class="form-control"
|
||||||
name="classes"/>
|
name="classes"/>
|
||||||
<label class="form-label"
|
<label class="form-label"
|
||||||
for="typeText8">授课班级(一班~五班)</label>
|
for="typeText8">授课班级(1~5班)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -297,7 +297,7 @@
|
|||||||
<div class="form-outline">
|
<div class="form-outline">
|
||||||
<input type="number" id="typeText9" class="form-control" required
|
<input type="number" id="typeText9" class="form-control" required
|
||||||
name="id"/>
|
name="id"/>
|
||||||
<label class="form-label" for="typeText9">教师ID</label>
|
<label class="form-label" for="typeText9">教师ID (必填)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,6 +16,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@ -41,15 +45,14 @@ public class TeacherController {
|
|||||||
|
|
||||||
@PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")
|
@PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")
|
||||||
public String postQuery(@RequestParam(value = "id", defaultValue = "-1", required = false) int id,//教师id
|
public String postQuery(@RequestParam(value = "id", defaultValue = "-1", required = false) int id,//教师id
|
||||||
@RequestParam(value = "name", defaultValue = "null", required = false) String name,//学生姓名
|
@RequestParam(value = "name", defaultValue = "null", required = false) String name,//教师姓名
|
||||||
@RequestParam(value = "coursename", defaultValue = "null", required = false) String course_name,//课程名
|
@RequestParam(value = "sex", defaultValue = "null", required = false) String sex,//性别
|
||||||
@RequestParam(value = "scoreid", defaultValue = "-1", required = false) int score_id,//成绩ID
|
@RequestParam(value = "birthday_begin", defaultValue = "null", required = false) String birthday_begin_str,//日期起始
|
||||||
@RequestParam(value = "studentid", defaultValue = "-1", required = false) int student_id,//学号
|
@RequestParam(value = "birthday_end", defaultValue = "null", required = false) String birthday_end_str,//日期结束
|
||||||
@RequestParam(value = "courseid", defaultValue = "-1", required = false) int course_id,//课程ID
|
@RequestParam(value = "course_id", defaultValue = "-1", required = false) int course_id,//课程ID
|
||||||
@RequestParam(value = "min", defaultValue = "-1", required = false) int min,//最低分
|
@RequestParam(value = "course_name", defaultValue = "null", required = false) String course_name,//课程名
|
||||||
@RequestParam(value = "max", defaultValue = "-1", required = false) int max,//最高分
|
@RequestParam(value = "classes", defaultValue = "null", required = false) String classes,//授课班级
|
||||||
@RequestParam(value = "range_enabler", defaultValue = "false", required = false) boolean range_enabler,//是否启用分数范围
|
Model model) {
|
||||||
Model model) throws IOException {
|
|
||||||
|
|
||||||
//username helper start
|
//username helper start
|
||||||
String username = new UsernameHelper().getCurrentUsername();
|
String username = new UsernameHelper().getCurrentUsername();
|
||||||
@ -58,27 +61,52 @@ public class TeacherController {
|
|||||||
}
|
}
|
||||||
//username helper end
|
//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")) {
|
if (name.equals("null")) {
|
||||||
name = null;
|
name = null;
|
||||||
}
|
}
|
||||||
|
if (sex.equals("null")) {
|
||||||
|
sex = null;
|
||||||
|
}
|
||||||
if (course_name.equals("null")) {
|
if (course_name.equals("null")) {
|
||||||
course_name = null;
|
course_name = null;
|
||||||
}
|
}
|
||||||
// System.out.println("name: " + name + " course_name: " + course_name + " score_id: " + score_id + " student_id: " + student_id + " course_id: " + course_id + " min: " + min + " max: " + max + " range_enabler: " + range_enabler);
|
if (classes.equals("null")) {
|
||||||
if (score_id == -1 && student_id == -1 && course_id == -1 && !range_enabler && course_name == null && name == null) {
|
classes = null;
|
||||||
model.addAttribute("errorMessage", "查询条件不可全为空");
|
|
||||||
return "redirect:/score/infomodv2";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Score> scores;
|
String classesPattern = "[1-5]班";// 使用正则表达式验证班级格式
|
||||||
Score score;
|
|
||||||
|
|
||||||
score = new Score((score_id == -1 ? null : score_id), ((student_id == -1 && name == null) ? null : (new Student((student_id == -1 ? null : student_id), name))), (course_id == -1 && course_name == null) ? null : (new Course((course_id == -1 ? null : course_id), course_name)), range_enabler ? (min == -1 ? null : min) : null, range_enabler ? (max == -1 ? null : max) : null);
|
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);
|
// scores = scoreService.getQueryScores(score);
|
||||||
String download = new CsvHelper().generateScoreCSVFile(scores);
|
// String download = new CsvHelper().generateScoreCSVFile(scores);
|
||||||
model.addAttribute("download", download);
|
// model.addAttribute("download", download);
|
||||||
model.addAttribute("scores", scores);
|
// model.addAttribute("scores", scores);
|
||||||
return "scoreQueryResult";
|
return "scoreQueryResult";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,6 @@ import java.util.List;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface TeacherDao {
|
public interface TeacherDao {
|
||||||
List<Teacher> getAllTeachers();
|
List<Teacher> getAllTeachers();
|
||||||
|
|
||||||
|
List<Teacher> getQueryTeachers(Teacher teacher);
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,9 @@ public class TeacherDaoImpl implements TeacherDao {
|
|||||||
public List<Teacher> getAllTeachers() {
|
public List<Teacher> getAllTeachers() {
|
||||||
return sqlSession.selectList("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 Course course;//课程
|
||||||
private String classes;//班级(目前仅单个班级)
|
private String classes;//班级(目前仅单个班级)
|
||||||
private Integer removed;//移除标志
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -17,4 +17,8 @@ public class TeacherService {
|
|||||||
public List<Teacher> getAllTeachers() {
|
public List<Teacher> getAllTeachers() {
|
||||||
return teacherDao.getAllTeachers();
|
return teacherDao.getAllTeachers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Teacher> getQueryTeachers(Teacher teacher) {
|
||||||
|
return teacherDao.getQueryTeachers(teacher);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,41 @@
|
|||||||
<result property="CourseName" column="CourseName"/>
|
<result property="CourseName" column="CourseName"/>
|
||||||
</association>
|
</association>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="getAllTeachers" resultMap="TeacherResultMap">
|
<select id="getAllTeachers" resultMap="TeacherResultMap">
|
||||||
SELECT id, name, sex, birthday, classes, c.CourseID, c.CourseName
|
SELECT id, name, sex, birthday, classes, c.CourseID, c.CourseName
|
||||||
FROM teacher t
|
FROM teacher t
|
||||||
JOIN course c ON c.CourseID = t.course_id
|
JOIN course c ON c.CourseID = t.course_id
|
||||||
WHERE t.removed = 0;
|
WHERE t.removed = 0;
|
||||||
</select>
|
</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>
|
</mapper>
|
@ -225,7 +225,7 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
|
<label for="sex-select" style="color: rgba(0,0,0,.6);">性别</label>
|
||||||
<select name="sex" id="sex-select">
|
<select name="sex" id="sex-select">
|
||||||
<option value="">请选择性别</option>
|
<option value="null">请选择性别</option>
|
||||||
<option value="male">男</option>
|
<option value="male">男</option>
|
||||||
<option value="female">女</option>
|
<option value="female">女</option>
|
||||||
</select>
|
</select>
|
||||||
@ -273,7 +273,7 @@
|
|||||||
<input type="text" id="typeText8" class="form-control"
|
<input type="text" id="typeText8" class="form-control"
|
||||||
name="classes"/>
|
name="classes"/>
|
||||||
<label class="form-label"
|
<label class="form-label"
|
||||||
for="typeText8">授课班级(一班~五班)</label>
|
for="typeText8">授课班级(1~5班)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -297,7 +297,7 @@
|
|||||||
<div class="form-outline">
|
<div class="form-outline">
|
||||||
<input type="number" id="typeText9" class="form-control" required
|
<input type="number" id="typeText9" class="form-control" required
|
||||||
name="id"/>
|
name="id"/>
|
||||||
<label class="form-label" for="typeText9">教师ID</label>
|
<label class="form-label" for="typeText9">教师ID (必填)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user