package test.service;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import test.util.DbConnectionService;
import test.vo.BookInfo;
import test.vo.CatagoryInfo;
public class BookServiceImpl implements IBookService {
private Connection connection;
private Statement statement;
private ResultSet resultSet;
public BookServiceImpl() {
connection = DbConnectionService.getConnection();
try {
statement = connection.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}
}
public Boolean addBookInfo(BookInfo bookInfo) {
Boolean boolean1 = null;
String sql = "insert into book(crono,bname,author,pdate,publisher,remark,price) values("
+ bookInfo.getCrono()
+ ",'"
+ bookInfo.getBname()
+ "','"
+ bookInfo.getAuthor()
+ "','"
+ bookInfo.getPdate()
+ "','"
+ bookInfo.getPublisher()
+ "','"
+ bookInfo.getRemark()
+ "',"
+ bookInfo.getPrice() + ")";
try {
boolean1 = statement.execute(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return boolean1;
}
public List<BookInfo> getBookListInfo() {
List<BookInfo> list = new ArrayList<BookInfo>();
String sql = "select * from book";
try {
resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
list.add(new BookInfo(resultSet.getInt(1), resultSet.getInt(2),
resultSet.getString(3), resultSet.getString(4),
resultSet.getString(5), resultSet.getString(6),
resultSet.getString(7), resultSet.getFloat(8)));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
public List<BookInfo> searchBooks(String bookname) {
List<BookInfo> list = new ArrayList<BookInfo>();
String sql = "select * from book where bname like '%" + bookname + "%'";
try {
resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
list.add(new BookInfo(resultSet.getInt(1), resultSet.getInt(2),
resultSet.getString(3), resultSet.getString(4),
resultSet.getString(5), resultSet.getString(6),
resultSet.getString(7), resultSet.getFloat(8)));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
public Boolean delBookInfo(int bookno) {
Boolean result = null;
String sql = "delete from book where bookno=" + bookno;
try {
result = statement.execute(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
public Boolean updateBookInfo(BookInfo bookInfo) {
Boolean result = null;
String sql = "update bookinfo set crono='" + bookInfo.getCrono()
+ "', bname='" + bookInfo.getBname() + "',author='"
+ bookInfo.getAuthor() + "',pdate='" + bookInfo.getPdate()
+ "',publisher='" + bookInfo.getPublisher() + "',remark='"
+ bookInfo.getRemark() + "',price =" + bookInfo.getPrice();
try {
result = statement.execute(sql);
} catch (SQLException e) {
e.printStackTrace();
}
return result;
}
public BookInfo searchBooks(int bookno) {
return null;
}
public BookInfo getOneBookBybookID(int bookno) {
BookInfo bookInfo = null;
String sql = "select * from book where bookno=" + bookno;
try {
resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
bookInfo = new BookInfo(resultSet.getInt(1), resultSet
.getInt(2), resultSet.getString(3), resultSet
.getString(4), resultSet.getString(5), resultSet
.getString(6), resultSet.getString(7), resultSet
.getFloat(8));
}
} catch (SQLException e) {
e.printStackTrace();
}
return bookInfo;
}
public List<BookInfo> showCatagoryBook(int crono) {
List<BookInfo> list = new ArrayList<BookInfo>();
String sql = "select * from book where crono=" + crono;
try {
resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
list.add(new BookInfo(resultSet.getInt(1), resultSet.getInt(2),
resultSet.getString(3), resultSet.getString(4),
resultSet.getString(5), resultSet.getString(6),
resultSet.getString(7), resultSet.getFloat(8)));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
网上购物系统(JavaBean+Servlet+jsp).zip项目JAVA源码+资料打包下载
共166个文件
java:50个
class:50个
jsp:29个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 79 浏览量
2022-03-11
19:19:59
上传
评论 3
收藏 6.2MB ZIP 举报
温馨提示
网上购物系统(JavaBean+Servlet+jsp).zip项目JAVA源码+资料打包下载网上购物系统(JavaBean+Servlet+jsp).zip项目JAVA源码+资料打包下载 1.适合学生做毕业设计参考 2.适合个人学习技术研究参考 3.适合小公司做对应项目参考
资源推荐
资源详情
资源评论
收起资源包目录
网上购物系统(JavaBean+Servlet+jsp).zip项目JAVA源码+资料打包下载 (166个子文件)
zuo.bmp 20KB
ming.bmp 16KB
jintian.bmp 15KB
xinxi.bmp 8KB
leibie.bmp 8KB
yonghu.bmp 5KB
BookServiceImpl.class 5KB
OrderdetailsServiceImpl.class 5KB
OrderServiceImpl.class 4KB
CatagoryServiceImpl.class 4KB
AddordersServlet.class 3KB
UserinfoServiceImpl.class 3KB
MessageBoardServiceImpl.class 3KB
RandomCodeServlet.class 3KB
Userinfo.class 3KB
AdminLogin.class 3KB
UserLogin.class 3KB
BookInfo.class 2KB
CartItem.class 2KB
AddCartServlet.class 2KB
RegistUserinfo.class 2KB
Orderdetails.class 2KB
AdminServiceImpl.class 2KB
ShowUser.class 2KB
AddBookInfo.class 2KB
CheckUnameServlet.class 2KB
PageShowCatagoryList.class 2KB
PageShowMessageList.class 2KB
SaveUpdateCatagoryInfo.class 2KB
TestDatabase.class 2KB
MessageInfo.class 2KB
UpdateOrderServlet.class 2KB
ShowCatagoryBook.class 2KB
UpdateCatagoryInfo.class 2KB
ShowMyOrders.class 2KB
AddCatagory.class 2KB
SearchBooks.class 2KB
Order.class 2KB
DelCatagoryInfo.class 2KB
AddMessageInfo.class 1KB
UpdateBookInfo.class 1KB
DelBookInfo.class 1KB
ExitAdminLoginServlet.class 1KB
InvalidateUser.class 1KB
CatagoryInfo.class 1KB
UserList.class 1KB
CharsetFilter.class 1KB
AdminInfo.class 1KB
DbConnectionService.class 1016B
IBookService.class 650B
ICatagoryService.class 593B
IUserinfoService.class 495B
IMessageBoardService.class 401B
IOrderdetailsService.class 396B
IOrderService.class 378B
IAdminService.class 260B
.classpath 571B
database 5KB
Thumbs.db 56KB
过客预览的功能.doc 2.57MB
课程设计报告.doc 157KB
49151889078726828812007-09-07.gif 7KB
top.gif 6KB
standard.jar 385KB
jstl.jar 21KB
BookServiceImpl.java 4KB
OrderServiceImpl.java 4KB
OrderdetailsServiceImpl.java 4KB
CatagoryServiceImpl.java 3KB
MessageBoardServiceImpl.java 3KB
UserinfoServiceImpl.java 2KB
RandomCodeServlet.java 2KB
Userinfo.java 2KB
AddordersServlet.java 2KB
AdminLogin.java 2KB
UserLogin.java 2KB
BookInfo.java 2KB
MessageInfo.java 2KB
RegistUserinfo.java 2KB
Orderdetails.java 2KB
AddCartServlet.java 2KB
PageShowMessageList.java 2KB
PageShowCatagoryList.java 1KB
CartItem.java 1KB
AddBookInfo.java 1KB
CheckUnameServlet.java 1KB
AdminServiceImpl.java 1KB
SaveUpdateCatagoryInfo.java 1KB
ShowUser.java 1KB
UpdateOrderServlet.java 1KB
AddCatagory.java 1KB
Order.java 1KB
ShowMyOrders.java 1KB
UpdateBookInfo.java 1KB
UpdateCatagoryInfo.java 1KB
TestDatabase.java 990B
ShowCatagoryBook.java 974B
AddMessageInfo.java 955B
DelCatagoryInfo.java 949B
DelBookInfo.java 949B
共 166 条
- 1
- 2
资源评论
yxkfw
- 粉丝: 82
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Java毕设项目:基于spring+mybatis+maven+mysql实现的企业财务管理系统【含源码+数据库+开题报告+毕业论文+答辩PPT】
- Sigrity Power SI 仿真分析教程与实例分析.rar
- Java毕设项目:基于spring+mybatis+maven+mysql实现的海鲜自助餐厅管理系统【含源码+数据库+毕业论文】
- Java毕设项目:基于spring+mybatis+maven+mysql实现的端游账号销售管理系统分前后台【含源码+数据库+毕业论文】
- Emby Docker镜像-4.8.8版本
- Java毕设项目:基于spring+mybatis+maven+mysql实现的校园代购服务订单管理系统分前后台【含源码+数据库+毕业论文】
- MySQL Docker镜像-v9.0.0
- 金铲铲S13双城之战自动拿牌助手2.0
- postgres Docker镜像-v16.4
- zookeeper Docker镜像-v3.9.2
- nvdiffrast frpc-linux-amd64
- sonarqube Docker镜像-v9.9.5-developer
- 华为AP无线接入控制器学习资料
- 毕设238912734017234
- adminer Docker镜像-v4.8.1
- 恒温加热台外壳3d打印件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功