package com.buy.bean.coin;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.buy.bean.comm.database.DBConnect;
public class OrderSelectBean {
String s_year = "1700", s_month = "1", s_day = "1", e_year = "2099",
e_month = "1", e_day = "1", status = "0", num=null;
public void setNum(String num) {
this.num = num;
}
public void setStatus(String status) {
this.status = status;
}
public void setS_year(String s_year) {
this.s_year = s_year;
}
public void setS_month(String s_month) {
this.s_month = s_month;
}
public void setS_day(String s_day) {
this.s_day = s_day;
}
public void setE_year(String e_year) {
this.e_year = e_year;
}
public void setE_month(String e_month) {
this.e_month = e_month;
}
public void setE_day(String e_day) {
this.e_day = e_day;
}
public StringBuffer selectOrder(String userID) {
String type1 = null;
int j = Integer.parseInt(status);
switch (j) {
case 0:
type1 = "Any";
break;
case 1:
type1 = "正在处理";
break;
case 2:
type1 = "支付成功";
break;
case 3:
type1 = "支付失败";
break;
}
String s_date = s_year + "-" + s_month + "-" + s_day;
String e_date = e_year + "-" + e_month + "-" + e_day;
String condition;
if(num!=null){
condition = "select orderid,type,price,datetime,productname from buy.order where USERID ='"+ userID + "' and orderid = "+num+"";
}else{
condition = "select orderid,type,price,datetime,productname from buy.order where USERID ='"+ userID + "' and datetime <= '"+ e_date+ "'and datetime >= '" + s_date +"'";
if(j != 0){
condition += "and type ='"+type1+"'";
}
}
System.out.println(condition);
ResultSet rs = null;
Statement sql = null;
String status, coin, date, num,name;
StringBuffer buffer = new StringBuffer();
try {
Connection conn = DBConnect.getConnection();
System.out.println(conn.isClosed());
sql = conn.createStatement();
rs = sql.executeQuery(condition);
int i = 1;
buffer.append("<table width=" + "100%" + " border=" + "0"
+ " cellpadding=" + "0" + " cellspacing=" + "1" + ">");
buffer.append("<tr align=" + "center" + ">");
buffer.append("<td width=" + "150" + "height=" + "25"
+ " class=" + "cal_td12" + ">订单号</td>");
buffer.append("<td width=" + "180" + "height=" + "25"
+ " class=" + "cal_td12" + ">订单状态</td>");
buffer.append("<td width=" + "150" + "height=" + "25"
+ " class=" + "cal_td12" + ">金额</td>");
buffer.append("<td width=" + "150" + "height=" + "25"
+ " class=" + "cal_td12" + ">订单创建时间</td>");
buffer.append("<td width=" + "150" + "height=" + "25"
+ " class=" + "cal_td12" + ">订购商品名称</td>");
buffer.append("</TR>");
while (rs.next()) {
buffer.append("<tr align=" + "center" + ">");
if (i % 2 == 1) {
//取得结果集中一条记录的第一个字段,付给num
num = rs.getString(1);
buffer.append("<TD width=" + 180 + " height=" + "20"
+ " class=" + "cal_td06" + ">" + num
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
status = rs.getString(2);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td06" + ">" + status
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
coin = rs.getString(3);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td06" + ">" + coin
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
date = rs.getString(4);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td06" + ">" + date
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
name = rs.getString(5);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td06" + ">" + name
+ "</TD>");
} else {
// 取得结果集中一条记录的第一个字段,付给num
num = rs.getString(1);
buffer.append("<TD width=" + 180 + " height=" + "20"
+ " class=" + "cal_td08" + ">" + num
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
status = rs.getString(2);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td08" + ">" + status
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
coin = rs.getString(3);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td08" + ">" + coin
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
date = rs.getString(4);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td08" + ">" + date
+ "</TD>");
// 取得结果集中一条记录的第一个字段,付给num
name = rs.getString(5);
buffer.append("<TD width=" + 150 + " height=" + "20"
+ " class=" + "cal_td08" + ">" + name
+ "</TD>");
}
buffer.append("</TR>");
i++;
}
buffer.append("</Table>");
rs.close();
sql.close();
conn.close();
// }
} catch (SQLException ex) {
System.out.println("TradeDB SQLException: " + ex.getMessage());
return new StringBuffer("查询错误");
}
return buffer;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
四个小系统,运用jsp,javabean,servlet,struts (531个子文件)
User.class 5KB
OrderSelectBean.class 5KB
Forum.class 5KB
Notice.class 5KB
AddcoinSelectBean.class 4KB
User.class 4KB
ConsumeSelectBean.class 4KB
CheckPowerAction.class 4KB
Teacher_Manager.class 4KB
SubmitArticleAction.class 4KB
Response.class 4KB
News.class 4KB
Student_Manager.class 4KB
NewsTag.class 4KB
PopTag.class 4KB
Admin_Manager.class 4KB
UserEditAction.class 4KB
NewUserAction.class 3KB
Topic.class 3KB
TopicListAction.class 3KB
NewsTag4guest.class 3KB
DBUtil.class 3KB
News4news.class 3KB
UserEditAction.class 3KB
Project_Manager.class 3KB
AdminLoginAction.class 3KB
ForumCreateAction.class 3KB
DisplayTag.class 3KB
RegistrationAction.class 3KB
ForumEditSubmitAction.class 3KB
UserLoginAction.class 3KB
TopicDeleteAction.class 3KB
UserManagerAction.class 3KB
AdminLoginAction.class 3KB
UserDeleteAction.class 3KB
UserLoginAction.class 3KB
ForumDeleteAction.class 3KB
UserSearchAction.class 3KB
ForumManagerAction.class 3KB
TopicDisp.class 3KB
Pageable.class 3KB
NoticeModifyAction.class 3KB
UsercoinSelectBean.class 3KB
Pageable.class 3KB
Note_Manager.class 2KB
ForumEditAction.class 2KB
DataProcess.class 2KB
ResponseListAction.class 2KB
TopicSearchAction.class 2KB
SearchUserAction.class 2KB
LoginServlet.class 2KB
EditStudentServlet.class 2KB
NewTopicAction.class 2KB
Grade_Manager.class 2KB
ConsumeSelectBean1.class 2KB
EncodingFilter.class 2KB
EncodingFilter.class 2KB
EncodingFilter.class 2KB
EncodingFilter.class 2KB
RegistrationForm.class 2KB
NewNoticeAction.class 2KB
EditTeacherServlet.class 2KB
DB.class 2KB
Teacher.class 2KB
UserInfoForm.class 2KB
AddStudentServlet.class 2KB
EditProjectServlet.class 2KB
Note.class 2KB
AddTeacherServlet.class 2KB
News_Manager.class 2KB
AddManagerServlet.class 2KB
NewNoticeForm.class 2KB
NoticeModifyForm.class 2KB
EditNewsServlet.class 2KB
AddProjectServlet.class 2KB
DB.class 2KB
EditManagerServlet.class 2KB
Student.class 2KB
Project.class 2KB
AddNewsServlet.class 2KB
HelloTag.class 1KB
Config.class 1KB
AdminLogoffAction.class 1KB
AdminLogoffAction.class 1KB
UserLogoffAction.class 1KB
LogoffAction.class 1KB
DBConnect.class 1KB
Constants.class 1KB
PrepareToCreateForumAction.class 1KB
Manager.class 1KB
Grade.class 1KB
ForumManagerForm.class 1KB
ForumForm.class 1KB
UserManagerForm.class 1KB
AdminLoginForm.class 866B
UserLoginForm.class 861B
TopicManagerForm.class 860B
AdminLoginForm.class 856B
UserLoginForm.class 851B
NewArticleForm.class 830B
共 531 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- crazzy07272012-11-06不要被骗了
小曾_20171022
- 粉丝: 1
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功