parent
9762f91c3c
commit
b70a430f5f
@ -0,0 +1,178 @@
|
||||
package cn.ppdxzz.controller;
|
||||
|
||||
import cn.ppdxzz.domain.Student;
|
||||
import cn.ppdxzz.service.StudentService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
*
|
||||
* @Date: 2020/2/17 14:17
|
||||
* @Author: PeiChen
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/student")
|
||||
public class StudentController {
|
||||
|
||||
private StudentService studentService;
|
||||
@Autowired
|
||||
public void setStudentService(StudentService studentService) {
|
||||
this.studentService = studentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有学生信息
|
||||
* @param page
|
||||
* @param size
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/findAll")
|
||||
public ModelAndView findAll(@RequestParam(name = "page", required = true, defaultValue = "1") int page, @RequestParam(name = "size", required = true, defaultValue = "4") int size, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
ModelAndView mv = new ModelAndView();
|
||||
List<Student> list = null;
|
||||
String keyword = request.getParameter("keyword");
|
||||
if (keyword == null || keyword.trim().equals("") || keyword.length() == 0) {
|
||||
list = studentService.findAll(page, size);
|
||||
}else {
|
||||
list = studentService.search(page,size,keyword);
|
||||
}
|
||||
//PageInfo就是一个封装了分页数据的bean
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
mv.addObject("pageInfo",pageInfo);
|
||||
mv.setViewName("student-list");
|
||||
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学号删除学生
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public void delete(HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
response.setCharacterEncoding("utf-8");
|
||||
PrintWriter writer = response.getWriter();
|
||||
String sno = request.getParameter("sno");
|
||||
if (sno == null || "".equals(sno) || sno.length() == 0) {
|
||||
writer.write("false");
|
||||
return;
|
||||
}
|
||||
studentService.delete(sno);
|
||||
writer.write("true");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指定学号是否存在
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/isExist")
|
||||
public void isSnoExist(HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
PrintWriter writer = response.getWriter();
|
||||
String sno = request.getParameter("sno");
|
||||
Student isExist = studentService.findBySno(sno);
|
||||
if (isExist == null) {
|
||||
return;
|
||||
}
|
||||
//如果isExist不为空说明学号已被注册
|
||||
writer.write("true");
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/addStudent")
|
||||
public String addStudent() {
|
||||
return "student-add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加学生信息
|
||||
* @param student
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public void add(Student student,HttpServletResponse response) throws Exception {
|
||||
PrintWriter writer = response.getWriter();
|
||||
if (student == null || studentService.findBySno(student.getSno()) != null) {
|
||||
writer.write("false");
|
||||
return;
|
||||
}
|
||||
boolean isAdd = studentService.add(student);
|
||||
if (isAdd) {
|
||||
writer.write("true");
|
||||
}else {
|
||||
writer.write("false");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生信息
|
||||
* @param student
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public void update(Student student,HttpServletResponse response) throws Exception {
|
||||
response.setCharacterEncoding("utf-8");
|
||||
PrintWriter writer = response.getWriter();
|
||||
if (student == null || student.getId() == null) {
|
||||
return;
|
||||
}
|
||||
if (student.getName() == null || "".equals(student.getName()) || student.getName().length() == 0
|
||||
|| student.getSex() == null || student.getSex().length() == 0 || "".equals(student.getSex())
|
||||
|| student.getSno() == null || "".equals(student.getSno()) || student.getSno().length() == 0
|
||||
|| student.getPhone() == null || "".equals(student.getPhone()) || student.getPhone().length() == 0
|
||||
|| student.getStu_class() == null || "".equals(student.getStu_class()) || student.getStu_class().length() == 0
|
||||
|| student.getPlace() == null || "".equals(student.getPlace()) || student.getPlace().length() == 0
|
||||
|| student.getDorm_id() == null || "".equals(student.getDorm_id()) || student.getDorm_id().length() == 0
|
||||
|| student.getTeacher() == null || "".equals(student.getTeacher()) || student.getTeacher().length() == 0 ) {
|
||||
return;
|
||||
}
|
||||
studentService.update(student);
|
||||
writer.write("true");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学生数据为Excel
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
public void export(HttpServletResponse response) throws Exception {
|
||||
InputStream is = studentService.getInputStream();
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setHeader("contentDisposition", "attachment;filename=studentsInfo.xls");
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
IOUtils.copy(is,outputStream);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.ppdxzz.dao;
|
||||
|
||||
import cn.ppdxzz.domain.Student;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:学生类的持久层
|
||||
*
|
||||
* @Date: 2020/2/17 14:19
|
||||
* @Author: PeiChen
|
||||
*/
|
||||
@Repository
|
||||
public interface StudentDao {
|
||||
|
||||
/**
|
||||
* 查询所有学生信息
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Select("select * from students")
|
||||
List<Student> findAll() throws Exception;
|
||||
|
||||
/**
|
||||
* 通过学号sno查询学生信息
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Select("select * from students where sno = #{sno}")
|
||||
Student findBySno(String sno) throws Exception;
|
||||
|
||||
/**
|
||||
* 模糊查询学生信息
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Select("select * from students where name like '%${keyword}%' or sex like '%${keyword}%' or sno like '%${keyword}%' or stu_class like '%${keyword}%' or phone like '%${keyword}%' or place like '%${keyword}%' or dorm_id like '%${keyword}%' or teacher like '%${keyword}%' ")
|
||||
List<Student> search(@Param(value = "keyword") String keyword) throws Exception;
|
||||
|
||||
/**
|
||||
* 添加学生信息
|
||||
* @param student
|
||||
* @throws Exception
|
||||
*/
|
||||
@Insert("insert into students(name, sex, sno, stu_class, phone, place, dorm_id, teacher) values(#{name},#{sex},#{sno},#{stu_class},#{phone},#{place},#{dorm_id},#{teacher})")
|
||||
void add(Student student) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据id删除学生
|
||||
* @param sno
|
||||
* @throws Exception
|
||||
*/
|
||||
@Delete("delete from students where sno = #{sno}")
|
||||
void delete(String sno) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改学生信息
|
||||
* @param student
|
||||
* @throws Exception
|
||||
*/
|
||||
@Update("update students set name = #{name},sex = #{sex},sno = #{sno},stu_class = #{stu_class},phone = #{phone},place = #{place},dorm_id = #{dorm_id},teacher = #{teacher} where id = #{id}")
|
||||
void update(Student student) throws Exception;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package cn.ppdxzz.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
*
|
||||
* @Date: 2020/2/17 14:08
|
||||
* @Author: PeiChen
|
||||
*/
|
||||
public class Student implements Serializable {
|
||||
private Integer id;
|
||||
private String name;//姓名
|
||||
private String sex;//性别
|
||||
private String sno;//学号
|
||||
private String stu_class;//班级
|
||||
private String phone;//联系方式
|
||||
private String place;//家庭住址
|
||||
private String dorm_id;//宿舍号
|
||||
private String teacher;//育人导师
|
||||
|
||||
public Student() {
|
||||
}
|
||||
|
||||
public Student(Integer id, String name, String sex, String sno, String stu_class, String phone, String place, String dorm_id, String teacher) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.sex = sex;
|
||||
this.sno = sno;
|
||||
this.stu_class = stu_class;
|
||||
this.phone = phone;
|
||||
this.place = place;
|
||||
this.dorm_id = dorm_id;
|
||||
this.teacher = teacher;
|
||||
}
|
||||
|
||||
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 String getSno() {
|
||||
return sno;
|
||||
}
|
||||
|
||||
public void setSno(String sno) {
|
||||
this.sno = sno;
|
||||
}
|
||||
|
||||
public String getStu_class() {
|
||||
return stu_class;
|
||||
}
|
||||
|
||||
public void setStu_class(String stu_class) {
|
||||
this.stu_class = stu_class;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setPlace(String place) {
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public String getDorm_id() {
|
||||
return dorm_id;
|
||||
}
|
||||
|
||||
public void setDorm_id(String dorm_id) {
|
||||
this.dorm_id = dorm_id;
|
||||
}
|
||||
|
||||
public String getTeacher() {
|
||||
return teacher;
|
||||
}
|
||||
|
||||
public void setTeacher(String teacher) {
|
||||
this.teacher = teacher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Student{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", sex='" + sex + '\'' +
|
||||
", sno='" + sno + '\'' +
|
||||
", stu_class='" + stu_class + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", place='" + place + '\'' +
|
||||
", dorm_id='" + dorm_id + '\'' +
|
||||
", teacher='" + teacher + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.ppdxzz.service;
|
||||
|
||||
import cn.ppdxzz.domain.Student;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:学生业务层
|
||||
*
|
||||
* @Date: 2020/2/17 14:21
|
||||
* @Author: PeiChen
|
||||
*/
|
||||
public interface StudentService {
|
||||
|
||||
List<Student> findAll(int page,int size) throws Exception;
|
||||
|
||||
Student findBySno(String sno) throws Exception;
|
||||
|
||||
List<Student> search(int page, int size, String keyword) throws Exception;
|
||||
|
||||
boolean add(Student student) throws Exception;
|
||||
|
||||
void delete(String sno) throws Exception;
|
||||
|
||||
void update(Student student) throws Exception;
|
||||
|
||||
//返回一个携带所有学生信息数据的InputStream输入流
|
||||
InputStream getInputStream() throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: user
|
||||
Date: 2020/2/17
|
||||
Time: 12:33
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/layer/layer.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<table class="table" style="width: 100%;text-align: center;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">姓名</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" id="name" name="name" maxlength="10" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="sex">性别</label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" name="sex" id="sex">
|
||||
<option value="男" selected>男</option>
|
||||
<option value="女">女</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="sno">学号</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="sno" class="form-control" id="sno" aria-describedby="textHelp" maxlength="20" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="stu_class">班级</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="stu_class" class="form-control" id="stu_class" maxlength="30" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="phone">联系方式</label></td>
|
||||
<td>
|
||||
<input type="text" name="phone" class="form-control" id="phone" minlength="11" maxlength="11" required>
|
||||
</td>
|
||||
<td><label for="place">家庭住址</label></td>
|
||||
<td>
|
||||
<input type="text" placeholder="请输入家庭详细地址" name="place" class="form-control" id="place" maxlength="30" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="dorm1">宿舍号</label></td>
|
||||
<td>
|
||||
<select class="form-control" name="dorm1" id="dorm1">
|
||||
<option value="西六" selected>西六</option>
|
||||
<option value="西七">西七</option>
|
||||
<option value="西十二">西十二</option>
|
||||
<option value="西十三">西十三</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><select class="form-control" name="dorm2" id="dorm2">
|
||||
<option value="A" selected>A</option>
|
||||
<option value="B">B</option>
|
||||
</select></td>
|
||||
<td>
|
||||
<input type="text" name="dorm3" placeholder="请直接输入宿舍号" maxlength="3" class="form-control" id="dorm3" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="teacher">育人导师</label></td>
|
||||
<td colspan="3">
|
||||
<select class="form-control" name="teacher" id="teacher">
|
||||
<option value="小李" selected>小李</option>
|
||||
<option value="小王">小王</option>
|
||||
<option value="小赵">小赵</option>
|
||||
<option value="小飞">小飞</option>
|
||||
<option value="小张">小张</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" id="add-student" class="btn btn-primary">确认修改</button>
|
||||
<a type="button" href="${pageContext.request.contextPath}/student/findAll" class="btn btn-default">返回列表</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<script>
|
||||
$("#add-student").click(function () {
|
||||
var name = $("#name").val().trim();
|
||||
var sex = $("#sex").val().trim();
|
||||
var sno = $("#sno").val().trim();
|
||||
var stu_class = $("#stu_class").val().trim();
|
||||
var phone = $("#phone").val().trim();
|
||||
var place = $("#place").val().trim();
|
||||
var dorm3 = $("#dorm3").val().trim();
|
||||
var teacher = $("#teacher").val().trim();
|
||||
|
||||
if (name == 0 || sex == 0 || sno == 0 || stu_class == 0 || phone == 0 || place == 0 || dorm3 == 0 || teacher == 0) {
|
||||
layer.msg('字段不能为空');
|
||||
return false;
|
||||
}
|
||||
var d1 = $("#dorm1").val();
|
||||
var d2 = $("#dorm2").val();
|
||||
var dorm_id = d1+""+d2+""+dorm3;
|
||||
alert(dorm_id);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,81 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: user
|
||||
Date: 2020/2/17
|
||||
Time: 12:34
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<table class="table" style="width: 100%;text-align: center;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">姓名</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" readonly class="form-control" value="peichen" id="name" name="name" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="sex">性别</label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" name="sex" id="sex">
|
||||
<option value="男" selected>男</option>
|
||||
<option value="女">女</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="sno">学号</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="sno" class="form-control" id="sno" aria-describedby="textHelp" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="class">班级</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="class" class="form-control" id="class" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="phone">联系方式</label></td>
|
||||
<td>
|
||||
<input type="text" name="phone" class="form-control" id="phone" required>
|
||||
</td>
|
||||
<td><label for="place">家庭住址</label></td>
|
||||
<td>
|
||||
<input type="text" name="place" class="form-control" id="place" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="dorm_id">宿舍号</label></td>
|
||||
<td>
|
||||
<input type="text" name="dorm_id" class="form-control" id="dorm_id" required>
|
||||
</td>
|
||||
<td><label for="teacher">育人导师</label></td>
|
||||
<td>
|
||||
<input type="text" name="teacher" class="form-control" id="teacher" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" id="addAdmin" class="btn btn-primary">确认修改</button>
|
||||
<a type="button" class="btn btn-default">返回列表</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,226 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: user
|
||||
Date: 2020/2/10
|
||||
Time: 21:45
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<html class="x-admin-sm">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/font.css">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/xadmin.css">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/xadmin.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script>
|
||||
function changePageSize() {
|
||||
//获取下拉框的值
|
||||
var pageSize = $("#changePageSize").val();
|
||||
//向服务器发送请求,改变每页显示条数
|
||||
location.href = "${pageContext.request.contextPath}/student/findAll?page=1&size="+ pageSize;
|
||||
}
|
||||
$("#serarch_btn").click(function () {
|
||||
var keyword = $("#keyword").val();
|
||||
location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=4&keyword="+keyword;
|
||||
});
|
||||
$("#refresh").click(function () {
|
||||
$("#myform").reset();
|
||||
location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=4";
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<%--<div class="x-nav">
|
||||
<span class="layui-breadcrumb">
|
||||
<a href="">首页</a>
|
||||
<a href="">演示</a>
|
||||
<a>
|
||||
<cite>导航元素</cite></a>
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
|
||||
<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
|
||||
</div>--%>
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body ">
|
||||
<form id="myform" class="layui-form layui-col-space5">
|
||||
<div class="layui-inline layui-show-xs-block">
|
||||
<input class="layui-input" type="text" autocomplete="off" placeholder="请输入关键字" name="keyword" id="keyword" value="${param.keyword}">
|
||||
</div>
|
||||
<div class="layui-inline layui-show-xs-block">
|
||||
<button class="layui-btn" id="serarch_btn" lay-submit="" lay-filter="sreach"><i class="layui-icon"></i></button>
|
||||
</div>
|
||||
<div class="layui-inline layui-show-xs-block x-right">
|
||||
<a class="layui-btn layui-btn-normal" href="${pageContext.request.contextPath}/student/findAll?page=1&size=4"><i class="layui-icon"></i></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<xblock>
|
||||
<c:if test="${sessionScope.adminInfo.power > 1 }">
|
||||
<a onclick="exportInfo()" class="layui-btn layui-btn-warm" href="javascript:;"><i class="layui-icon"></i>导出</a>
|
||||
</c:if>
|
||||
<span class="x-right" style="line-height:40px">共有数据:${pageInfo.total} 条</span>
|
||||
</xblock>
|
||||
<div class="layui-card-body">
|
||||
<table class="layui-table layui-form">
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th style="text-align: center">ID</th>
|
||||
<th style="text-align: center">姓名</th>
|
||||
<th style="text-align: center">性别</th>
|
||||
<th style="text-align: center">学号</th>
|
||||
<th style="text-align: center">班级</th>
|
||||
<th style="text-align: center">联系方式</th>
|
||||
<th style="text-align: center">家庭住址</th>
|
||||
<th style="text-align: center">宿舍号</th>
|
||||
<th style="text-align: center">育人导师</th>
|
||||
<c:if test="${sessionScope.adminInfo.power > 1}">
|
||||
<th style="text-align: center">操作</th>
|
||||
</c:if>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
int j = 1;
|
||||
%>
|
||||
<c:forEach items="${pageInfo.list}" var="student">
|
||||
<tr id="light" style="text-align: center">
|
||||
<td><%=j++%></td>
|
||||
<td>${student.name}</td>
|
||||
<td>${student.sex}</td>
|
||||
<td>${student.sno}</td>
|
||||
<td>${student.stu_class}</td>
|
||||
<td>${student.phone}</td>
|
||||
<td>${student.place}</td>
|
||||
<td>${student.dorm_id}</td>
|
||||
<td>${student.teacher}</td>
|
||||
<c:if test="${sessionScope.adminInfo.power > 1}">
|
||||
<td class="td-manage">
|
||||
<a title="编辑" href="${pageContext.request.contextPath}">
|
||||
<i class="layui-icon"></i>
|
||||
</a>
|
||||
<a title="注册" onclick="" href="${pageContext.request.contextPath}/student/addStudent">
|
||||
<i class="layui-icon"></i>
|
||||
</a>
|
||||
<a title="删除" onclick="member_del(this,${student.sno},${sessionScope.adminInfo.power})" href="javascript:;">
|
||||
<i class="layui-icon"></i>
|
||||
</a>
|
||||
</td>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<div class="form-group form-inline">
|
||||
共 ${pageInfo.pages} 页 当前页:${pageInfo.pageNum} / ${pageInfo.pages}  每页
|
||||
<select class="form-control" id="changePageSize" onchange="changePageSize()">
|
||||
<option value="1">${pageInfo.size}</option>
|
||||
<option value="2">2</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="15">15</option>
|
||||
<option value="20">20</option>
|
||||
</select> 条
|
||||
</div>
|
||||
</div>
|
||||
<c:choose>
|
||||
<c:when test="${pageInfo.pages < 5}">
|
||||
<c:set var="begin" value="1">
|
||||
</c:set>
|
||||
<c:set var="end" value="${pageInfo.pages}">
|
||||
</c:set>
|
||||
</c:when>
|
||||
<c:when test="${pageInfo.pageNum <= 3}">
|
||||
<c:set var="begin" value="1">
|
||||
</c:set>
|
||||
<c:set var="end" value="5">
|
||||
</c:set>
|
||||
</c:when>
|
||||
<c:when test="${pageInfo.pageNum > 3 and pageInfo.pageNum <= pageInfo.pages-2}">
|
||||
<c:set var="begin" value="${pageInfo.pageNum - 2}">
|
||||
</c:set>
|
||||
<c:set var="end" value="${pageInfo.pageNum + 2}">
|
||||
</c:set>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<c:set var="begin" value="${pageInfo.pages - 4}">
|
||||
</c:set>
|
||||
<c:set var="end" value="${pageInfo.pages}">
|
||||
</c:set>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="layui-card-body x-right" style="height: min-content">
|
||||
<div class="page">
|
||||
<div>
|
||||
<a class="next" href="${pageContext.request.contextPath}/student/findAll?page=1&size=${pageInfo.pageSize}&keyword=${param.keyword}">首页</a>
|
||||
<c:if test="${pageInfo.pageNum > 1}">
|
||||
<a class="prev" href="${pageContext.request.contextPath}/student/findAll?page=${pageInfo.pageNum-1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">上一页</a>
|
||||
</c:if>
|
||||
<c:forEach var="i" begin="${begin}" end="${end}" step="1">
|
||||
<c:if test="${pageInfo.pageNum == i}">
|
||||
<span class="current">${i}</span>
|
||||
</c:if>
|
||||
<c:if test="${pageInfo.pageNum != i}">
|
||||
<a class="num" href="${pageContext.request.contextPath}/student/findAll?page=${i}&size=${pageInfo.pageSize}&keyword=${param.keyword}">${i}</a>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<c:if test="${pageInfo.pageNum < pageInfo.pages}">
|
||||
<a class="next" href="${pageContext.request.contextPath}/student/findAll?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">下一页</a>
|
||||
</c:if>
|
||||
<a class="next" href="${pageContext.request.contextPath}/student/findAll?page=${pageInfo.pages}&size=${pageInfo.pageSize}&keyword=${param.keyword}">尾页</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//删除操作
|
||||
function member_del(obj,sno,power){
|
||||
layer.confirm('确认要删除吗?',function(index){
|
||||
if (power < 1){
|
||||
layer.msg('对不起,您没有权限!');
|
||||
return false;
|
||||
}
|
||||
//发异步删除数据
|
||||
$.get("${pageContext.request.contextPath}/student/delete",{"sno":sno},function (data) {
|
||||
if(data){
|
||||
layer.msg('删除成功!',{icon:1,time:2000});
|
||||
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/student/findAll?page=1&size=4';},2000);
|
||||
|
||||
}else {
|
||||
layer.msg('删除失败!',{icon:1,time:2000});
|
||||
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/student/findAll?page=1&size=4';},2000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//导出Excel操作
|
||||
function exportInfo() {
|
||||
layer.confirm('确定导出所有学生数据吗?',function (index) {
|
||||
location.href="${pageContext.request.contextPath}/student/export";
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
/* your styles go here */
|
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,118 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: user
|
||||
Date: 2020/2/17
|
||||
Time: 12:33
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/layer/layer.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<table class="table" style="width: 100%;text-align: center;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">姓名</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" id="name" name="name" maxlength="10" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="sex">性别</label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" name="sex" id="sex">
|
||||
<option value="男" selected>男</option>
|
||||
<option value="女">女</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="sno">学号</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="sno" class="form-control" id="sno" aria-describedby="textHelp" maxlength="20" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="stu_class">班级</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="stu_class" class="form-control" id="stu_class" maxlength="30" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="phone">联系方式</label></td>
|
||||
<td>
|
||||
<input type="text" name="phone" class="form-control" id="phone" minlength="11" maxlength="11" required>
|
||||
</td>
|
||||
<td><label for="place">家庭住址</label></td>
|
||||
<td>
|
||||
<input type="text" placeholder="请输入家庭详细地址" name="place" class="form-control" id="place" maxlength="30" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="dorm1">宿舍号</label></td>
|
||||
<td>
|
||||
<select class="form-control" name="dorm1" id="dorm1">
|
||||
<option value="西六" selected>西六</option>
|
||||
<option value="西七">西七</option>
|
||||
<option value="西十二">西十二</option>
|
||||
<option value="西十三">西十三</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><select class="form-control" name="dorm2" id="dorm2">
|
||||
<option value="A" selected>A</option>
|
||||
<option value="B">B</option>
|
||||
</select></td>
|
||||
<td>
|
||||
<input type="text" name="dorm3" placeholder="请直接输入宿舍号" maxlength="3" class="form-control" id="dorm3" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="teacher">育人导师</label></td>
|
||||
<td colspan="3">
|
||||
<select class="form-control" name="teacher" id="teacher">
|
||||
<option value="小李" selected>小李</option>
|
||||
<option value="小王">小王</option>
|
||||
<option value="小赵">小赵</option>
|
||||
<option value="小飞">小飞</option>
|
||||
<option value="小张">小张</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" id="add-student" class="btn btn-primary">确认修改</button>
|
||||
<a type="button" href="${pageContext.request.contextPath}/student/findAll" class="btn btn-default">返回列表</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<script>
|
||||
$("#add-student").click(function () {
|
||||
if ($("#name").val().trim() == 0 || $("#sex").val().trim() == 0 || $("#sno").val().trim() == 0
|
||||
|| $("#stu_class").val().trim() == 0 || $("#phone").val().trim() == 0 || $("#place").val().trim() == 0
|
||||
|| $("#dorm3").val().trim() == 0 || $("#teacher").val().trim() == 0) {
|
||||
layer.msg('字段不能为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
var d1 = $("#dorm1").val();
|
||||
var d2 = $("#dorm2").val();
|
||||
var d3 = $("#dorm3").val().trim();
|
||||
var dorm_id = d1+""+d2+""+d3;
|
||||
alert(dorm_id);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,81 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: user
|
||||
Date: 2020/2/17
|
||||
Time: 12:34
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<table class="table" style="width: 100%;text-align: center;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">姓名</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" readonly class="form-control" value="peichen" id="name" name="name" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="sex">性别</label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" name="sex" id="sex">
|
||||
<option value="男" selected>男</option>
|
||||
<option value="女">女</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="sno">学号</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="sno" class="form-control" id="sno" aria-describedby="textHelp" required>
|
||||
</td>
|
||||
<td>
|
||||
<label for="class">班级</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="class" class="form-control" id="class" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="phone">联系方式</label></td>
|
||||
<td>
|
||||
<input type="text" name="phone" class="form-control" id="phone" required>
|
||||
</td>
|
||||
<td><label for="place">家庭住址</label></td>
|
||||
<td>
|
||||
<input type="text" name="place" class="form-control" id="place" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="dorm_id">宿舍号</label></td>
|
||||
<td>
|
||||
<input type="text" name="dorm_id" class="form-control" id="dorm_id" required>
|
||||
</td>
|
||||
<td><label for="teacher">育人导师</label></td>
|
||||
<td>
|
||||
<input type="text" name="teacher" class="form-control" id="teacher" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" id="addAdmin" class="btn btn-primary">确认修改</button>
|
||||
<a type="button" class="btn btn-default">返回列表</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,226 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: user
|
||||
Date: 2020/2/10
|
||||
Time: 21:45
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<html class="x-admin-sm">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/font.css">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/xadmin.css">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/xadmin.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script>
|
||||
function changePageSize() {
|
||||
//获取下拉框的值
|
||||
var pageSize = $("#changePageSize").val();
|
||||
//向服务器发送请求,改变每页显示条数
|
||||
location.href = "${pageContext.request.contextPath}/student/findAll?page=1&size="+ pageSize;
|
||||
}
|
||||
$("#serarch_btn").click(function () {
|
||||
var keyword = $("#keyword").val();
|
||||
location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=4&keyword="+keyword;
|
||||
});
|
||||
$("#refresh").click(function () {
|
||||
$("#myform").reset();
|
||||
location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=4";
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<%--<div class="x-nav">
|
||||
<span class="layui-breadcrumb">
|
||||
<a href="">首页</a>
|
||||
<a href="">演示</a>
|
||||
<a>
|
||||
<cite>导航元素</cite></a>
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
|
||||
<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
|
||||
</div>--%>
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body ">
|
||||
<form id="myform" class="layui-form layui-col-space5">
|
||||
<div class="layui-inline layui-show-xs-block">
|
||||
<input class="layui-input" type="text" autocomplete="off" placeholder="请输入关键字" name="keyword" id="keyword" value="${param.keyword}">
|
||||
</div>
|
||||
<div class="layui-inline layui-show-xs-block">
|
||||
<button class="layui-btn" id="serarch_btn" lay-submit="" lay-filter="sreach"><i class="layui-icon"></i></button>
|
||||
</div>
|
||||
<div class="layui-inline layui-show-xs-block x-right">
|
||||
<a class="layui-btn layui-btn-normal" href="${pageContext.request.contextPath}/student/findAll?page=1&size=4"><i class="layui-icon"></i></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<xblock>
|
||||
<c:if test="${sessionScope.adminInfo.power > 1 }">
|
||||
<a onclick="exportInfo()" class="layui-btn layui-btn-warm" href="javascript:;"><i class="layui-icon"></i>导出</a>
|
||||
</c:if>
|
||||
<span class="x-right" style="line-height:40px">共有数据:${pageInfo.total} 条</span>
|
||||
</xblock>
|
||||
<div class="layui-card-body">
|
||||
<table class="layui-table layui-form">
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th style="text-align: center">ID</th>
|
||||
<th style="text-align: center">姓名</th>
|
||||
<th style="text-align: center">性别</th>
|
||||
<th style="text-align: center">学号</th>
|
||||
<th style="text-align: center">班级</th>
|
||||
<th style="text-align: center">联系方式</th>
|
||||
<th style="text-align: center">家庭住址</th>
|
||||
<th style="text-align: center">宿舍号</th>
|
||||
<th style="text-align: center">育人导师</th>
|
||||
<c:if test="${sessionScope.adminInfo.power > 1}">
|
||||
<th style="text-align: center">操作</th>
|
||||
</c:if>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
int j = 1;
|
||||
%>
|
||||
<c:forEach items="${pageInfo.list}" var="student">
|
||||
<tr id="light" style="text-align: center">
|
||||
<td><%=j++%></td>
|
||||
<td>${student.name}</td>
|
||||
<td>${student.sex}</td>
|
||||
<td>${student.sno}</td>
|
||||
<td>${student.stu_class}</td>
|
||||
<td>${student.phone}</td>
|
||||
<td>${student.place}</td>
|
||||
<td>${student.dorm_id}</td>
|
||||
<td>${student.teacher}</td>
|
||||
<c:if test="${sessionScope.adminInfo.power > 1}">
|
||||
<td class="td-manage">
|
||||
<a title="编辑" href="${pageContext.request.contextPath}">
|
||||
<i class="layui-icon"></i>
|
||||
</a>
|
||||
<a title="注册" onclick="" href="${pageContext.request.contextPath}/student/addStudent">
|
||||
<i class="layui-icon"></i>
|
||||
</a>
|
||||
<a title="删除" onclick="member_del(this,${student.sno},${sessionScope.adminInfo.power})" href="javascript:;">
|
||||
<i class="layui-icon"></i>
|
||||
</a>
|
||||
</td>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<div class="form-group form-inline">
|
||||
共 ${pageInfo.pages} 页 当前页:${pageInfo.pageNum} / ${pageInfo.pages}  每页
|
||||
<select class="form-control" id="changePageSize" onchange="changePageSize()">
|
||||
<option value="1">${pageInfo.size}</option>
|
||||
<option value="2">2</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="15">15</option>
|
||||
<option value="20">20</option>
|
||||
</select> 条
|
||||
</div>
|
||||
</div>
|
||||
<c:choose>
|
||||
<c:when test="${pageInfo.pages < 5}">
|
||||
<c:set var="begin" value="1">
|
||||
</c:set>
|
||||
<c:set var="end" value="${pageInfo.pages}">
|
||||
</c:set>
|
||||
</c:when>
|
||||
<c:when test="${pageInfo.pageNum <= 3}">
|
||||
<c:set var="begin" value="1">
|
||||
</c:set>
|
||||
<c:set var="end" value="5">
|
||||
</c:set>
|
||||
</c:when>
|
||||
<c:when test="${pageInfo.pageNum > 3 and pageInfo.pageNum <= pageInfo.pages-2}">
|
||||
<c:set var="begin" value="${pageInfo.pageNum - 2}">
|
||||
</c:set>
|
||||
<c:set var="end" value="${pageInfo.pageNum + 2}">
|
||||
</c:set>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<c:set var="begin" value="${pageInfo.pages - 4}">
|
||||
</c:set>
|
||||
<c:set var="end" value="${pageInfo.pages}">
|
||||
</c:set>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="layui-card-body x-right" style="height: min-content">
|
||||
<div class="page">
|
||||
<div>
|
||||
<a class="next" href="${pageContext.request.contextPath}/student/findAll?page=1&size=${pageInfo.pageSize}&keyword=${param.keyword}">首页</a>
|
||||
<c:if test="${pageInfo.pageNum > 1}">
|
||||
<a class="prev" href="${pageContext.request.contextPath}/student/findAll?page=${pageInfo.pageNum-1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">上一页</a>
|
||||
</c:if>
|
||||
<c:forEach var="i" begin="${begin}" end="${end}" step="1">
|
||||
<c:if test="${pageInfo.pageNum == i}">
|
||||
<span class="current">${i}</span>
|
||||
</c:if>
|
||||
<c:if test="${pageInfo.pageNum != i}">
|
||||
<a class="num" href="${pageContext.request.contextPath}/student/findAll?page=${i}&size=${pageInfo.pageSize}&keyword=${param.keyword}">${i}</a>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<c:if test="${pageInfo.pageNum < pageInfo.pages}">
|
||||
<a class="next" href="${pageContext.request.contextPath}/student/findAll?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">下一页</a>
|
||||
</c:if>
|
||||
<a class="next" href="${pageContext.request.contextPath}/student/findAll?page=${pageInfo.pages}&size=${pageInfo.pageSize}&keyword=${param.keyword}">尾页</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//删除操作
|
||||
function member_del(obj,sno,power){
|
||||
layer.confirm('确认要删除吗?',function(index){
|
||||
if (power < 1){
|
||||
layer.msg('对不起,您没有权限!');
|
||||
return false;
|
||||
}
|
||||
//发异步删除数据
|
||||
$.get("${pageContext.request.contextPath}/student/delete",{"sno":sno},function (data) {
|
||||
if(data){
|
||||
layer.msg('删除成功!',{icon:1,time:2000});
|
||||
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/student/findAll?page=1&size=4';},2000);
|
||||
|
||||
}else {
|
||||
layer.msg('删除失败!',{icon:1,time:2000});
|
||||
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/student/findAll?page=1&size=4';},2000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//导出Excel操作
|
||||
function exportInfo() {
|
||||
layer.confirm('确定导出所有学生数据吗?',function (index) {
|
||||
location.href="${pageContext.request.contextPath}/student/export";
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
/* your styles go here */
|
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in new issue