Skip to content

Commit e8a6c18

Browse files
committed
base commit
1 parent 66d15ea commit e8a6c18

34 files changed

Lines changed: 555 additions & 32 deletions

book2/WebContent/borrowBook.jsp

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,22 @@
1313
<script type="text/javascript">
1414
function qq(value,name)
1515
{
16-
alert(value+":"+name)
16+
if(name=="all"||name=="other")
17+
{
18+
alert(value+":"+name);
19+
$('#serachTable').datagrid('load',{
20+
name:value
21+
});
22+
}
23+
else
24+
{
25+
$('#serachTable').datagrid('load',{
26+
name:value,
27+
type:name
28+
});
29+
30+
}
31+
1732
}
1833
function showTable()
1934
{
@@ -87,9 +102,41 @@
87102
88103
});
89104
}
90-
function doDbClickEdit()
105+
function doDbClickEdit(rowIndex, rowData)
91106
{
92-
alert("sasasa");
107+
108+
109+
$.messager.confirm('Confirm','你确定借这本书吗?',function(r){
110+
if(r)
111+
{
112+
if(rowData.isBorrow==false)
113+
{
114+
$.post("${pageContext.request.contextPath}/RecordAction_borrow",
115+
116+
{"book_id":rowData.id},
117+
118+
function(data)
119+
{
120+
if(data=='1')
121+
{
122+
alert('完成');
123+
}
124+
else
125+
{
126+
alert("出现异常!请重试(可能没有登录)");
127+
}
128+
},
129+
"text"
130+
);
131+
}
132+
else
133+
{
134+
alert("借书失败,该书已经借出!");
135+
}
136+
137+
}
138+
});
139+
93140
}
94141
</script>
95142

@@ -98,12 +145,21 @@
98145
<input class="easyui-searchbox" style="width:300px" data-options="searcher:qq,prompt:'请输入书名',menu:'#mm'" type="text" name="" id="" >
99146
<div id="mm" style="width:120px">
100147
<div data-options="name:'all',iconCls:'icon-ok'">所有书籍</div>
101-
<div data-options="name:'sports'">。。。</div>
148+
<div data-options="name:'sports'">科普类</div>
149+
<div data-options="name:'word'">文学类</div>
150+
<div data-options="name:'computer'">计算机类</div>
151+
<div data-options="name:'other'">其它类</div>
102152
</div>
103153

104154

105155
<table id="serachTable">
106156

107157
</table>
158+
159+
<div>
160+
<h2>提示:双击选中的图书进行借书!</h2>
161+
</div>
162+
163+
108164
</body>
109165
</html>

book2/WebContent/index.jsp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,28 @@
139139
});
140140
}
141141
}
142+
143+
function openReturnBookPage()
144+
{
145+
contentB='<iframe frameborder="0" src="returnBook.jsp" width="100%" height="100%"/>';
146+
147+
var exists=$("#mytabs").tabs("exists","还书界面");
148+
149+
if(exists)
150+
{
151+
$("#mytabs").tabs("select","还书界面");
152+
}
153+
else
154+
{
155+
$("#mytabs").tabs("add",{
156+
157+
title:"还书界面",
158+
closable:true,
159+
iconCls:'icon-edit',
160+
content:contentB
161+
});
162+
}
163+
}
142164
</script>
143165
</head>
144166
<body class="easyui-layout" onload="doshow()">
@@ -207,6 +229,7 @@
207229
</div>
208230
<div title="借书点这">
209231
<br/><br/><a id="button4" class="easyui-linkbutton" onclick="openBorrowBookPage()">开始借书</a><br/><br/>
232+
<a id="button5" class="easyui-linkbutton" onclick="openReturnBookPage()">开始还书</a><br/><br/>
210233
</div>
211234
</div>
212235
</div>

book2/WebContent/returnBook.jsp

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<%@ page language="java" contentType="text/html; charset=UTF-8"
2+
pageEncoding="UTF-8"%>
3+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4+
<html>
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7+
<title>Insert title here</title>
8+
</head>
9+
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/easyui/themes/default/easyui.css">
10+
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/easyui/themes/icon.css">
11+
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
12+
<script type="text/javascript" src="${pageContext.request.contextPath }/js/easyui/jquery.easyui.min.js"></script>
13+
<script type="text/javascript">
14+
function showTable()
15+
{
16+
var columns=[[
17+
{field:'id',title:'编号',width:100},
18+
19+
{field:'name',title:'书名',width:100},
20+
21+
{field:'price',title:'价格',width:100},
22+
23+
{field:'author',title:'作者',width:100},
24+
25+
{field:'type',title:'类型',width:100},
26+
27+
{field:'description',title:'简介',width:100},
28+
29+
{
30+
field:'publicationDate',
31+
title:'出版日期',
32+
width:100,
33+
formatter: function(value,row,index){
34+
35+
if(value!=null)
36+
{
37+
var year=value['year']+1900+"-";
38+
var month=value['month']+1+"-";
39+
var day=value['date']+"";
40+
return year+month+day+"";
41+
}
42+
else
43+
{
44+
return '';
45+
}
46+
47+
}
48+
},
49+
]];
50+
51+
$('#serachTable').datagrid({
52+
53+
url:'BookAction_pageQueryLoginUser',
54+
55+
columns:columns,
56+
57+
rownumbers:true,
58+
59+
pagination:true,
60+
61+
pageSize:10,
62+
63+
pageList:[10,15,20],
64+
65+
striped:true,
66+
67+
onDblClickRow:doDbClickEdit
68+
69+
});
70+
}
71+
function doDbClickEdit(rowIndex, rowData)
72+
{
73+
$.post("${pageContext.request.contextPath}/RecordAction_editRecord",
74+
{"book_id":rowData.id},
75+
function(data){
76+
77+
if(data=='1')
78+
{
79+
alert("成功还书!");
80+
}
81+
82+
},
83+
"text"
84+
);
85+
}
86+
</script>
87+
88+
<body onload="showTable()">
89+
90+
<div>
91+
<h3>
92+
借书列表如下:
93+
</h3>
94+
95+
</div>
96+
<table id="serachTable">
97+
98+
</table>
99+
100+
101+
<div>
102+
<h3>
103+
提示:双击选中的的图书即可完成还书!
104+
</h3>
105+
106+
</div>
107+
108+
</body>
109+
</html>
343 Bytes
Binary file not shown.
1.53 KB
Binary file not shown.
2.02 KB
Binary file not shown.
733 Bytes
Binary file not shown.
431 Bytes
Binary file not shown.

book2/build/classes/cn/gpf/pojo/Book.hbm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<property name="type"></property>
1818
<property name="isBorrow"></property>
1919
<many-to-one name="bookUser" column="Book_IN_User" class="cn.gpf.pojo.User" lazy="false"></many-to-one>
20-
<set name="bookRecords" lazy="false" >
20+
<set name="bookRecords" lazy="false">
2121
<key column="book_b_record_fk" ></key>
2222
<one-to-many class="cn.gpf.pojo.Record"></one-to-many>
2323
</set>

book2/build/classes/cn/gpf/pojo/Record.hbm.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
55

66
<hibernate-mapping package="cn.gpf.pojo">
7-
<class name="Record" table="t_record" lazy="false">
7+
<class name="Record" table="t_record" lazy="false">
88
<id name="id">
99
<generator class="native"></generator>
1010
</id>
1111
<property name="borrowDate"></property>
1212
<property name="returnDate"></property>
1313

14-
<many-to-one name="book" column="book_b_record_fk" class="cn.gpf.pojo.Book" lazy="false"></many-to-one>
15-
<many-to-one name="user" column="user_record_fk" class="cn.gpf.pojo.User" lazy="false"></many-to-one>
14+
<many-to-one name="book" column="book_b_record_fk" class="cn.gpf.pojo.Book" lazy="false" update="true"></many-to-one>
15+
<many-to-one name="user" column="user_record_fk" class="cn.gpf.pojo.User" lazy="false" update="true"></many-to-one>
16+
1617
</class>
1718
</hibernate-mapping>

0 commit comments

Comments
 (0)