?? addcoinselectbean.java
字號:
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 AddcoinSelectBean {
String s_year= "1700", s_month = "1", s_day= "1", e_year= "2099" ,e_month= "1" ,e_day= "1",type="0",num=null;
public AddcoinSelectBean(){
}
public void setNum(String num) {
this.num = num;
}
public void setType(String type){
this.type = type;
}
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 selectAddcoin(String userID){
String type1 = null;
int j = Integer.parseInt(type);
switch (j){
case 0:
type1 = "Any";break;
case 1:
type1 = "在線充值";break;
case 2:
type1 = "個人銀行充值";break;
case 3:
type1 = "代理充值";break;
case 4:
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 addid,type,coin,datetime from buy.add where USERID ='"+ userID + "' and addid = "+num+"";
}else{
condition = "select addid,type,coin,datetime from buy.add where USERID ='"+ userID + "' and datetime <= '"+ e_date+ "'and datetime >= '" + s_date +"'";
if(j != 0){
condition += "and type ='"+type1+"'";
}
}
ResultSet rs = null;
String type, coin, date,num;
Statement sql = null;
StringBuffer buffer = new StringBuffer();
try {
Connection conn = DBConnect.getConnection();
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=" + "190" + "height=" + "25" + " class="
+ "cal_td12" + ">充值編號</td>");
buffer.append("<td width=" + "190" + "height=" + "25" + " class="
+ "cal_td12" + ">充值類型</td>");
buffer.append("<td width=" + "190" + "height=" + "25" + " class="
+ "cal_td12" + ">充值金額</td>");
buffer.append("<td height=" + "25" + " class="
+ "cal_td12" + ">充值時間</td>");
buffer.append("</TR>");
while (rs.next()) {
buffer.append("<tr align=" + "center" + ">");
num = rs.getString(1);//取得第一個字段的值
if(i%2==1){//根據奇偶行顯示不同的樣式
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td06" + ">" + num + "</TD>");
type = rs.getString(2);//取得第二個字段的值
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td06" + ">" + type + "</TD>");
coin = rs.getString(3);//取得第三個字段的值
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td06" + ">" + coin + "</TD>");
date = rs.getString(4);//取得第四個字段的值
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td06" + ">" + date + "</TD>");
}else{//偶數行的顯示
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td08" + ">" + num + "</TD>");
type = rs.getString(2);
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td08" + ">" + type + "</TD>");
coin = rs.getString(3);
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td08" + ">" + coin + "</TD>");
date = rs.getString(4);
buffer.append("<TD height=" + "20"
+ " class=" + "cal_td08" + ">" + date + "</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;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -