use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class R method getValue.
private static String getValue(IHandle handle, String text, String language) {
SqlQuery dsLang = new SqlQuery(handle);
dsLang.add("select key_,max(value_) as value_ from %s", SystemTable.getLanguage);
dsLang.add("where key_='%s'", Utils.safeString(text));
if ("en".equals(language)) {
dsLang.add("and (lang_='%s')", language);
} else {
dsLang.add("and (lang_='%s' or lang_='en')", language);
}
dsLang.add("group by key_");
dsLang.open();
String result = dsLang.getString("value_");
return result.length() > 0 ? result : text;
}
use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class R method get.
public static String get(IHandle handle, String text) {
String language = getLanguage(handle);
if ("cn".equals(language))
return text;
// 处理英文界面
SqlQuery ds = new SqlQuery(handle);
ds.add("select value_ from %s", SystemTable.getLanguage);
ds.add("where key_='%s'", Utils.safeString(text));
if (!"en".equals(language)) {
ds.add("and (lang_='en' or lang_='%s')", language);
ds.add("order by value_ desc");
} else {
ds.add("and lang_='en'", language);
}
ds.open();
if (ds.eof()) {
ds.append();
ds.setField("key_", text);
ds.setField("lang_", language);
ds.setField("value_", "");
ds.setField("updateUser_", handle.getUserCode());
ds.setField("updateTime_", TDateTime.Now());
ds.setField("createUser_", handle.getUserCode());
ds.setField("createTime_", TDateTime.Now());
ds.post();
return text;
}
String result = "";
// 默认英文
String en_result = "";
while (ds.fetch()) {
if ("en".equals(ds.getString("lang_")))
en_result = ds.getString("value_");
else
result = ds.getString("value_");
}
if (!"".equals(result)) {
return result;
}
if (!"".equals(en_result)) {
return en_result;
}
return text;
}
use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class SvrBookInfo method getRecord.
public boolean getRecord() {
String corpNo = getDataIn().getHead().getString("corpNo");
SqlQuery ds = new SqlQuery(handle);
ds.add("select CorpNo_, Type_,ShortName_,Name_,Address_,Tel_,Status_,ManagerPhone_,StartHost_,Contact_,Authentication_ " + "from %s where CorpNo_=N'%s'", SystemTable.get(SystemTable.getBookInfo), corpNo);
ds.open();
if (ds.eof())
return false;
Record headOut = getDataOut().getHead();
headOut.setField("corpNo", ds.getString("CorpNo_"));
headOut.setField("shortName", ds.getString("ShortName_"));
headOut.setField("name", ds.getString("Name_"));
headOut.setField("address", ds.getString("Address_"));
headOut.setField("tel", ds.getString("Tel_"));
headOut.setField("managerPhone", ds.getString("ManagerPhone_"));
headOut.setField("host", ds.getString("StartHost_"));
headOut.setField("contact", ds.getString("Contact_"));
headOut.setField("authentication", ds.getString("Authentication_"));
headOut.setField("status", ds.getInt("Status_"));
headOut.setField("type", ds.getInt("Type_"));
return true;
}
use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class SvrFormTimeout method save.
// 保存Form用户请求
public boolean save() {
Record headIn = getDataIn().getHead();
SqlQuery ds = new SqlQuery(handle);
ds.setMaximum(0);
ds.add("select * from %s", SystemTable.get(SystemTable.getPageLogs));
ds.open();
ds.append();
ds.setField("CorpNo_", this.getCorpNo());
ds.setField("Page_", headIn.getString("pageCode"));
ds.setField("DataIn_", headIn.getString("dataIn"));
ds.setField("TickCount_", headIn.getDouble("tickCount"));
ds.setField("AppUser_", this.getUserCode());
ds.post();
return true;
}
use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class PhoneVerify method init.
public PhoneVerify init(String mobile) {
this.mobile = mobile;
// 取安全手机号,若取不到则默认等于帐号
SqlQuery ds = new SqlQuery(handle);
ds.add("select UID_,countryCode_,securityMobile_ from %s", userTable);
ds.add("where mobile_='%s'", Utils.safeString(mobile));
ds.open();
if (!ds.eof()) {
this.nationalCode = ds.getString("countryCode_");
String securityMobile = ds.eof() ? "" : ds.getString("securityMobile_");
if (!"".equals(securityMobile)) {
this.mobile = securityMobile;
} else if (!mobile.startsWith("+")) {
this.mobile = this.nationalCode + this.mobile;
}
} else {
this.mobile = this.nationalCode + this.mobile;
}
return this;
}
Aggregations