?? searchgene.java
字號:
/*
* Created on 2005-7-26
*
*/
package banksystem.business;
/**
* @author 曲本盛
*
* TODO Struts 項目實踐
*/
import banksystem.Constants;
public class SearchGene {
protected String accountID = null;
protected String startDate = null;
protected String endDate = null;
protected String userType = null;
protected String action = null;
public SearchGene(){}
public void setAction(String action){
this.action=action;
}
public void setUserType(String userType){
this.userType=userType;
}
/**
* @return Returns the accountID.
*/
public String getAccountID() {
return accountID;
}
/**
* @param accountID The accountID to set.
*/
public void setAccountID(String accountID) {
this.accountID = accountID;
}
/**
* @return Returns the endDate.
*/
public String getEndDate() {
return endDate;
}
/**
* @param endDate The endDate to set.
*/
public void setEndDate(String endDate) {
this.endDate = endDate;
}
/**
* @return Returns the startDate.
*/
public String getStartDate() {
return startDate;
}
/**
* @param startDate The startDate to set.
*/
public void setStartDate(String startDate) {
this.startDate = startDate;
}
/**
* @return String 返回用戶登錄時的Where子句。
*/
//得到登錄查詢條件
public String getLoginWhereStr(){
StringBuffer temp = new StringBuffer(" WHERE ");
temp.append("AccountID='");
temp.append(this.accountID);
temp.append("'");
if("admin".equals(this.userType)){
temp.append(" and UserType='1'");
}
else{
temp.append(" and UserType='0'");
}
temp.append(" and Status != '2' ");
return temp.toString();
}
/**
* @return String 返回交易查詢時的Where子句。
*/
//得到交易查詢條件
public String getTradeWhereStr(){
StringBuffer temp = new StringBuffer(" WHERE ");
temp.append(Constants.SQL_COLUMNNAME_ACCOUNTID);
temp.append("=");
temp.append("'");
temp.append(this.accountID);
temp.append("'");
if(this.startDate!=null&&this.endDate!=null){
temp.append(" and ");
temp.append(Constants.SQL_COLUMNNAME_TRADEDATE);
temp.append(">='");
temp.append(this.startDate);
temp.append("' and ");
temp.append(Constants.SQL_COLUMNNAME_TRADEDATE);
temp.append("<='");
temp.append(this.endDate);
temp.append("'");
}
return temp.toString();
}
/**
* @return String 返回管理員進行用戶查詢時的Where子句。
*/
//得到查詢所有客戶信息的條件
public String getCustomerWhereStr(){
return " WHERE UserType='0'";
}
/**
* @return String 返回管理員進行帳戶凍結時的Where子句。
*/
//得到凍結解凍操作的更新字符串
public String getFreezedUpdateStr() throws Exception{
StringBuffer temp = new StringBuffer(" UPDATE Customer ");
if("freezed".equals(this.action)){
temp.append(" set Status = '0'");
}
else if("thaw".equals(this.action)){
temp.append(" set Status = '1' ");
}
else if("logout".equals(this.action)){
temp.append(" set Status = '2' ");
}
else{
throw new Exception("errors.InvalidInput");
}
temp.append("WHERE AccountID ='");
temp.append(this.accountID);
temp.append("'");
temp.append(" and UserType='0' ");
return temp.toString();
}
public static void main(String arge[]){
SearchGene temp = new SearchGene();
System.out.println(temp.getTradeWhereStr());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -