Search in sources :

Example 31 with SqlQuery

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

Example 32 with SqlQuery

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

Example 33 with SqlQuery

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

Example 34 with SqlQuery

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

Example 35 with SqlQuery

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;
}
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