package com.spring.controller;
import java.sql.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import com.hibernate.dao.DAOSupport;
import com.hibernate.model.BookBorrowInfo;
import com.hibernate.model.BookReginster;
import com.hibernate.model.DocuStuInfo;
public class BookManager extends MultiActionController {
private String addPage;
private String searchPage;
private String bookDetailPage;
private String bookBorrowPage;
private String borrowSearchPage;
private String borrowReturnPage;
private DAOSupport dao;
public ModelAndView add(HttpServletRequest req, HttpServletResponse res) {
BookReginster bg = modifyBook(req);
if (dao.InsertOrUpdate(bg))
return new ModelAndView(getAddPage(), "result", "添加成功,可以继续添加");
else
return new ModelAndView(getAddPage(), "result",
"添加失败,请检查输入内容或数据库连接");
}
public ModelAndView modify(HttpServletRequest req, HttpServletResponse res) {
BookReginster bg = modifyBook(req);
if (dao.InsertOrUpdate(bg))
return list(req, res);
else
return new ModelAndView(getSearchPage(), "result",
"修改失败,请检查输入内容或数据库连接");
}
public ModelAndView list(HttpServletRequest req, HttpServletResponse res) {
List list = dao.QueryObject("from BookReginster");
return new ModelAndView(getSearchPage(), "result", list);
}
public ModelAndView search(HttpServletRequest req, HttpServletResponse res) {
List list;
String condition = req.getParameter("condition");
if (condition.equals("书号"))
condition = "bookId";
else if (condition.equals("书名"))
condition = "bookName";
else
condition = "bookConcern";
String conditionContent = req.getParameter("conditionContent");
list = dao.QueryObject("from BookReginster where " + condition
+ " like '" + conditionContent + "%'");
return new ModelAndView(getSearchPage(), "result", list);
}
public ModelAndView detail(HttpServletRequest req, HttpServletResponse res) {
List list;
String bookID = req.getParameter("bookID");
list = dao.QueryObject("from BookReginster where bookId=" + bookID);
BookReginster bookDetail = (BookReginster) list.get(0);
return new ModelAndView(getBookDetailPage(), "result", bookDetail);
}
public ModelAndView borrow(HttpServletRequest req, HttpServletResponse res) {
String submit = req.getParameter("save");
List list = null;
Map model = null;
DocuStuInfo stuInfo = null;
BookReginster bookDetail = null;
BookBorrowInfo borrowInfo = null;
String stuId = req.getParameter("stu_id");
String bookID = req.getParameter("book_id");
if (stuId != null && !stuId.equals("")) {
list = null;
list = dao.QueryObject("from DocuStuInfo where stuId=" + stuId);
if (list != null && list.size() > 0)
stuInfo = (DocuStuInfo) list.get(0);
}
if (bookID != null && !bookID.equals("")) {
list = null;
list = dao.QueryObject("from BookReginster where bookId='" + bookID
+ "'");
if (list != null && list.size() > 0)
bookDetail = (BookReginster) list.get(0);
}
if (stuInfo != null) {
list = null;
list = dao
.QueryObject("from BookBorrowInfo where docuStuInfo.stuId='"
+ stuInfo.getStuId() + "'");
model = new HashMap();
model.put("stu", stuInfo);
model.put("book", bookDetail);
model.put("list", list);
}
String price = req.getParameter("price");
if (submit != null && price != null && !price.equals("")) {
System.out.println(req.getParameter("price") + "");
borrowInfo = new BookBorrowInfo();
borrowInfo.setBookName(req.getParameter("book_name"));
borrowInfo.setBookReginster(bookDetail);
borrowInfo.setBookType("book_type");
borrowInfo.setBorrowDate(new Date(System.currentTimeMillis()));
borrowInfo.setCzy(req.getParameter("czy"));
borrowInfo.setDocuStuInfo(stuInfo);
borrowInfo.setPrice(Double.valueOf(price));
dao.InsertOrUpdate(borrowInfo);
list = dao
.QueryObject("from BookBorrowInfo where docuStuInfo.stuId='"
+ stuInfo.getStuId() + "'");
model = new HashMap();
model.put("stu", stuInfo);
model.put("list", list);
}
return new ModelAndView(getBookBorrowPage(), "info", model);
}
public ModelAndView returnBook(HttpServletRequest req,
HttpServletResponse res) {
List list = null;
Map model = null;
DocuStuInfo stuInfo = null;
// BookReginster bookDetail = null;
BookBorrowInfo borrowInfo = null;
String submit = req.getParameter("return");
String stuId = req.getParameter("stu_id");
String bookID = req.getParameter("book_id");
if (stuId != null && stuId != "") {
list = null;
list = dao.QueryObject("from DocuStuInfo where stuId=" + stuId);
if (list != null && list.size() > 0)
stuInfo = (DocuStuInfo) list.get(0);
}
// if (bookID != null && bookID != "") {
// list = null;
// list = dao.QueryObject("from BookBorrowInfo where
// bookReginster.bookId='" + bookID
// + "'");
// if (list != null && list.size() > 0)
// bookDetail = (BookReginster) list.get(0);
// }
if (stuInfo != null && bookID != null) {
list = null;
String sql = "from BookBorrowInfo where docuStuInfo.stuId='"
+ stuInfo.getStuId() + "' and bookReginster.bookId='"
+ bookID + "'";
list = dao.QueryObject(sql);
if (list != null && list.size() > 0)
borrowInfo = (BookBorrowInfo) list.get(0);
}
if (submit != null && stuId != null) {// 如果是通过按钮提交,删除记录
list = null;
list = dao
.QueryObject("from BookBorrowInfo where docuStuInfo.stuId='"
+ stuId
+ "' and bookReginster.bookId='"
+ bookID
+ "'");
if (list != null && list.size() > 0)
dao.DeleteObject(list.get(0));
list = dao
.QueryObject("from BookBorrowInfo where docuStuInfo.stuId='"
+ stuId + "'");
System.out.println("submit list=" + list);
model = new HashMap();
model.put("stu", stuInfo);
model.put("list", list);
return new ModelAndView(getBorrowReturnPage(), "info", model);
}
list = dao.QueryObject("from BookBorrowInfo where docuStuInfo.stuId='"
+ stuId + "'");
model = new HashMap();
model.put("stu", stuInfo);
// model.put("book", bookDetail);
model.put("borrow", borrowInfo);// 借阅表的信息
model.put("list", list);
return new ModelAndView(getBorrowReturnPage(), "info", model);
}
public ModelAndView borrowSearch(HttpServletRequest req,
HttpServletResponse res) {
List list = null;
String submit = req.getParameter("Submit");
String showAll = req.getParameter("ShowAll");
if (submit != null) {
String conditionContent = req.getParameter("conditionContent");
String condition = req.getParameter("condition");
if (condition.equals("书号"))
condition = "bookReginster.bookId";
else if (condition.equals("学号"))
condition = "docuStuInfo.stuId";
else {
condition = "borrowDate";
}
if (!condition.equals("borrowDate"))
list = dao.QueryObject("from BookBorrowInfo where " + condition
+ " = '" + conditionContent + "'");
else
list = dao.QueryObject("from BookBorrowInfo where " + condition
+ " >= '" + conditionContent + " 00:00:00' and "
+ condition + " <= '" + conditionContent + " 23:59:59'");
System.out.println(list.size());
}
if (showAll != null)
list = dao.QueryObject("from BookBorrowInfo");
return new ModelAndView(getBorrowSearchPage(), "list", list);
}
public String getAddPage() {
return addPage;
}
public void setAddPage(String addPage) {
this.addPage = addPage;
}
public void setDao(DAOSupport dao) {
th
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
系统介绍 校园管理系统主要实现以下目标:对师生档案的管理,学生成绩的管理、教职工的管理,如:班主任的任职,教师的授课科目等;课程代码的维护。 操作注意事项 本系统的基本用户名为:mr,密码为:mrsoft 操作流程 登录成功后,可进入系统,系统包括如图1.4左侧功能列表的相关功能。 Web开发是为Internet(World Wide Web)或Intranet(私有网络)开发网站所涉及的工作。Web开发的范围可以从开发简单的纯文本单个静态页面到复杂的基于Web的Internet应用程序(Web应用程序)。 WEB,在英语中web即表示网页的意思,它用于表示Internet主机上供外界访问的资源。 Internet上供外界访问的Web资源分为: 静态web资源(如html 页面):指web页面中供人们浏览的数据始终是不变。 动态web资源:指web页面中供人们浏览的数据是由程序产生的,不同时间点访问web页面看到的内容各不相同。 静态web资源开发技术:Html 常用动态web资源开发技术:JSP/Servlet、ASP、PHP等 在Java中,动态web资源开发技术统称为Javawe
资源推荐
资源详情
资源评论
收起资源包目录
基于javaWeb SSM框架实现校园管理系统项目设计源码和文档 (215个子文件)
BookManager.class 9KB
SourceLoader.class 9KB
InfoListController.class 8KB
EmployeeLoader.class 6KB
SystemCodeControl.class 6KB
TeaInfoController.class 5KB
SystemClassControl.class 5KB
DocuTeaInfo.class 5KB
StuInfoController.class 4KB
SourceAddBatch.class 4KB
SourceInfoList.class 4KB
BookReginster.class 3KB
TeaLoader.class 3KB
BookBorrowInfo.class 3KB
AddUserController.class 3KB
SysCodeForm.class 3KB
DAOSupport.class 3KB
LoginController.class 3KB
DocuStuInfo.class 3KB
SearchUser.class 3KB
DocuStuRegister.class 2KB
CourseStuInfo.class 2KB
EmplAssignCourse.class 2KB
EmplAssignCharge.class 2KB
SystemClassInfo.class 2KB
Login.class 1KB
TeaRegLoader.class 1KB
SystemClassInfoList.class 1KB
DateEditor.class 1KB
SystemSpecialtyCode.class 1021B
SystemCourseCode.class 1015B
SystemGradeCode.class 1015B
.classpath 3KB
org.eclipse.wst.jsdt.ui.superType.container 49B
main.css 2KB
style.css 1KB
left.css 968B
Thumbs.db 12KB
Thumbs.db 11KB
Thumbs.db 5KB
程序使用说明.doc 592KB
mrbiao.gif 7KB
menu3.gif 5KB
tabright.gif 4KB
tableft.gif 849B
button_03.gif 467B
addUser.jsp_preview_.html 1KB
spring.jar 2.45MB
hibernate3.jar 1.88MB
jgroups-2.2.8.jar 1.54MB
ant-1.6.5.jar 1010KB
xerces-2.6.2.jar 987KB
jboss-jmx.jar 578KB
sqljdbc.jar 570KB
jboss-common.jar 570KB
c3p0-0.9.0.jar 476KB
proxool-0.8.3.jar 465KB
antlr-2.7.6rc1.jar 434KB
standard.jar 384KB
jboss-cache.jar 366KB
log4j-1.2.11.jar 342KB
dom4j-1.6.1.jar 307KB
cglib-2.1.3.jar 276KB
jaxen-1.1-beta-7.jar 222KB
jboss-system.jar 218KB
commons-collections-2.1.1.jar 171KB
concurrent-1.3.2.jar 167KB
cleanimports.jar 139KB
syndiag2.jar 139KB
xml-apis.jar 121KB
junit-3.8.1.jar 118KB
oscache-2.1.jar 112KB
jaas.jar 102KB
ant-junit-1.6.5.jar 72KB
commons-logging.jar 52KB
ehcache-1.1.jar 46KB
commons-logging-1.0.4.jar 37KB
swarmcache-1.0rc2.jar 30KB
asm.jar 26KB
jacc-1_0-fr.jar 24KB
jstl.jar 20KB
connector.jar 18KB
asm-attrs.jar 16KB
ant-launcher-1.6.5.jar 9KB
jta.jar 9KB
ant-swing-1.6.5.jar 7KB
jdbc2_0-stdext.jar 7KB
versioncheck.jar 6KB
ant-antlr-1.6.5.jar 6KB
BookManager.java 10KB
SourceLoader.java 9KB
InfoListController.java 8KB
SystemCodeControl.java 7KB
EmployeeLoader.java 6KB
DocuTeaInfo.java 4KB
SourceAddBatch.java 4KB
BookReginster.java 4KB
SystemClassControl.java 3KB
TeaInfoController.java 3KB
StuInfoController.java 3KB
共 215 条
- 1
- 2
- 3
资源评论
大雄是个程序员
- 粉丝: 4261
- 资源: 571
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功