📄 sqlstatement.java
字号:
package com.prinice.jfoot.util.dbo;
/**
* @author:Leo
* @version:1.0
* @description:该类用于构造select,update,delete,insert等sql语句
* @date:2008-2-19
*/
public class SqlStatement {
private String cols = ""; //待查询列
private String table = ""; //待查询表
private String condition = "";//查询条件
public String getCols(){
return this.cols;
}
public void setCols(String cols){
this.cols = cols;
}
public String getTable(){
return this.table;
}
public void setTable(String table){
this.table = table;
}
public String getCondition(){
return this.condition;
}
public void setCondition(String condition){
this.condition = condition;
}
/*构造select语句*/
public String getSelectSql(){
StringBuffer sql = new StringBuffer();
return (sql.append("select ")
.append(cols)
.append(" from ")
.append(table)
.append(" where ")
.append(condition)).toString();
}
/*构造select count(1)语句*/
public String getSelectCountSql(){
StringBuffer sql = new StringBuffer();
return (sql.append("select count(1)")
.append(" from ")
.append(table)
.append(" where ")
.append(condition)).toString();
}
public String toString(){
return "[cols = " + cols + "],"
+ "[table = " + table + "],"
+ "[condition = " + condition + "]";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -