📄 sqlwherebuilder.java
字号:
package com.gforce.currency.database;
/**
* <p>Title: 吉力科技办公自动化系统</p>
* <p>Description: 吉力科技办公自动化系统</p>
* <p>Copyright: 版权所有 2003 (c) 西安吉力科技发展有限公司 Copyright (c) 2003 GForce Sceince & Technology</p>
* <p>Company: 西安吉力科技发展有限公司 (GForce Sceince & Technology)</p>
* @author 马登军
* @version 1.0
*/
public class SQLWhereBuilder {
public SQLWhereBuilder() {
}
public static final void appendAndIfNeed(StringBuffer str) {
if (str.length() > 6) {
str.append(" and ");
}
else
{
str.append(" where ");
}
}
public static final void appendStrValue(StringBuffer str, String value) {
if (value == null) {
return;
}
else {
str.append("'");
str.append(value);
str.append("'");
return;
}
}
public static final void appendKeyLikeStr(StringBuffer str, String fieldName,
String value) {
if (value == null || value.trim().length() == 0) {
return;
}
else {
appendKeyOpStr(str, fieldName, "like",value);
return;
}
}
public static final void appendKeyEqualInt(StringBuffer str, String fieldName,
String value) {
appendKeyOpInt(str, fieldName, "=", value);
}
public static final void appendKeyOpInt(StringBuffer str, String fieldName,
String op, String value) {
if (value == null || value.trim().length() == 0) {
return;
}
else {
appendAndIfNeed(str);
str.append(fieldName);
str.append(" ");
str.append(op);
str.append(" ");
str.append(value);
return;
}
}
public static final void appendKeyOpStr(StringBuffer str, String fieldName,
String op, String value) {
if (value == null || value.trim().length() == 0) {
return;
}
else {
appendAndIfNeed(str);
str.append(fieldName);
str.append(" ");
str.append(op);
str.append(" ");
appendStrValue(str, value);
return;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -