package com.nhu.library.DAO;
import com.nhu.library.DBUtils.*;
import java.io.PrintStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;
// Referenced classes of package com.nhu.library.DAO:
// BookDetailsDAO
public class BookDetailsDAOImpl
implements BookDetailsDAO
{
public BookDetailsDAOImpl()
{
}
public List getAllBooks()
throws Exception
{
return DBUtils.DBOperationQurey("select * from tb_bookdetailsinfo");
}
public boolean updateBookStatus(String param[])
throws Exception
{
int result = -1;
result = DBUtils.DBOperationUpdate("update tb_bookdetailsinfo set bookstatus=? where bookID=?", param);
return result > 0;
}
public long getBookCanBorowDays(Object params[])
throws Exception
{
MysqlDbUtils mysqlDbUtils = new MysqlDbUtilsImpl();
Connection conn = null;
mysqlDbUtils.init();
conn = mysqlDbUtils.getConnection();
QueryRunner queryRunner = new QueryRunner();
List bookList = (List)queryRunner.query(conn, "select * from tb_booktype where bookTypeID=?", params, new MapListHandler());
int result = -1;
System.out.println(bookList.size());
result = Integer.parseInt(((Map)bookList.get(0)).get("canBrowDays").toString());
mysqlDbUtils.closeConnection(conn);
return (long)result;
}
public List getBook(String params[])
throws Exception
{
return DBUtils.DBOperationQurey("select * from tb_bookdetailsinfo,tb_booktype where isbn=? and tb_bookdetailsinfo" +
".bookTypeID=tb_booktype.bookTypeID"
, params);
}
public List getHostBooks()
throws ClassNotFoundException, SQLException
{
return DBUtils.DBOperationQurey("select * from tb_bookdetailsinfo,tb_booktype,tb_bookshelfinfo ,tb_bookborowedcou" +
"nt where tb_bookshelfinfo.bookShelfID=tb_bookType.bookShelfID and tb_bookType.bo" +
"okTypeID=tb_bookdetailsinfo.bookTypeID and tb_bookdetailsinfo.bookID=tb_bookbor" +
"owedcount.bookID order by borowedCount desc limit 0,10"
);
}
private void init()
{
}
public List getAllBooksBaicInfo()
throws ClassNotFoundException, SQLException
{
return DBUtils.DBOperationQurey("select * from tb_bookdetailsinfo");
}
public boolean deleteBookFromLibrary(String param)
{
MysqlDbUtils mysqlDbUtils;
Connection conn;
int result;
int result2;
mysqlDbUtils = new MysqlDbUtilsImpl();
conn = null;
result = -1;
result2 = -1;
mysqlDbUtils.init();
try
{
conn = mysqlDbUtils.getConnection();
} catch (SQLException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
QueryRunner queryRunner = new QueryRunner();
result2 = queryRunner.update(conn, "delete from tb_bookborowedcount where bookID=?", param);
result = queryRunner.update(conn, "delete from tb_bookdetailsinfo where bookID=?", param);
conn.commit();
conn.setAutoCommit(true);
//break MISSING_BLOCK_LABEL_178;
//SQLException e;
//e;
conn.rollback();
conn.setAutoCommit(true);
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackTrace();
}
//return false;
//SQLException e1;
//e1;
//e1.printStackTrace();
// e.printStackTrace();
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackTrace();
}
//break MISSING_BLOCK_LABEL_195;
//Exception exception;
//exception;
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackTrace();
}
//throw exception;
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackTrace();
}
return (result > 0) & (result2 > 0);
}
public boolean getbookstatus(String param)
throws Exception
{
List list = DBUtils.DBOperationQurey("select bookstatus from tb_bookdetailsinfo where bookID=?", param);
return (new Boolean(((Map)list.get(0)).get("bookstatus").toString())).booleanValue();
}
public List getAllBooksType()
throws Exception
{
return DBUtils.DBOperationQurey("select * from tb_booktype");
}
public boolean addbook(String param[])
{
MysqlDbUtils mysqlDbUtils;
Connection conn;
int result1;
int result2;
mysqlDbUtils = new MysqlDbUtilsImpl();
conn = null;
mysqlDbUtils.init();
result1 = -1;
result2 = -1;
try
{
conn = mysqlDbUtils.getConnection();
QueryRunner queryRunner = new QueryRunner();
long maxid = getMaxBookID();
System.out.println(maxid);
result1 = queryRunner.update(conn, "insert into tb_bookdetailsinfo (bookTypeID,isbn,bookName,authorName,publisherNam" +
"e,publisherTime,bookPrice,remark)values(?,?,?,?,?,?,?,?)"
, param);
maxid = getMaxBookID();
System.out.println("dd");
String bookID = (new Long(maxid)).toString();
System.out.println(bookID);
result2 = queryRunner.update(conn, "insert into tb_bookborowedcount (bookID,borowedCount)values(?,0)", bookID);
System.out.println("s");
//break MISSING_BLOCK_LABEL_171;
return false;
}
catch(SQLException e)
{
e.printStackTrace();
}
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackTrace();
}
//break MISSING_BLOCK_LABEL_188;
//Exception exception;
//exception;
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackTrace();
}
//throw exception;
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackTrace();
}
return result1 > 0 && result2 > 0;
}
public long getMaxBookID()
{
MysqlDbUtils mysqlDbUtils;
Connection conn;
long maxid;
mysqlDbUtils = new MysqlDbUtilsImpl();
conn = null;
mysqlDbUtils.init();
maxid = -1L;
try
{
conn = mysqlDbUtils.getConnection();
QueryRunner queryRunner = new QueryRunner();
List typeList = (List)queryRunner.query(conn, "select max(bookID)as bookID from tb_bookdetailsinfo", new MapListHandler());
maxid = (new Long(((Map)typeList.get(0)).get("bookID").toString())).longValue();
//break MISSING_BLOCK_LABEL_140;
return -1l;
}
catch(SQLException e)
{
e.printStackTrace();
}
try
{
mysqlDbUtils.closeConnection(conn);
}
catch(SQLException e)
{
e.printStackT
没有合适的资源?快使用搜索试试~ 我知道了~
图书管理系统借书还书等操作
共309个文件
class:88个
java:44个
jsp:42个
需积分: 0 15 下载量 7 浏览量
2016-11-10
23:05:41
上传
评论 4
收藏 10.99MB RAR 举报
温馨提示
图书管理系统借书还书等操作图书管理系统借书还书等操作图书管理系统借书还书等操作
资源推荐
资源详情
资源评论
收起资源包目录
图书管理系统借书还书等操作 (309个子文件)
fooder.bmp 121KB
BookDetailsDAOImpl.class 8KB
BookDetailsDAOImpl.class 7KB
ManageBooksAction.class 6KB
ManageBooksAction.class 6KB
testbook.class 6KB
ReaderDetailsDAO.class 6KB
testbook.class 6KB
ReaderDetailsDAO.class 5KB
FindReaderAction.class 5KB
GiveBackBookDAO.class 5KB
FindReaderAction.class 5KB
GiveBackBookDAO.class 4KB
FindBookAction.class 4KB
DBUtils.class 4KB
ManageReaderAction.class 4KB
FindBookAction.class 4KB
AddReaderAction.class 4KB
ManageReaderAction.class 4KB
AddReaderAction.class 3KB
BorowBookDAO.class 3KB
DBUtils.class 3KB
LoginDAOImpl.class 3KB
GiveBackBookAction.class 3KB
LoginDAOImpl.class 3KB
GiveBackBookAction.class 3KB
BookDetailsDAO.class 3KB
BorowBookDAO.class 3KB
AuthrityInterceptor.class 3KB
AuthrityInterceptor.class 3KB
BookDetailsDAO.class 3KB
AuthrityInterceptorPowerWithNormal.class 3KB
AuthrityInterceptorPowerWithNormal.class 3KB
BorowAction.class 3KB
BorowAction.class 3KB
FindBook.class 3KB
AddBookTypeAction.class 3KB
LoginAction.class 3KB
LoginAction.class 2KB
GetCommonsInfoAction.class 2KB
testreader.class 2KB
FindBook.class 2KB
AddReaderDAO.class 2KB
AddBookTypeAction.class 2KB
testreader.class 2KB
AddReaderDAO.class 2KB
GetCommonsInfoAction.class 2KB
testinset.class 2KB
testinset.class 2KB
ManagerRolesDAO.class 2KB
ManagerRolesDAO.class 2KB
FindReaderDAO.class 2KB
FindReaderDAO.class 1KB
UpdateManagerInfoAction.class 1KB
FindReaderTypeAction.class 1KB
UpdateManagerInfoAction.class 1KB
AddmanagerAction.class 1KB
AddmanagerAction.class 1KB
MysqlDbUtilsImpl.class 1KB
MysqlDbUtilsImpl.class 1KB
ManagerRolesAction.class 1KB
FindReaderTypeAction.class 1KB
User.class 1KB
User.class 1KB
ManagerRolesAction.class 1KB
TestGiveBack.class 1KB
TestGiveBack.class 1KB
ShowBooksAction.class 1017B
ListAction.class 995B
ShowBooksAction.class 942B
ListAction.class 920B
Testmanager.class 870B
Testmanager.class 866B
TestLogin.class 848B
TestLogin.class 844B
AddmanagerDAO.class 803B
AddBookTypesDAO.class 801B
AddBookTypesDAO.class 797B
AddmanagerDAO.class 795B
LogServlet.class 775B
LogServlet.class 771B
BookShelfDAO.class 725B
BookShelfDAO.class 671B
LoginDAO.class 558B
LoginDAO.class 558B
MysqlDbUtils.class 551B
MysqlDbUtils.class 551B
LibraryLog.class 536B
LibraryLog.class 528B
.classpath 2KB
org.eclipse.wst.common.component 453B
org.eclipse.wst.jsdt.ui.superType.container 49B
SpryMenuBarHorizontal.css 5KB
site.css 4KB
maven-theme.css 2KB
maven-base.css 2KB
displaytag.css 2KB
screen.css 2KB
alternative.css 1KB
managerroles.css 660B
共 309 条
- 1
- 2
- 3
- 4
资源评论
看我君临天下
- 粉丝: 82
- 资源: 362
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功