parent
ce94ca27b4
commit
32642d49d9
Binary file not shown.
@ -0,0 +1,197 @@
|
|||||||
|
package cn.ppdxzz.controller;
|
||||||
|
|
||||||
|
import cn.ppdxzz.domain.Dorm;
|
||||||
|
import cn.ppdxzz.service.DormService;
|
||||||
|
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.io.UnsupportedEncodingException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
*
|
||||||
|
* @Date: 2020/2/19 21:01
|
||||||
|
* @Author: PeiChen
|
||||||
|
*/
|
||||||
|
@RequestMapping("/dorm")
|
||||||
|
@Controller
|
||||||
|
public class DormController {
|
||||||
|
|
||||||
|
private DormService dormService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setDormService(DormService dormService) {
|
||||||
|
this.dormService = dormService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有宿舍信息
|
||||||
|
* @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<Dorm> dorms = null;
|
||||||
|
String keyword = request.getParameter("keyword");
|
||||||
|
if (keyword == null || "".trim().equals(keyword)) {
|
||||||
|
dorms = dormService.findAll(page,size);
|
||||||
|
}else {
|
||||||
|
dorms = dormService.search(page,size,keyword);
|
||||||
|
}
|
||||||
|
PageInfo pageInfo = new PageInfo(dorms);
|
||||||
|
mv.addObject("pageInfo",pageInfo);
|
||||||
|
mv.setViewName("dorm-list");
|
||||||
|
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转发到宿舍添加页面
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/toAdd")
|
||||||
|
public String addDorm() throws Exception {
|
||||||
|
return "dorm-add";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 添加宿舍
|
||||||
|
* @param dorm
|
||||||
|
* @param response
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/add")
|
||||||
|
public void add(Dorm dorm,HttpServletResponse response) throws Exception {
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
PrintWriter writer = response.getWriter();
|
||||||
|
if (dorm == null || dorm.getDorm_id() == null || dorm.getDorm_intro() == null || dorm.getDorm_rps() == null
|
||||||
|
|| dorm.getDorm_leader() == null || dorm.getTeacher() == null) {
|
||||||
|
writer.write("false");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Dorm isNull = dormService.findByDormId(dorm.getDorm_id());
|
||||||
|
if (isNull != null) {
|
||||||
|
writer.write("false");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dormService.add(dorm);
|
||||||
|
writer.write("true");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过宿舍号判断该宿舍是否存在,存在返回true
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/isExist")
|
||||||
|
public void isExist(HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
PrintWriter writer = response.getWriter();
|
||||||
|
String dorm_id = request.getParameter("dorm_id");
|
||||||
|
Dorm isNull = dormService.findByDormId(dorm_id);
|
||||||
|
if (isNull == null) {
|
||||||
|
writer.write("true");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询宿舍信息用以修改宿舍信息操作之前的信息回显
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/toUpdate")
|
||||||
|
public ModelAndView toUpdate(HttpServletRequest request) throws Exception {
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
ModelAndView mv = new ModelAndView();
|
||||||
|
String id = request.getParameter("id");
|
||||||
|
if (id == null) {
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
Dorm dorm = dormService.findById(id);
|
||||||
|
mv.addObject("dorm",dorm);
|
||||||
|
mv.setViewName("dorm-edit");
|
||||||
|
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改宿舍信息
|
||||||
|
* @param dorm
|
||||||
|
* @param response
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/update")
|
||||||
|
public void update(Dorm dorm,HttpServletResponse response) throws Exception {
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
PrintWriter writer = response.getWriter();
|
||||||
|
if (dorm == null ||dorm.getId() == null || dorm.getDorm_id() == null || dorm.getDorm_intro() == null || dorm.getDorm_rps() == null
|
||||||
|
|| dorm.getDorm_leader() == null || dorm.getTeacher() == null) {
|
||||||
|
writer.write("false");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dormService.update(dorm);
|
||||||
|
writer.write("true");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出宿舍信息
|
||||||
|
* @param response
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/export")
|
||||||
|
public void export(HttpServletResponse response) throws Exception {
|
||||||
|
InputStream is = dormService.getInputStream();
|
||||||
|
response.setContentType("application/vnd.ms-excel");
|
||||||
|
response.setHeader("contentDisposition","attachment;filename=dormInfo.xls");
|
||||||
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
|
IOUtils.copy(is,outputStream);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转发到详情页
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@RequestMapping("/look")
|
||||||
|
public ModelAndView look(HttpServletRequest request) throws Exception {
|
||||||
|
String id = request.getParameter("id");
|
||||||
|
ModelAndView mv = new ModelAndView();
|
||||||
|
Dorm dorm = dormService.findById(id);
|
||||||
|
mv.addObject("dorm",dorm);
|
||||||
|
mv.setViewName("look-dorm");
|
||||||
|
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
package cn.ppdxzz.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:宿舍实体类
|
||||||
|
*
|
||||||
|
* @Date: 2020/2/19 17:51
|
||||||
|
* @Author: PeiChen
|
||||||
|
*/
|
||||||
|
public class Dorm implements Serializable {
|
||||||
|
private Integer id;//ID
|
||||||
|
private String dorm_id;//宿舍号
|
||||||
|
private String dorm_intro;//宿舍简介
|
||||||
|
private String dorm_rps;//宿舍荣誉
|
||||||
|
private String dorm_leader;//宿舍长
|
||||||
|
private String teacher;//管辖育人导师
|
||||||
|
|
||||||
|
public Dorm() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dorm(Integer id, String dorm_id, String dorm_intro, String dorm_rps, String dorm_leader, String teacher) {
|
||||||
|
this.id = id;
|
||||||
|
this.dorm_id = dorm_id;
|
||||||
|
this.dorm_intro = dorm_intro;
|
||||||
|
this.dorm_rps = dorm_rps;
|
||||||
|
this.dorm_leader = dorm_leader;
|
||||||
|
this.teacher = teacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDorm_id() {
|
||||||
|
return dorm_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDorm_id(String dorm_id) {
|
||||||
|
this.dorm_id = dorm_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDorm_intro() {
|
||||||
|
return dorm_intro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDorm_intro(String dorm_intro) {
|
||||||
|
this.dorm_intro = dorm_intro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDorm_rps() {
|
||||||
|
return dorm_rps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDorm_rps(String dorm_rps) {
|
||||||
|
this.dorm_rps = dorm_rps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDorm_leader() {
|
||||||
|
return dorm_leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDorm_leader(String dorm_leader) {
|
||||||
|
this.dorm_leader = dorm_leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTeacher() {
|
||||||
|
return teacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTeacher(String teacher) {
|
||||||
|
this.teacher = teacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Dorm{" +
|
||||||
|
"id=" + id +
|
||||||
|
", dorm_id='" + dorm_id + '\'' +
|
||||||
|
", dorm_intro='" + dorm_intro + '\'' +
|
||||||
|
", dorm_rps='" + dorm_rps + '\'' +
|
||||||
|
", dorm_leader='" + dorm_leader + '\'' +
|
||||||
|
", teacher='" + teacher + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.ppdxzz.service;
|
||||||
|
|
||||||
|
import cn.ppdxzz.domain.Dorm;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
*
|
||||||
|
* @Date: 2020/2/19 19:52
|
||||||
|
* @Author: PeiChen
|
||||||
|
*/
|
||||||
|
public interface DormService {
|
||||||
|
|
||||||
|
List<Dorm> findAll(int page,int size) throws Exception;
|
||||||
|
|
||||||
|
List<Dorm> search(int page,int size,String keyword) throws Exception;
|
||||||
|
|
||||||
|
void add(Dorm dorm) throws Exception;
|
||||||
|
|
||||||
|
void update(Dorm dorm) throws Exception;
|
||||||
|
|
||||||
|
InputStream getInputStream() throws Exception;
|
||||||
|
|
||||||
|
Dorm findByDormId(String dorm_id) throws Exception;
|
||||||
|
|
||||||
|
Dorm findById(String id) throws Exception;
|
||||||
|
}
|
@ -0,0 +1,210 @@
|
|||||||
|
<%--
|
||||||
|
Created by IntelliJ IDEA.
|
||||||
|
User: user
|
||||||
|
Date: 2020/2/18
|
||||||
|
Time: 15:56
|
||||||
|
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}/dorm/findAll?page=1&size="+ pageSize;
|
||||||
|
}
|
||||||
|
$("#serarch_btn").click(function () {
|
||||||
|
var keyword = $("#keyword").val();
|
||||||
|
location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=4&keyword="+keyword;
|
||||||
|
});
|
||||||
|
$("#refresh").click(function () {
|
||||||
|
$("#myform").reset();
|
||||||
|
location.href="${pageContext.request.contextPath}/dorm/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}/dorm/findAll?page=1&size=4"><i class="layui-icon"></i></a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<xblock>
|
||||||
|
<a href="${pageContext.request.contextPath}/dorm/toAdd" class="layui-btn layui-btn-normal"><i class="layui-icon"></i>添加</a>
|
||||||
|
<a onclick="exportInfo(${sessionScope.adminInfo.power})" class="layui-btn layui-btn-warm" href="javascript:;"><i class="layui-icon"></i>导出</a>
|
||||||
|
<span class="x-right" style="line-height:40px">共有数据:${pageInfo.total} 条</span>
|
||||||
|
</xblock>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<table class="layui-table layui-form" style="table-layout: fixed;width: 100%">
|
||||||
|
<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>
|
||||||
|
<c:if test="${sessionScope.adminInfo.power > 2}">
|
||||||
|
<th style="text-align: center">操作</th>
|
||||||
|
</c:if>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
int j = 1;
|
||||||
|
%>
|
||||||
|
<c:forEach items="${pageInfo.list}" var="dorm">
|
||||||
|
<tr id="light" style="text-align: center">
|
||||||
|
<td><%=j++%></td>
|
||||||
|
<td>${dorm.dorm_id}</td>
|
||||||
|
<td style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">${dorm.dorm_intro}</td>
|
||||||
|
<td style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">${dorm.dorm_rps}</td>
|
||||||
|
<td>${dorm.dorm_leader}</td>
|
||||||
|
<td>${dorm.teacher}</td>
|
||||||
|
<c:if test="${sessionScope.adminInfo.power > 2}">
|
||||||
|
<td class="td-manage">
|
||||||
|
<a title="更新信息" href="${pageContext.request.contextPath}/dorm/toUpdate?id=${dorm.id}">
|
||||||
|
<i class="layui-icon"></i>
|
||||||
|
</a>
|
||||||
|
<a title="查看详情" onclick="look(${dorm.id})" 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}/dorm/findAll?page=1&size=${pageInfo.pageSize}&keyword=${param.keyword}">首页</a>
|
||||||
|
<c:if test="${pageInfo.pageNum > 1}">
|
||||||
|
<a class="prev" href="${pageContext.request.contextPath}/dorm/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}/dorm/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}/dorm/findAll?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">下一页</a>
|
||||||
|
</c:if>
|
||||||
|
<a class="next" href="${pageContext.request.contextPath}/dorm/findAll?page=${pageInfo.pages}&size=${pageInfo.pageSize}&keyword=${param.keyword}">尾页</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//查看详情
|
||||||
|
function look(id) {
|
||||||
|
layer.open({
|
||||||
|
type: 2,
|
||||||
|
title:'宿舍详情',
|
||||||
|
skin: 'layui-layer-rim', //加上边框
|
||||||
|
area: ['800px', '430px'], //宽高
|
||||||
|
content: '${pageContext.request.contextPath}/dorm/look?id='+id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//导出Excel操作
|
||||||
|
function exportInfo(power) {
|
||||||
|
if (power < 3) {
|
||||||
|
layer.msg('对不起,您没有权限导出宿舍信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
layer.confirm('确定导出所有宿舍数据吗?',function (index) {
|
||||||
|
location.href="${pageContext.request.contextPath}/dorm/export";
|
||||||
|
layer.close(index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,53 @@
|
|||||||
|
<%--
|
||||||
|
Created by IntelliJ IDEA.
|
||||||
|
User: user
|
||||||
|
Date: 2020/2/20
|
||||||
|
Time: 17:17
|
||||||
|
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>
|
||||||
|
<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>
|
||||||
|
<br />
|
||||||
|
<form>
|
||||||
|
<table class="table" style="width: 100%;text-align: center;">
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center"><label>宿舍号</label></td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_id}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center"><label>宿舍简介</label></td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_intro}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center">
|
||||||
|
<label>宿舍奖惩</label>
|
||||||
|
</td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_rps}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center">
|
||||||
|
<label>宿舍长</label>
|
||||||
|
</td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_leader}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center"><label>育人导师</label></td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.teacher}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
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,210 @@
|
|||||||
|
<%--
|
||||||
|
Created by IntelliJ IDEA.
|
||||||
|
User: user
|
||||||
|
Date: 2020/2/18
|
||||||
|
Time: 15:56
|
||||||
|
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}/dorm/findAll?page=1&size="+ pageSize;
|
||||||
|
}
|
||||||
|
$("#serarch_btn").click(function () {
|
||||||
|
var keyword = $("#keyword").val();
|
||||||
|
location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=4&keyword="+keyword;
|
||||||
|
});
|
||||||
|
$("#refresh").click(function () {
|
||||||
|
$("#myform").reset();
|
||||||
|
location.href="${pageContext.request.contextPath}/dorm/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}/dorm/findAll?page=1&size=4"><i class="layui-icon"></i></a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<xblock>
|
||||||
|
<a href="${pageContext.request.contextPath}/dorm/toAdd" class="layui-btn layui-btn-normal"><i class="layui-icon"></i>添加</a>
|
||||||
|
<a onclick="exportInfo(${sessionScope.adminInfo.power})" class="layui-btn layui-btn-warm" href="javascript:;"><i class="layui-icon"></i>导出</a>
|
||||||
|
<span class="x-right" style="line-height:40px">共有数据:${pageInfo.total} 条</span>
|
||||||
|
</xblock>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<table class="layui-table layui-form" style="table-layout: fixed;width: 100%">
|
||||||
|
<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>
|
||||||
|
<c:if test="${sessionScope.adminInfo.power > 2}">
|
||||||
|
<th style="text-align: center">操作</th>
|
||||||
|
</c:if>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
int j = 1;
|
||||||
|
%>
|
||||||
|
<c:forEach items="${pageInfo.list}" var="dorm">
|
||||||
|
<tr id="light" style="text-align: center">
|
||||||
|
<td><%=j++%></td>
|
||||||
|
<td>${dorm.dorm_id}</td>
|
||||||
|
<td style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">${dorm.dorm_intro}</td>
|
||||||
|
<td style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">${dorm.dorm_rps}</td>
|
||||||
|
<td>${dorm.dorm_leader}</td>
|
||||||
|
<td>${dorm.teacher}</td>
|
||||||
|
<c:if test="${sessionScope.adminInfo.power > 2}">
|
||||||
|
<td class="td-manage">
|
||||||
|
<a title="更新信息" href="${pageContext.request.contextPath}/dorm/toUpdate?id=${dorm.id}">
|
||||||
|
<i class="layui-icon"></i>
|
||||||
|
</a>
|
||||||
|
<a title="查看详情" onclick="look(${dorm.id})" 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}/dorm/findAll?page=1&size=${pageInfo.pageSize}&keyword=${param.keyword}">首页</a>
|
||||||
|
<c:if test="${pageInfo.pageNum > 1}">
|
||||||
|
<a class="prev" href="${pageContext.request.contextPath}/dorm/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}/dorm/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}/dorm/findAll?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">下一页</a>
|
||||||
|
</c:if>
|
||||||
|
<a class="next" href="${pageContext.request.contextPath}/dorm/findAll?page=${pageInfo.pages}&size=${pageInfo.pageSize}&keyword=${param.keyword}">尾页</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//查看详情
|
||||||
|
function look(id) {
|
||||||
|
layer.open({
|
||||||
|
type: 2,
|
||||||
|
title:'宿舍详情',
|
||||||
|
skin: 'layui-layer-rim', //加上边框
|
||||||
|
area: ['800px', '430px'], //宽高
|
||||||
|
content: '${pageContext.request.contextPath}/dorm/look?id='+id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//导出Excel操作
|
||||||
|
function exportInfo(power) {
|
||||||
|
if (power < 3) {
|
||||||
|
layer.msg('对不起,您没有权限导出宿舍信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
layer.confirm('确定导出所有宿舍数据吗?',function (index) {
|
||||||
|
location.href="${pageContext.request.contextPath}/dorm/export";
|
||||||
|
layer.close(index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,53 @@
|
|||||||
|
<%--
|
||||||
|
Created by IntelliJ IDEA.
|
||||||
|
User: user
|
||||||
|
Date: 2020/2/20
|
||||||
|
Time: 17:17
|
||||||
|
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>
|
||||||
|
<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>
|
||||||
|
<br />
|
||||||
|
<form>
|
||||||
|
<table class="table" style="width: 100%;text-align: center;">
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center"><label>宿舍号</label></td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_id}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center"><label>宿舍简介</label></td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_intro}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center">
|
||||||
|
<label>宿舍奖惩</label>
|
||||||
|
</td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_rps}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center">
|
||||||
|
<label>宿舍长</label>
|
||||||
|
</td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.dorm_leader}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center"><label>育人导师</label></td>
|
||||||
|
<td colspan="3" style="text-align: center">${dorm.teacher}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in new issue