Search in sources :

Example 36 with SqlQuery

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;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery)

Example 37 with SqlQuery

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();
    }
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery)

Example 38 with SqlQuery

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();
        }
    }
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery)

Aggregations

SqlQuery (cn.cerc.jdb.mysql.SqlQuery)38 Record (cn.cerc.jdb.core.Record)15 Webfunc (cn.cerc.jbean.core.Webfunc)4 MemoryBuffer (cn.cerc.jbean.other.MemoryBuffer)3 BuildQuery (cn.cerc.jdb.mysql.BuildQuery)3 CustomHandle (cn.cerc.jbean.core.CustomHandle)2 IMemcache (cn.cerc.jdb.cache.IMemcache)2 JPushRecord (cn.cerc.jmis.message.JPushRecord)2 MessageRecord (cn.cerc.jmis.message.MessageRecord)2 HashMap (java.util.HashMap)2 LocalService (cn.cerc.jbean.client.LocalService)1 DataValidateException (cn.cerc.jbean.core.DataValidateException)1 ServerConfig (cn.cerc.jbean.core.ServerConfig)1 ServiceException (cn.cerc.jbean.core.ServiceException)1 UserNotFindException (cn.cerc.jbean.other.UserNotFindException)1 StubHandle (cn.cerc.jbean.rds.StubHandle)1 DataSet (cn.cerc.jdb.core.DataSet)1 SqlSession (cn.cerc.jdb.mysql.SqlSession)1 Transaction (cn.cerc.jdb.mysql.Transaction)1 Gson (com.google.gson.Gson)1