finsh table except data show

pull/1/head
xicheny 5 years ago
parent b0d92498b9
commit ee5801058e

@ -14,19 +14,7 @@
<div class="layui-header">
<div class="layui-logo">图书馆管理人员页面</div>
<!-- 头部区域可配合layui已有的水平导航 -->
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item"><a href="">控制台</a></li>
<li class="layui-nav-item"><a href="">商品管理</a></li>
<li class="layui-nav-item"><a href="">用户</a></li>
<li class="layui-nav-item">
<a href="javascript:;">其它系统</a>
<dl class="layui-nav-child">
<dd><a href="">邮件管理</a></dd>
<dd><a href="">消息管理</a></dd>
<dd><a href="">授权管理</a></dd>
</dl>
</li>
</ul>
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item">
<a href="javascript:;">
@ -34,10 +22,9 @@
</a>
<dl class="layui-nav-child">
<dd><a href="">基本资料</a></dd>
<dd><a href="">安全设置</a></dd>
</dl>
</li>
<li class="layui-nav-item"><a href="">退出</a></li>
<li class="layui-nav-item"><a href="./quit" target="_parent">退出</a></li>
</ul>
</div>
@ -57,7 +44,7 @@
<a href="javascript:;">报表管理</a>
<dl class="layui-nav-child">
<dd><a href="06borrowTable.jsp" target="content">借书报表</a></dd>
<dd><a href="javascript:;" target="content">还书报表</a></dd>
<dd><a href="07returnTable.jsp" target="content">还书报表</a></dd>
</dl>
</li>
<li class="layui-nav-item"><a href="">发布公告</a></li>

@ -24,12 +24,11 @@
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required">
<option value=""></option>
<option value="id">ID</option>
<option value="card_id">借阅证号</option>
<option value="book_id">图书编号</option>
<option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option>
<option value="return_date">还日期</option>
<option value="return_date">还日期</option>
<option value="illegal">违章信息</option>
<option value="manager_id">处理人</option>
</select>
@ -52,14 +51,13 @@
,url:'./borrowTable'
,toolbar: '#headBar'
,cols: [[
{field:'id', width:80, title: 'ID', sort: true}
,{field:'card_id', width:180, title: '借阅证号'}
,{field:'book_id', width:180, title: '图书编号', sort: true}
,{field:'borrow_date', width:180, title: '借阅日期'}
,{field:'end_date', title: '截止日期', minWidth: 150}
,{field:'return_date', width:180, title: '归还时间', sort: true}
,{field:'illegal', width:80, title: '违章信息', sort: true}
,{field:'manager_id', width:80, title: '处理人'}
{field:'card_id', width:180, title: '借阅证号', sort: true}
,{field:'book_id', width:130, title: '图书编号', sort: true}
,{field:'borrow_date', width:250, title: '借阅日期', sort: true}
,{field:'end_date', title: '截止日期', width: 250, sort: true}
,{field:'return_date', width:250, title: '归还时间', sort: true}
,{field:'illegal', width:180, title: '违章信息', sort: true}
,{field:'manager_id', minWidth:80, title: '处理人'}
]]
,page: true
@ -85,7 +83,7 @@
}
});
break;
// 添加借书证
case 'add':
var addCardLayer = layer.open({
type: 2,

@ -0,0 +1,115 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<script src="../public/layui/layui.js" charset="utf-8"></script>
<style>
.layui-table,.layui-table-view{
margin: 0 0px;
}
</style>
</head>
<body>
<!-- 表单 -->
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table>
<!-- 头部工具栏 -->
<script type="text/html" id="headBar">
条件搜索:
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required">
<option value=""></option>
<option value="card_id">借阅证号</option>
<option value="book_id">图书编号</option>
<option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off">
</div>
<button class="layui-btn" name="condition" data-type="reload" lay-event="search">搜索</button>
</script>
<script>
layui.use(['table','jquery'], function(){
$ = layui.jquery;
var table = layui.table;
// 进行渲染
var tableIns = table.render({
elem: '#cardTable'
,url:'./returnTable'
,toolbar: '#headBar'
,cols: [[
{field:'card_id', width:180, title: '借阅证号', sort: true}
,{field:'book_id', width:130, title: '图书编号', sort: true}
,{field:'borrow_date', width:250, title: '借阅日期', sort: true}
,{field:'end_date', title: '截止日期',width: 250, sort: true}
]]
,page: true
});
// 头部工具栏事件
table.on('toolbar(formFilter)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
// 条件查找图书证
case 'search':
var conditionValue = $('#conditionValue');
var condition = $('#condition');
layer.msg(condition.val());
// 进行搜索,重新渲染
tableIns.reload({
where: { //设定异步数据接口的额外参数,任意设
"condition": condition.val(),
"conditionValue": conditionValue.val()
}
,page: {
curr: 1 //重新从第 1 页开始
}
});
break;
case 'add':
var addCardLayer = layer.open({
type: 2,
title: '添加借书证',
area: ['800px', '500px'],
maxmin: true,
shadeClose: true,
content: 'cardadd.jsp',
});
//layer.full(addCardLayer);
};
});
// 侧边工具栏事件
table.on(('tool(formFilter)'), function(obj){
var data = obj.data;
var layEvent = obj.event;
var tr = obj.tr;
switch(obj.event){
case 'edit':
layer.open({
type: 2,
title: '更改信息',
area: ['800px', '600px'],
maxmin: true,
shadeClose: true,
content: '',
})
break;
}
})
});
</script>
</body>
</html>

@ -35,12 +35,15 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="javascript:;">
<%=session.getAttribute("reader") %>
</a></li>
<%if(session.getAttribute("reader") !=null) {%>
<li><a href="./exit" target="_parent">退出</a></li>
<%}else{%>
<li><a href="04readerFrame.jsp" target="_parent" onClick="">登录</a></li>
<%}
%>s
%>
</ul>
</div>

@ -30,18 +30,18 @@
<ul class="nav nav-pills nav-stacked nav-inverse sidebar faq-tabbable">
<% if(session.getAttribute("reader")!=null){%>
<li role="presentation"><a href="01main.jsp" target="view_frame"><span class="glyphicon glyphicon-picture" aria-hidden="true">&nbsp;首页</span></a></li>
<li role="presentation"><a href="05searchBooks.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li>
<li role="presentation"><a href="05book.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li>
<li role="presentation"><a href="12rules.jsp" target="view_frame"><span class="glyphicon glyphicon-bell" aria-hidden="true">&nbsp;读者规则</span></a></li>
<li role="presentation"><a href="07announcement.jsp" target="view_frame"><span class="glyphicon glyphicon-bullhorn" aria-hidden="true">&nbsp;查看公告</span></a></li>
<li role="presentation"><a href="index.jsp" target="view_frame"><span class="glyphicon glyphicon-user" aria-hidden="true">&nbsp;个人信息</span></a></li>
<li role="presentation"><a href="06borrowBooks.jsp" target="view_frame"><span class="glyphicon glyphicon-book" aria-hidden="true">&nbsp;借阅信息</span></a></li>
<li role="presentation"><a href="08illegal.jsp" target="view_frame"><span class="glyphicon glyphicon-remove" aria-hidden="true">&nbsp;违章信息</span></a></li>
<li role="presentation"><a href="06borrow.jsp" target="view_frame"><span class="glyphicon glyphicon-book" aria-hidden="true">&nbsp;借阅信息</span></a></li>
<li role="presentation"><a href="08illegalInfo.jsp" target="view_frame"><span class="glyphicon glyphicon-remove" aria-hidden="true">&nbsp;违章信息</span></a></li>
<li role="presentation"><a href="13message.jsp" target="view_frame"><span class="glyphicon glyphicon-pencil" aria-hidden="true">&nbsp;读者留言</span></a></li>
<%
}else{
%>
<li role="presentation"><a href="01main.jsp" target="view_frame"><span class="glyphicon glyphicon-picture" aria-hidden="true">&nbsp;首页</span></a></li>
<li role="presentation"><a href="05searchBooks.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li>
<li role="presentation"><a href="05book.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li>
<li role="presentation"><a href="12rules.jsp" target="view_frame"><span class="glyphicon glyphicon-bell" aria-hidden="true">&nbsp;读者规则</span></a></li>
<li role="presentation"><a href="07announcement.jsp" target="view_frame"><span class="glyphicon glyphicon-bullhorn" aria-hidden="true">&nbsp;查看公告</span></a></li>
<li role="presentation"><a href="15checkMessage.jsp" target="view_frame"><span class="glyphicon glyphicon-envelope" aria-hidden="true">&nbsp;查看留言</span></a></li>

@ -24,7 +24,7 @@
<%
if(session.getAttribute("reader") == null){
%>
<frame src="06borrowBooks.jsp" name="view_frame">
<frame src="06borrow.jsp" name="view_frame">
<%
}else{
%>

@ -17,83 +17,121 @@
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<style>
.layui-table,.layui-table-view{
margin: 0 0px;
}
.layui-form-select dl dd.layui-this { background-color: #01AAED; }
</style>
</head>
<body>
<div>
<table id="table" data-toggle="table" data-url="data1.json" data-pagination="true" data-search="true">
<thead>
<tr>
<th data-sortable="true" data-field="id">图书编号</th>
<th data-sortable="true" data-field="name">图书名称</th>
<th data-field="author">图书作者</th>
<th data-field="library">图书馆编号</th>
<th data-field="sort">图书分类编号</th>
<th data-field="position">位置</th>
<th data-field="status">状态</th>
<th data-field="description">描述</th>
</tr>
</thead>
<script src="../public/layui/layui.js" charset="utf-8"></script>
<!-- 表单 -->
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table>
<!-- 头部工具栏 -->
<script type="text/html" id="headBar">
条件搜索:
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required">
<option value=""></option>
<option value="id">图书编号</option>
<option value="name">图书名称</option>
<option value="author">作者</option>
<option value="library_id">图书馆</option>
<option value="sort_id">分类</option>
<option value="position">位置</option>
<option value="status">状态</option>
<option value="description">描述</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off">
</div>
<button class="layui-btn layui-bg-blue" name="condition" data-type="reload" lay-event="search">搜索</button>
</script>
</table>
</div>
<script>
$('#table').bootstrapTable({
url: 'data1.json',
method: 'post',
contentType: "application/x-www-form-urlencoded",
clickToSelect : true,
//排序
sortable:true,
sortOrder: "asc",
sidePagination : "server",
<script>
layui.use(['table','jquery'], function(){
$ = layui.jquery;
var table = layui.table;
// 进行渲染
var tableIns = table.render({
elem: '#cardTable'
,url:'./book'
,toolbar: '#headBar'
,cols: [[
{field:'id', width:120, title: '图书编号', sort: true}
,{field:'name', width:130, title: '图书名称', sort: true}
,{field:'author', width:100, title: '作者', sort: true}
,{field:'library_id', title: '图书馆', width: 100, sort: true}
,{field:'sort_id', width:100, title: '分类', sort: true}
,{field:'position', width:100, title: '位置', sort: true}
,{field:'status', width:100, title: '状态', sort: true}
,{field:'description', minWidth:80, title: '描述'}
pageSize: 10,
pageList: [10, 25, 50, 100],
//显示列及刷新
showColumns:true,
showRefresh:true,
]]
,page: true
,page: {theme: '#2F88FF'},
});
striped: true,
pagination: true,
search: true,
uniqueId : "id",
locale: "zh-CN",
strictSearch: true,
showExport: true,
columns: [{
field: 'id',
title: '图书编号',
align: 'center'
}, {
field: 'name',
title: '图书名称',
align: 'center'
}, {
field: 'author',
title: '图书作者',
align: 'center'
}, {
field: 'library',
title: '图书馆编号',
align: 'center'
}, {
field: 'sort',
title: '图书分类编号',
align: 'center'
}, {
field: 'position',
title: '位置',
align: 'center'
}, {
field: 'status',
title: '状态'
}, {
field: 'description',
title: '描述',
align: 'center'
}]
// 头部工具栏事件
table.on('toolbar(formFilter)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
// 条件查找图书证
case 'search':
var conditionValue = $('#conditionValue');
var condition = $('#condition');
layer.msg(condition.val());
// 进行搜索,重新渲染
tableIns.reload({
where: { //设定异步数据接口的额外参数,任意设
"condition": condition.val(),
"conditionValue": conditionValue.val()
}
,page: {
curr: 1 //重新从第 1 页开始
}
});
break;
case 'add':
var addCardLayer = layer.open({
type: 2,
title: '添加借书证',
area: ['800px', '500px'],
maxmin: true,
shadeClose: true,
content: 'cardadd.jsp',
});
//layer.full(addCardLayer);
};
});
// 侧边工具栏事件
table.on(('tool(formFilter)'), function(obj){
var data = obj.data;
var layEvent = obj.event;
var tr = obj.tr;
switch(obj.event){
case 'edit':
layer.open({
type: 2,
title: '更改信息',
area: ['800px', '600px'],
maxmin: true,
shadeClose: true,
content: '',
})
break;
}
})
</script>
});
</script>
</body>
</html>

@ -1,70 +0,0 @@
<%@ page import="java.sql.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/bootstrap-table.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<link href="../public/css/table.css" rel="stylesheet">
<style>
div table th{
vertical-align: middle !important;
text-align: center;
}
</style>
</head>
<body>
<jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean>
<jsp:include flush="true" page="searchNav.jsp"></jsp:include>
<div class="table-responsive" style="margin-top:-1.5%;">
<table class="table table-hover" id="tb">
<tr align="center">
<th>图书编号</th>
<th>图书名称</th>
<th>图书作者</th>
<th>图书馆编号</th>
<th>图书分类编号</th>
<th>位置</th>
<th>状态</th>
<th class="tab">描述</th>
</tr>
<%
request.setCharacterEncoding("utf-8");
String sql="select*from books;";
ResultSet rs = check.executeQuery(sql);
while (rs.next()) {
%>
<tr align="center">
<td><%=rs.getString("ID")%></td>
<td><%=rs.getString("NAME")%></td>
<td><%=rs.getString("AUTHOR")%></td>
<td><%=rs.getString("LIBRARY_ID")%></td>
<td><%=rs.getString("SORT_ID")%></td>
<td><%=rs.getString("POSITION")%></td>
<td><%=rs.getString("STATUS")%></td>
<td><%=rs.getString("DESCRIPTION")%></td>
</tr>
<%
}
%>
</table>
</div>
</body>
</html>

@ -0,0 +1,131 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/bootstrap-table.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<style>
.layui-table,.layui-table-view{
margin: 0 0px;
}
</style>
</head>
<body>
<script src="../public/layui/layui.js" charset="utf-8"></script>
<!-- 表单 -->
<% if(session.getAttribute("reader")==null){%>
<script>
location.href = "../loginReader.html";
</script>
<%
}
%>
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table>
<!-- 头部工具栏 -->
<script type="text/html" id="headBar">
条件搜索:
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required">
<option value=""></option>
<option value="card_id">借阅证号</option>
<option value="book_id">图书编号</option>
<option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option>
<option value="return_date">归还日期</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off">
</div>
<button class="layui-btn" name="condition" data-type="reload" lay-event="search">搜索</button>
</script>
<script>
layui.use(['table','jquery'], function(){
$ = layui.jquery;
var table = layui.table;
// 进行渲染
var tableIns = table.render({
elem: '#cardTable'
,url:'./borrow'
,toolbar: '#headBar'
,cols: [[
{field:'card_id', width:180, title: '借阅证号', sort: true}
,{field:'book_id', width:130, title: '图书编号', sort: true}
,{field:'borrow_date', width:250, title: '借阅日期', sort: true}
,{field:'end_date', title: '截止日期', width: 250, sort: true}
,{field:'return_date', width:250, title: '归还时间', sort: true}
]]
,page: true
});
// 头部工具栏事件
table.on('toolbar(formFilter)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
// 条件查找图书证
case 'search':
var conditionValue = $('#conditionValue');
var condition = $('#condition');
layer.msg(condition.val());
// 进行搜索,重新渲染
tableIns.reload({
where: { //设定异步数据接口的额外参数,任意设
"condition": condition.val(),
"conditionValue": conditionValue.val()
}
,page: {
curr: 1 //重新从第 1 页开始
}
});
break;
case 'add':
var addCardLayer = layer.open({
type: 2,
title: '添加借书证',
area: ['800px', '500px'],
maxmin: true,
shadeClose: true,
content: 'cardadd.jsp',
});
//layer.full(addCardLayer);
};
});
// 侧边工具栏事件
table.on(('tool(formFilter)'), function(obj){
var data = obj.data;
var layEvent = obj.event;
var tr = obj.tr;
switch(obj.event){
case 'edit':
layer.open({
type: 2,
title: '更改信息',
area: ['800px', '600px'],
maxmin: true,
shadeClose: true,
content: '',
})
break;
}
})
});
</script>
</body>
</html>

@ -1,70 +0,0 @@
<%@ page import="java.sql.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../public/css/animate.css">
<link rel="stylesheet" href="../public/css/login.css" />
<style>
th{
vertical-align: middle !important;
text-align: center;
}
</style>
</head>
<body>
<%
if(session.getAttribute("reader") == null ){
%>
<script>
location.href = "../loginReader.html";
</script>
<%
}
%>
<jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean>
<div class="table-responsive">
<table class="table table-hover">
<tr align="center">
<th>借阅证号</th>
<th>图书编号</th>
<th>借阅日期</th>
<th>截止日期</th>
<th>归还日期</th>
</tr>
<%
try{
String id = session.getAttribute("reader").toString();
String sql="select CARD_ID,BOOK_ID,BORROW_DATE,END_DATE,RETURN_DATE from borrow_books where CARD_ID = " + id;
ResultSet rs = check.executeQuery(sql);
while (rs.next()) {
%>
<tr align="center">
<td><%=rs.getString("CARD_ID")%></td>
<td><%=rs.getString("BOOK_ID")%></td>
<td><%=rs.getString("BORROW_DATE")%></td>
<td><%=rs.getString("END_DATE")%></td>
<td><%=rs.getString("RETURN_DATE")%></td>
</tr>
<%
}
}catch(Exception e) {
}
%>
</table>
</div>
</body>
</html>

@ -1,72 +0,0 @@
<%@ page import="java.sql.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../public/css/animate.css">
<link rel="stylesheet" href="../public/css/login.css" />
<style>
th{
vertical-align: middle !important;
text-align: center;
}
</style>
</head>
<body>
<%
if(session.getAttribute("reader") == null){
%>
<script>
location.href="../loginReader.html";
</script>
<%
}
%>
<jsp:useBean id="ill" scope="session" class="javabean.JDBCBean"></jsp:useBean>
<div class="table-responsive">
<table class="table table-hover">
<tr align="center">
<th>图书编号</th>
<th>借阅日期</th>
<th>截止日期</th>
<th>归还日期</th>
<th>违章信息</th>
<th>处理信息的管理员</th>
</tr>
<%
try{
String id=session.getAttribute("reader").toString();
String sql="select BOOK_ID,BORROW_DATE,END_DATE,RETURN_DATE,ILLEGAL,MANAGER_ID from borrow_books where ILLEGAL is not null and length(trim(illegal))>0 AND CARD_ID = " + id;
//out.println(sql);
ResultSet rs = ill.executeQuery(sql);
while (rs.next()) {
%>
<tr align="center">
<td><%=rs.getString("BOOK_ID")%></td>
<td><%=rs.getString("BORROW_DATE")%></td>
<td><%=rs.getString("END_DATE")%></td>
<td><%=rs.getString("RETURN_DATE")%></td>
<td><span class="label label-danger" style="font-size:13px;font-family:YouYuan;"><%=rs.getString("ILLEGAL")%></span></td>
<td><%=rs.getString("MANAGER_ID")%></td>
</tr>
<%
}
}catch(Exception e){
}
%>
</table>
</div>
</body>
</html>

@ -0,0 +1,140 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/bootstrap-table.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<style>
.layui-table,.layui-table-view{
margin: 0 0px;
}
.layui-form-select dl dd.layui-this { background-color: #FF5722; }
</style>
</head>
<body>
<%
if(session.getAttribute("reader") == null){
%>
<script>
location.href="../loginReader.html";
</script>
<%
}
%>
<script src="../public/layui/layui.js" charset="utf-8"></script>
<!-- 表单 -->
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table>
<!-- 头部工具栏 -->
<script type="text/html" id="headBar">
条件搜索:
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required">
<option value=""></option>
<option value="card_id">借阅证号</option>
<option value="book_id">图书编号</option>
<option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option>
<option value="return_date">归还日期</option>
<option value="illegal">违章信息</option>
<option value="manager_id">处理人</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off">
</div>
<button class="layui-btn layui-btn-danger" name="condition" data-type="reload" lay-event="search">搜索</button>
</script>
<script>
layui.use(['table','jquery'], function(){
$ = layui.jquery;
var table = layui.table;
// 进行渲染
var tableIns = table.render({
elem: '#cardTable'
,url:'./illegal'
,toolbar: '#headBar'
,cols: [[
{field:'card_id', width:180, title: '借阅证号', sort: true}
,{field:'book_id', minwidth:80, title: '图书编号', sort: true}
,{field:'borrow_date', width:250, title: '借阅日期', sort: true}
,{field:'end_date', title: '截止日期', width: 250, sort: true}
,{field:'return_date', width:250, title: '归还时间', sort: true}
,{field:'illegal', width:180, title: '违章信息', sort: true}
,{field:'manager_id', width:90, title: '处理人', sort: true}
]]
,page: true
,page: {theme: '#FF5722'},
});
// 头部工具栏事件
table.on('toolbar(formFilter)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
// 条件查找图书证
case 'search':
var conditionValue = $('#conditionValue');
var condition = $('#condition');
layer.msg(condition.val());
// 进行搜索,重新渲染
tableIns.reload({
where: { //设定异步数据接口的额外参数,任意设
"condition": condition.val(),
"conditionValue": conditionValue.val()
}
,page: {
curr: 1 //重新从第 1 页开始
}
});
break;
case 'add':
var addCardLayer = layer.open({
type: 2,
title: '添加借书证',
area: ['800px', '500px'],
maxmin: true,
shadeClose: true,
content: 'cardadd.jsp',
});
//layer.full(addCardLayer);
};
});
// 侧边工具栏事件
table.on(('tool(formFilter)'), function(obj){
var data = obj.data;
var layEvent = obj.event;
var tr = obj.tr;
switch(obj.event){
case 'edit':
layer.open({
type: 2,
title: '更改信息',
area: ['800px', '600px'],
maxmin: true,
shadeClose: true,
content: '',
})
break;
}
})
});
</script>
</body>
</html>

@ -42,9 +42,9 @@ $(function () {
while (rs.next()) {
if(Integer.parseInt(rs.getString("ID")) % 2== 1){
%>
<button type="button" class="btn btn-lg btn-info" title="可借阅数:<%=rs.getString("BORROW_NUM") %>" data-html="true"
<button type="button" class="btn btn-lg btn-info" title="可借阅数<%=rs.getString("BORROW_NUM") %>" data-html="true"
data-container="body" data-trigger="focus" data-toggle="popover" data-placement="left"
data-content="可借阅数<%=rs.getString("LIMIT") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;">
data-content="可借阅数:<%=rs.getString("LIMIT_DAY") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;">
借阅证规则编号:<%=rs.getString("ID")%>
@ -52,9 +52,9 @@ $(function () {
<%
}else{
%>
<button type="button" class="btn btn-lg btn-primary" title="可借阅数:<%=rs.getString("BORROW_NUM") %>" data-html="true"
<button type="button" class="btn btn-lg btn-primary" title="可借阅数<%=rs.getString("BORROW_NUM") %>" data-html="true"
data-container="body" data-trigger="focus" data-toggle="popover" data-placement="right"
data-content="可借阅数<%=rs.getString("LIMIT") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;">
data-content="可借阅数:<%=rs.getString("LIMIT_DAY") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;">
借阅证规则编号:<%=rs.getString("ID")%>

@ -1,13 +1,16 @@
package filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
*
@ -18,9 +21,15 @@ public class ManagerFilter implements Filter {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
//TODO
HttpServletRequest req = (HttpServletRequest) request;
HttpSession session = req.getSession();
if (session == null || session.getAttribute("manager") == null) {
HttpServletResponse rep = (HttpServletResponse) response;
rep.sendRedirect(req.getContextPath() + "/loginManager.html");
}
chain.doFilter(request, response);
}

@ -0,0 +1,29 @@
package servlet.manager;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class Quit
*/
@WebServlet("/manager/quit")
public class Quit extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session = req.getSession();
if (session.getAttribute("manager") != null) {
session.removeAttribute("manager");
}
resp.sendRedirect(req.getContextPath() + "/loginManager.html");
}
}

@ -0,0 +1,122 @@
package servlet.manager;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javabean.Base;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
* Servlet implementation class ReturnTable
*/
@WebServlet("/manager/returnTable")
public class ReturnTable extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("application/json; charset=utf8");
// 接收参数
String limit = req.getParameter("limit");
String page = req.getParameter("page");
String condition = (String) req.getParameter("condition");
String conditionValue = (String) req.getParameter("conditionValue");
String where = ""; // 无限制条件
if (page == null) {
page = "1";
}
if (limit == null) {
limit = "10";
}
// 准备查询
Connection connection = null;
PreparedStatement pstmt = null;
PreparedStatement countPstmt = null;
ResultSet resultSet = null;
ResultSet countSet = null;
String sql = "";
String countSql = "";
// 准备返回参数
int code = 1;
String msg = "error";
int count = 0;
JSONObject jsonData = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject jsonResult = new JSONObject();
// 进行查询
try {
connection = (Connection) Base.getConnection();
sql = "select * from borrow_books where manager_id is null";
if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) {
where = " and " + condition + " like '%" + conditionValue + "%' ";
sql += where;
}
sql += " limit ?,?";// 1 10 (1-1)*10
System.out.println("???" + sql);
pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit));
pstmt.setInt(2, Integer.parseInt(limit));
resultSet = pstmt.executeQuery();
while (resultSet.next()) {
jsonData.put("id", resultSet.getString("id"));
jsonData.put("card_id", resultSet.getString("card_id"));
jsonData.put("book_id", resultSet.getString("book_id"));
jsonData.put("borrow_date", resultSet.getString("borrow_date"));
jsonData.put("end_date", resultSet.getString("end_date"));
jsonArray.add(jsonData);
}
countSql = "select count(*) as count from borrow_books where manager_id is null";
countSql += where;
countPstmt = connection.prepareStatement(countSql);
countSet = countPstmt.executeQuery();
if (countSet.next()) {
count = countSet.getInt("count");
}
if (!jsonArray.isEmpty()) {
code = 0;
msg = "查询成功";
}
} catch (ClassNotFoundException e) {
msg = "class没找到";
} catch (SQLException e) {
msg = "sql错误";
} finally {
try {
Base.closeResource(null, pstmt, resultSet);
Base.closeResource(connection, countPstmt, countSet);
} catch (SQLException e) {
msg = "关闭资源失败";
}
}
// 返回数据
jsonResult.put("code", code);
jsonResult.put("count", count);
jsonResult.put("msg", msg);
jsonResult.put("data", jsonArray.toArray());
PrintWriter out = resp.getWriter();
out.print(jsonResult.toString());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
}

@ -0,0 +1,115 @@
package servlet.reader;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javabean.Base;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
* Servlet implementation class Book
*/
@WebServlet("/reader/book")
public class Book extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("application/json; charset=utf8");
// 接收参数
String limit = req.getParameter("limit");
String page = req.getParameter("page");
String condition = (String) req.getParameter("condition");
String conditionValue = (String) req.getParameter("conditionValue");
String where = ""; // 无限制条件
if (page == null) {
page = "1";
}
if (limit == null) {
limit = "10";
}
// 准备查询
Connection connection = null;
PreparedStatement pstmt = null;
PreparedStatement countPstmt = null;
ResultSet resultSet = null;
ResultSet countSet = null;
String sql = "";
String countSql = "";
// 准备返回参数
int code = 1;
String msg = "error";
int count = 0;
JSONObject jsonData = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject jsonResult = new JSONObject();
// 进行查询
try {
connection = (Connection) Base.getConnection();
sql = "select * from books ";
if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) {
where = " where " + condition + " like '%" + conditionValue + "%' ";
sql += where;
}
sql += " limit ?,?";// 1 10 (1-1)*10
System.out.println("???" + sql);
pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit));
pstmt.setInt(2, Integer.parseInt(limit));
resultSet = pstmt.executeQuery();
while (resultSet.next()) {
jsonData.put("id", resultSet.getString("id"));
jsonData.put("name", resultSet.getString("name"));
jsonData.put("author", resultSet.getString("author"));
jsonData.put("library_id", resultSet.getString("library_id"));
jsonData.put("sort_id", resultSet.getString("sort_id"));
jsonData.put("position", resultSet.getString("position"));
jsonData.put("status", resultSet.getString("status"));
jsonData.put("description", resultSet.getString("description"));
jsonArray.add(jsonData);
}
countSql = "select count(*) as count from books ";
countSql += where;
countPstmt = connection.prepareStatement(countSql);
countSet = countPstmt.executeQuery();
if (countSet.next()) {
count = countSet.getInt("count");
}
if (!jsonArray.isEmpty()) {
code = 0;
msg = "查询成功";
}
} catch (ClassNotFoundException e) {
msg = "class没找到";
} catch (SQLException e) {
msg = "sql错误";
} finally {
try {
Base.closeResource(null, pstmt, resultSet);
Base.closeResource(connection, countPstmt, countSet);
} catch (SQLException e) {
msg = "关闭资源失败";
}
}
// 返回数据
jsonResult.put("code", code);
jsonResult.put("count", count);
jsonResult.put("msg", msg);
jsonResult.put("data", jsonArray.toArray());
PrintWriter out = resp.getWriter();
out.print(jsonResult.toString());
}
}

@ -0,0 +1,117 @@
package servlet.reader;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javabean.Base;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
* Servlet implementation class Borrow
*/
@WebServlet("/reader/borrow")
public class Borrow extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("application/json; charset=utf8");
// 接收参数
String limit = req.getParameter("limit");
String page = req.getParameter("page");
String condition = (String) req.getParameter("condition");
String conditionValue = (String) req.getParameter("conditionValue");
String where = ""; // 无限制条件
if (page == null) {
page = "1";
}
if (limit == null) {
limit = "10";
}
// 准备查询
Connection connection = null;
PreparedStatement pstmt = null;
PreparedStatement countPstmt = null;
ResultSet resultSet = null;
ResultSet countSet = null;
String sql = "";
String countSql = "";
// 准备返回参数
int code = 1;
String msg = "error";
int count = 0;
HttpSession session = req.getSession();
JSONObject jsonData = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject jsonResult = new JSONObject();
// 进行查询
try {
connection = (Connection) Base.getConnection();
sql = "select * from borrow_books where card_id = " + session.getAttribute("reader");
if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) {
where = " and " + condition + " like '%" + conditionValue + "%' ";
sql += where;
}
sql += " limit ?,?";// 1 10 (1-1)*10
System.out.println("???" + sql);
pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit));
pstmt.setInt(2, Integer.parseInt(limit));
resultSet = pstmt.executeQuery();
while (resultSet.next()) {
jsonData.put("id", resultSet.getString("id"));
jsonData.put("card_id", resultSet.getString("card_id"));
jsonData.put("book_id", resultSet.getString("book_id"));
jsonData.put("borrow_date", resultSet.getString("borrow_date"));
jsonData.put("end_date", resultSet.getString("end_date"));
jsonData.put("return_date", resultSet.getString("return_date"));
jsonArray.add(jsonData);
}
countSql = "select count(*) as count from borrow_books where card_id = "
+ req.getSession().getAttribute("reader");
countSql += where;
countPstmt = connection.prepareStatement(countSql);
countSet = countPstmt.executeQuery();
if (countSet.next()) {
count = countSet.getInt("count");
}
if (!jsonArray.isEmpty()) {
code = 0;
msg = "查询成功";
}
} catch (ClassNotFoundException e) {
msg = "class没找到";
} catch (SQLException e) {
msg = "sql错误";
} finally {
try {
Base.closeResource(null, pstmt, resultSet);
Base.closeResource(connection, countPstmt, countSet);
} catch (SQLException e) {
msg = "关闭资源失败";
}
}
// 返回数据
jsonResult.put("code", code);
jsonResult.put("count", count);
jsonResult.put("msg", msg);
jsonResult.put("data", jsonArray.toArray());
PrintWriter out = resp.getWriter();
out.print(jsonResult.toString());
}
}

@ -0,0 +1,119 @@
package servlet.reader;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javabean.Base;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
* Servlet implementation class Illegal
*/
@WebServlet("/reader/illegal")
public class Illegal extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("application/json; charset=utf8");
// 接收参数
String limit = req.getParameter("limit");
String page = req.getParameter("page");
String condition = (String) req.getParameter("condition");
String conditionValue = (String) req.getParameter("conditionValue");
String where = ""; // 无限制条件
if (page == null) {
page = "1";
}
if (limit == null) {
limit = "10";
}
// 准备查询
Connection connection = null;
PreparedStatement pstmt = null;
PreparedStatement countPstmt = null;
ResultSet resultSet = null;
ResultSet countSet = null;
String sql = "";
String countSql = "";
// 准备返回参数
int code = 1;
String msg = "error";
int count = 0;
HttpSession session = req.getSession();
JSONObject jsonData = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject jsonResult = new JSONObject();
// 进行查询
try {
connection = (Connection) Base.getConnection();
sql = "select * from borrow_books where ILLEGAL is not null and length(trim(illegal))>0 AND CARD_ID = "
+ session.getAttribute("reader");
if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) {
where = " and " + condition + " like '%" + conditionValue + "%' ";
sql += where;
}
sql += " limit ?,?";// 1 10 (1-1)*10
System.out.println("???" + sql);
pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit));
pstmt.setInt(2, Integer.parseInt(limit));
resultSet = pstmt.executeQuery();
while (resultSet.next()) {
jsonData.put("id", resultSet.getString("id"));
jsonData.put("card_id", resultSet.getString("card_id"));
jsonData.put("book_id", resultSet.getString("book_id"));
jsonData.put("borrow_date", resultSet.getString("borrow_date"));
jsonData.put("end_date", resultSet.getString("end_date"));
jsonData.put("return_date", resultSet.getString("return_date"));
jsonData.put("illegal", resultSet.getString("illegal"));
jsonData.put("manager_id", resultSet.getString("manager_id"));
jsonArray.add(jsonData);
}
countSql = "select count(*) as count from borrow_books where ILLEGAL is not null and length(trim(illegal))>0 AND CARD_ID = "
+ session.getAttribute("reader");
countSql += where;
countPstmt = connection.prepareStatement(countSql);
countSet = countPstmt.executeQuery();
if (countSet.next()) {
count = countSet.getInt("count");
}
if (!jsonArray.isEmpty()) {
code = 0;
msg = "查询成功";
}
} catch (ClassNotFoundException e) {
msg = "class没找到";
} catch (SQLException e) {
msg = "sql错误";
} finally {
try {
Base.closeResource(null, pstmt, resultSet);
Base.closeResource(connection, countPstmt, countSet);
} catch (SQLException e) {
msg = "关闭资源失败";
}
}
// 返回数据
jsonResult.put("code", code);
jsonResult.put("count", count);
jsonResult.put("msg", msg);
jsonResult.put("data", jsonArray.toArray());
PrintWriter out = resp.getWriter();
out.print(jsonResult.toString());
}
}
Loading…
Cancel
Save