public class op_cdclass extends DataBase{
public op_cdclass() {
}
private cdclass cdclass = new cdclass(); //新的CD分类
private javax.servlet.http.HttpServletRequest request; //建立页面请求
private Vector classlist; //CD类别向量数组
public Vector getClasslist() {
return classlist;
}
public String getcdClassSql() {
sqlStr = "select id,classname from cdclass order by id";
return sqlStr;
}
//查询CD分类
public boolean seachcdClass() throws Exception {
int id = 0;
String classname = "";
int rscount = 0;
try {
DataBase db = new DataBase();
db.connect();
stmt = db.conn.createStatement ();
rs = stmt.executeQuery(getcdClassSql());
rscount = stmt.getMaxRows();
classlist = new Vector(rscount+1);
classlist.clear();
while (rs.next()){
id = rs.getInt("id");
classname = rs.getString("classname");
cdclass bc = new cdclass(id,classname);
classlist.addElement(bc);
}
close();
return true;
}
catch (SQLException sqle){
System.out.println(sqle);
return false;
}
}
//添加新CD分类时获得页面转递的分类名称
public boolean getRequest(javax.servlet.http.HttpServletRequest newrequest) {
boolean flag = false;
try{
request = newrequest;
String cdclassname = request.getParameter("cdclassname");
if (cdclassname==null || cdclassname.equals("")){
cdclassname = "";
flag = false;
}
cdclass.setClassName(cdclassname);
return true;
}catch (Exception e){
return false;
}
}
//添加新的CD分类
public boolean insert() throws Exception {
sqlStr = "insert into cdclass (classname) values ('";
sqlStr = sqlStr + dataFormat.toGb(cdclass.getClassName()) + "')";
try
{ System.out.print(sqlStr);
DataBase db = new DataBase();
db.connect();
stmt =db.conn.createStatement ();
stmt.execute(sqlStr);
return true;
}
catch (SQLException sqle)
{ System.out.print(sqle.getMessage());
return false;
}
}
//删除CD分类
public boolean delete( int aid ) throws Exception {
sqlStr = "delete from cdclass where id = " + aid ;
try
{ DataBase db = new DataBase();
db.connect();
stmt =db.conn.createStatement ();
stmt.execute(sqlStr);
return true;
}
catch (SQLException e)
{
System.out.println(e);
return false;
}
}
};
op_sale_statistics.java:
package cdshop.run;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @Singer not attributable
* @version 1.0
*/
import java.util.*;
import cdshop.util.*;
public class op_sale_statistics extends DataBase {
ArrayList al=new ArrayList();
public op_sale_statistics() {
}
public ArrayList getSaleNumOrder(String classid,String keyword)
{
String sql="";
if((classid!=null&&!classid.equals(""))&&(keyword==null||keyword.equals("")))
{ sql= "select top 100 cd.cdname cdname,sum(allorder.amount) num "+
" from allorder,cd,cdclass "+
" where allorder.cdno=cd.id "+
" and cd.cdclass=cdclass.id "+
" and cdclass.id='"+classid+"'"+
" group by cdname "+
" order by num desc ";
}
else if((classid==null||classid.equals(""))&&(keyword!=null&&!keyword.equals("")))
{ sql= "select top 100 cd.cdname cdname,sum(allorder.amount) num "+
" from allorder,cd,cdclass "+
" where allorder.cdno=cd.id "+
" and cd.cdclass=cdclass.id "+
" and cd.cdname like '%"+dataFormat.toUni(keyword)+"%' "+
" group by cdname "+
" order by num desc ";
}
else if((classid!=null&&!classid.equals(""))&&(keyword!=null&&!keyword.equals("")))
{ sql= "select top 100 cd.cdname cdname,sum(allorder.amount)
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] 下一页