日期:2014-05-19  浏览次数:20634 次

求求各位大神,帮小弟解决下问题....>.<
package bean.db;
import java.io.*;

import java.sql.*;
import java.util.*;
import org.apache.struts.action.ActionForm;
import form.addBookForm;
import bean.db.common.dbOperation;

//封装对book表的操作
public class bookOPBean extends dbOperation {
private int bookid = 0;
private bookBean book = new bookBean();
private int bookTypeId = 0;

// 查询出书籍资料
public ArrayList selectBook(String bookname) {
// 构造SQL语句
String sqlString = null;
if (bookname == null || bookname.trim().length() <= 0)
sqlString = new String("select * from book ");
else
sqlString = new String("select *from book where book_name like '%"
+ bookname + "%'");
sqlString = sqlString + "order by add_time desc";
ArrayList rsArrayList = selectBookBySQL(sqlString);
return rsArrayList;
}

// 查询出最近的100本书
public ArrayList selectBook100() {
String sqlString = new String(
"select top 100 * from book order by add_time desc");
ArrayList rsArrayList = selectBookBySQL(sqlString);
return rsArrayList;
}

// 查询出特价书籍的前7本,5折用其以下的
public ArrayList selectBookMiniPriceTop7() {
String sqlString = new String(
"select top 7 * from book where price_rebate<=5 order by add_time desc");
ArrayList rsArrayList = selectBookBySQL(sqlString);
return rsArrayList;
}

// 查询出特价书籍的前6本,5折用其以下的
public ArrayList selectBookMiniPriceTop6() {
String sqlString = new String(
"select top 6 * from book where price_rebate<=5 order by add_time desc");
ArrayList rsArrayList = selectBookBySQL(sqlString);
return rsArrayList;
}

// 查询出所有特价书籍,5折用其以下的
public ArrayList selectBookMiniPriceTop() {
String sqlString = new String(
"select * from book where price_rebate<=5 order by add_time desc");
ArrayList rsArrayList = selectBookBySQL(sqlString);
return rsArrayList;
}

// 查询出最近录入的6本新书
public ArrayList selectBookTop6() {
// 构造SQL语句
String sqlString = new String(
"select top 6 * from book order by add_time desc");
// 查询出数据
ArrayList rsArrayList = selectBookBySQL(sqlString);
return rsArrayList;
}

// 查询出某个分类的前6本书籍,并按时间排序
public ArrayList selectBookByTypeTop6() {
// 构造SQL语句
String sqlString = new String("select top 6 * from book where type_id="
+ bookTypeId + " order by add_time desc");
// 查询出数据
ArrayList rsArrayList = selectBookBySQL(sqlString);
return rsArrayList;
}

// 查询出某个分类的书籍的数据,并按时间排序
public ArrayList sele