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;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
JavaEE项目案例源码
共34个文件
java:8个
class:8个
jsp:6个
5星 · 超过95%的资源 需积分: 50 359 下载量 68 浏览量
2008-10-14
19:23:09
上传
评论 14
收藏 540KB RAR 举报
温馨提示
在线订购子系统(JSP+JavaBean)
资源推荐
资源详情
资源评论
收起资源包目录
02.rar (34个子文件)
02
Buy
.project 1KB
.settings
org.eclipse.core.resources.prefs 88B
.mymetadata 282B
WebRoot
WEB-INF
web.xml 738B
lib
mysql-connector-java-5.0.7-bin.jar 524KB
classes
com
buy
bean
coin
OrderSelectBean.class 5KB
ConsumeSelectBean.class 4KB
ConsumeSelectBean1.class 2KB
UsercoinSelectBean.class 3KB
AddcoinSelectBean.class 4KB
comm
database
config.properties 162B
DBConnect.class 1KB
Config.class 1KB
util
EncodingFilter.class 2KB
index.jsp 847B
META-INF
MANIFEST.MF 39B
COIN
usercoin.jsp 4KB
consumerecord.jsp 8KB
order.jsp 9KB
left.jsp 2KB
addcoinrecord.jsp 9KB
Buy
scripts
style
cal
rightcal_style01.css 15KB
style.css 14KB
images
Thumbs.db 4KB
.myeclipse
src
com
buy
bean
coin
ConsumeSelectBean1.java 1KB
ConsumeSelectBean.java 4KB
AddcoinSelectBean.java 4KB
OrderSelectBean.java 6KB
UsercoinSelectBean.java 2KB
comm
database
Config.java 784B
config.properties 162B
DBConnect.java 783B
util
EncodingFilter.java 3KB
.classpath 433B
共 34 条
- 1
dg2888
- 粉丝: 10
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Disk-Drill数据恢复软件MAC版,支持最新arm架构
- 上班摸鱼神器-纯透明小说阅读工具
- 音频视频转文字3.7.7每天都可以转3小时.apk
- rain-ripples.PNG
- Gitlab: Python项目CI/CD实践 > fastapi-t1 > Dockerfile
- Epic Toon FX 史诗卡通特效 Unity像素游戏素材特效美术资源unitypackage
- 概率论与潮流统计学在时尚产业的应用(文档加Matlab源码)
- springboot的校园失物招领系统源码.zip
- Skeleton-Low Poly 低多边形骨架模型Unity插件美术资源包unitypackage
- Direct X修复工具
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页