📄 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 + -