package com.ch11;
import java.util.*;
import java.sql.*;
import java.text.*;
public class books extends Execute_DB
{
//定义类成员变量
private long BookID;
private String BookName;
private String Author;
private String Pub;
private float Price;
private String PicUrl;
private long SortID;
private String Intro;
private int RecommendNumber;
private String strSql;
//初始化类成员变量
public books()
{
this.BookID=0;
this.BookName="";
this.Author="";
this.SortID=0;
this.Price=0;
this.Pub="";
this.PicUrl = "00000000000000.gif";
this.Intro = "";
this.RecommendNumber = 0;
this.strSql="";
}
//向books数据表中添加一条新记录
public boolean add_book()
{
this.strSql="insert into books ";
this.strSql=this.strSql + "(";
this.strSql=this.strSql + "BookName,";
this.strSql=this.strSql + "Author,";
this.strSql=this.strSql + "Pub,";
this.strSql=this.strSql + "Price,";
this.strSql=this.strSql + "SortID,";
this.strSql=this.strSql + "PicUrl,";
this.strSql=this.strSql + "Intro,";
this.strSql=this.strSql + "RecommendNumber";
this.strSql=this.strSql + ") ";
this.strSql=this.strSql + "values(";
this.strSql=this.strSql + "'" + this.BookName + "',";
this.strSql=this.strSql + "'" + this.Author + "',";
this.strSql=this.strSql + "'" + this.Pub + "',";
this.strSql=this.strSql + "'" + this.Price + "',";
this.strSql=this.strSql + "'" + this.SortID + "',";
this.strSql=this.strSql + "'" + this.PicUrl + "',";
this.strSql=this.strSql + "'" + this.Intro + "',";
this.strSql=this.strSql + "'" + this.RecommendNumber + "'";
this.strSql=this.strSql + ")";
boolean isAdd = super.exeSql(this.strSql);
return isAdd;
}
//修改类成员变量BookID对应的图书信息
public boolean modify_info()
{
this.strSql="update books set ";
this.strSql=this.strSql + "BookName=" + "'" + this.BookName + "',";
this.strSql=this.strSql + "Author=" + "'" + this.Author + "',";
this.strSql=this.strSql + "Pub=" + "'" + this.Pub + "',";
this.strSql=this.strSql + "Price=" + "'" + this.Price + "',";
this.strSql=this.strSql + "SortID=" + "'" + this.SortID + "',";
this.strSql=this.strSql + "PicUrl=" + "'" + this.PicUrl + "',";
this.strSql=this.strSql + "Intro=" + "'" + this.Intro + "'";
this.strSql=this.strSql + " where BookID=" + this.BookID;
boolean isUpdate = super.exeSql(this.strSql);
return isUpdate;
}
//删除类DeleteBookID中对应的图书信息
public boolean delete_book(String DeleteBookID)
{
this.strSql="delete from books where BookID in (";
this.strSql=this.strSql + DeleteBookID + ")";
boolean isDelete = super.exeSql(this.strSql);
return isDelete;
}
//获取类成员变量BookID对应的图书信息
public boolean init()
{
this.strSql="select * from books where BookID=";
this.strSql=this.strSql + this.BookID;
System.out.println(strSql);
try
{
ResultSet rs = super.exeSqlQuery(this.strSql);
if (rs.next())
{
this.BookID=rs.getLong("BookID");
this.BookName=rs.getString("BookName");
this.Pub=rs.getString("Pub");
this.Author=rs.getString("Author");
this.PicUrl=rs.getString("PicUrl");
this.Price=rs.getFloat("Price");
this.SortID=rs.getInt("SortID");
this.Intro=rs.getString("Intro");
this.RecommendNumber=rs.getInt("RecommendNumber");
return true;
}
else
{
return false;
}
}
catch(Exception ex)
{
return false;
}
}
//获取所有普通图书信息,返回一个ResultSet类型对象
public ResultSet show_books()
{
this.strSql="select * from books";
ResultSet rs = null;
try
{
rs = super.exeSqlQuery(this.strSql);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
return rs;
}
//获得按RecommendNumber排序的图书集合,返回一个ResultSet类型对象
public ResultSet show_books_ByRecommendNumber()
{
this.strSql="select * from books order by RecommendNumber desc";
ResultSet rs = null;
try
{
rs = super.exeSqlQuery(this.strSql);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
return rs;
}
//以BookName、Author、Pub、SortID为条件搜索books数据表,获得符合条件的记录,返回一个ResultSet类型对象
public ResultSet search_books(String BookName,String Author,String Pub,long SortID)
{
this.strSql="select * from books where";
this.strSql=this.strSql + " BookName like '%" + BookName +"%'";
this.strSql=this.strSql + " and Author like '%" + Author +"%'";
this.strSql=this.strSql + " and Pub like '%" + Pub +"%'";
if(SortID != 0)
{
this.strSql=this.strSql + " and SortID =" + SortID;
}
ResultSet rs = null;
try
{
rs = super.exeSqlQuery(this.strSql);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
return rs;
}
//更改类成员变量BookID对应的记录中RecommendNumber的值
public boolean modify_RecommendNumber()
{
this.strSql="update books set ";
this.strSql=this.strSql + "RecommendNumber=" + "'" + this.RecommendNumber + "'";
this.strSql=this.strSql + " where BookID =" + this.BookID;
boolean isUpdate = super.exeSql(this.strSql);
return isUpdate;
}
//设置类成员变量BookID的值
public void setBookID(long BookID)
{
this.BookID = BookID;
}
//获取类成员变量BookID的值
public long getBookID()
{
return this.BookID;
}
//设置类成员变量BookName的值
public void setBookName(String BookName)
{
this.BookName = BookName;
}
//获取类成员变量BookName的值
public String getBookName()
{
return this.BookName;
}
//设置类成员变量Author的值
public void setAuthor(String Author)
{
this.Author = Author;
}
//获取类成员变量Author的值
public String getAuthor()
{
return this.Author;
}
//设置类成员变量Pub的值
public void setPub(String Pub)
{
this.Pub = Pub;
}
//获取类成员变量Pub的值
public String getPub()
{
return this.Pub;
}
//设置类成员变量Price的值
public void setPrice(float Price)
{
this.Price = Price;
}
//获取类成员变量Price的值
public float getPrice()
{
return this.Price;
}
//设置类成员变量SortID的值
public void setSortID(long SortID)
{
this.SortID = SortID;
}
//获取类成员变量SortID的值
public long getSortID()
{
return this.SortID;
}
//设置类成员变量PicUrl的值
public void setPicUrl(String PicUrl)
{
this.PicUrl = PicUrl;
}
//获取类成员变量PicUrl的值
public String getPicUrl()
{
return this.PicUrl;
}
//设置类成员变量Intro的值
public void setIntro(String Intro)
{
this.Intro = Intro;
}
//获取类成员变量Intro的值
public String getIntro()
{
return this.Intro;
}
//设置类成员变量RecommendNumber的值
public void setRecommendNumber(int RecommendNumber)
{
this.RecommendNumber = RecommendNumber;
}
//获取类成员变量RecommendNumber的值
public int getRecommendNumber()
{
return this.RecommendNumber;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
网上书店系统网络书店购物系统
共65个文件
jsp:38个
class:13个
java:8个
需积分: 0 7 下载量 190 浏览量
2010-05-21
22:46:32
上传
评论
收藏 88KB ZIP 举报
温馨提示
网上书店系统网络书店购物系统网上书店系统网络书店购物系统网上书店系统网络书店购物系统网上书店系统网络书店购物系统
资源推荐
资源详情
资源评论
收起资源包目录
网络书店.zip (65个子文件)
shao
user_reg.jsp 2KB
WEB-INF
web.xml 179B
lib
catalina-root.jar 5KB
classes
Open_DB.java 852B
goods.java 3KB
sorts.java 3KB
Execute_DB.java 1KB
words.java 3KB
com
ch11
Split_Page.class 2KB
sorts.class 3KB
users.class 5KB
Open_DB.class 1KB
words.class 3KB
goods.class 3KB
Execute_DB.class 1KB
books.class 5KB
jspsmart
upload
File.class 6KB
Request.class 2KB
SmartUploadException.class 389B
SmartUpload.class 16KB
Files.class 2KB
books.java 7KB
Split_Page.java 2KB
users.java 7KB
index.jsp 2KB
get_userpassword_send.jsp 3KB
user_add.jsp 2KB
get_userpassword_form.jsp 707B
image.jsp 1KB
pic
00000000000000.gif 4KB
Thumbs.db 8KB
sql
ch11.sql 4KB
normal
book_detail.jsp 5KB
index.jsp 1KB
recommend_book.jsp 2KB
book_list.jsp 3KB
search_book_form.jsp 2KB
add_goods_save.jsp 2KB
top.jsp 2KB
add_word_save.jsp 1KB
delete_goods.jsp 1KB
recommend_book_list.jsp 2KB
add_goods_form.jsp 3KB
my_goods_management.jsp 3KB
search_book_result.jsp 3KB
admin
add_sort_form.jsp 638B
add_book_form.jsp 2KB
delete_book.jsp 1KB
index.jsp 829B
add_sort_save.jsp 1KB
sorts_management.jsp 2KB
user_detail.jsp 2KB
goods_management.jsp 4KB
top.jsp 1KB
modify_sort_form.jsp 1KB
modify_book_save.jsp 3KB
delete_goods.jsp 1KB
books_management.jsp 3KB
add_book_save.jsp 3KB
delete_sort.jsp 1KB
modify_book_form.jsp 3KB
modify_sort_save.jsp 2KB
user_login_check.jsp 2KB
logout.jsp 181B
lib
book.css 446B
共 65 条
- 1
资源评论
dreamwho
- 粉丝: 0
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功