use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class PhoneVerify method init.
public PhoneVerify init() {
// 取安全手机号,若取不到则默认等于帐号
SqlQuery ds = new SqlQuery(handle);
ds.add("select UID_,countryCode_,mobile_,securityMobile_ from %s", userTable);
ds.add("where id_='%s'", handle.getUserCode());
ds.open();
if (ds.eof()) {
throw new RuntimeException("当前用户不存在");
}
this.mobile = ds.getString("mobile_");
this.phone = mobile;
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;
}
return this;
}
use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class SecurityEnvironment method updateSecurityRecord.
public static void updateSecurityRecord(String mobile, AbstractForm form, boolean hasError) {
if ("".equals(mobile)) {
return;
}
if (!mobile.startsWith("+")) {
SqlQuery ds = new SqlQuery(form.getHandle());
ds.add("select countryCode_ from %s", SystemTable.getUserInfo);
ds.add("where mobile_='%s'", mobile);
ds.open();
if (ds.eof()) {
return;
}
mobile = ds.getString("countryCode_") + mobile;
}
SqlQuery ds = new SqlQuery(form.getHandle());
ds.add("select * from %s", SystemTable.getSecurityMobile);
ds.add("where mobile_='%s'", mobile);
ds.open();
if (ds.eof()) {
if (hasError) {
return;
}
ds.append();
ds.setField("mobile_", mobile);
ds.setField("clientId_", form.getClient().getId());
ds.setField("remoteIP_", RemoteIP.get(form));
ds.setField("errorCount_", 0);
ds.setField("userMax_", 20);
ds.setField("userCount_", 1);
ds.setField("updateUser_", form.getHandle().getUserCode());
ds.setField("updateDate_", TDateTime.Now());
ds.setField("createUser_", form.getHandle().getUserCode());
ds.setField("createDate_", TDateTime.Now());
ds.post();
} else {
ds.edit();
if (hasError) {
ds.setField("errorCount_", ds.getInt("errorCount_") + 1);
} else {
ds.setField("clientId_", form.getClient().getId());
ds.setField("remoteIP_", RemoteIP.get(form));
ds.setField("updateUser_", form.getHandle().getUserCode());
}
ds.setField("updateDate_", TDateTime.Now());
ds.post();
}
}
use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.
the class ExportChinese method writeDict.
public void writeDict(IHandle handle) {
SqlQuery ds = new SqlQuery(handle);
ds.add("select * from %s", SystemTable.getLangDict);
ds.open();
for (String text : this.getItems()) {
if (!ds.locate("cn_", text)) {
ds.append();
ds.setField("cn_", text);
ds.post();
}
}
}
Aggregations