Search in sources :

Example 26 with Record

use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.

the class AppSessionRestore method byUserCode.

public boolean byUserCode() throws ServiceException, UserNotFindException {
    Record headIn = getDataIn().getHead();
    DataValidateException.stopRun("用户id不允许为空", !headIn.hasValue("userCode"));
    String userCode = headIn.getString("userCode");
    SqlQuery cdsUser = new SqlQuery(this);
    cdsUser.add("select ID_,Code_,RoleCode_,DiyRole_,CorpNo_, Name_ as UserName_,ProxyUsers_");
    cdsUser.add("from %s ", SystemTable.get(SystemTable.getUserInfo));
    cdsUser.add("where Code_= '%s' ", userCode);
    cdsUser.open();
    if (cdsUser.eof()) {
        throw new UserNotFindException(userCode);
    }
    Record headOut = getDataOut().getHead();
    headOut.setField("LoginTime_", TDateTime.Now());
    copyData(cdsUser, headOut);
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) Record(cn.cerc.jdb.core.Record) UserNotFindException(cn.cerc.jbean.other.UserNotFindException)

Example 27 with Record

use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.

the class AppSessionRestore method byToken.

public boolean byToken() throws ServiceException {
    Record headIn = getDataIn().getHead();
    DataValidateException.stopRun("token不允许为空", !headIn.hasValue("token"));
    String token = headIn.getString("token");
    SqlQuery cdsCurrent = new SqlQuery(this);
    cdsCurrent.add("select CorpNo_,UserID_,LoginTime_,Account_ as UserCode_,Language_ ");
    cdsCurrent.add("from %s", SystemTable.get(SystemTable.getCurrentUser));
    cdsCurrent.add("where loginID_= '%s' ", token);
    cdsCurrent.open();
    if (cdsCurrent.eof()) {
        log.warn(String.format("token %s 没有找到!", token));
        CustomHandle sess = (CustomHandle) this.getProperty(null);
        sess.setProperty(Application.token, null);
        return false;
    }
    String userId = cdsCurrent.getString("UserID_");
    SqlQuery cdsUser = new SqlQuery(this);
    cdsUser.add("select ID_,Code_,DiyRole_,RoleCode_,CorpNo_, Name_ as UserName_,ProxyUsers_");
    cdsUser.add("from %s", SystemTable.get(SystemTable.getUserInfo), userId);
    cdsUser.add("where ID_='%s'", userId);
    cdsUser.open();
    if (cdsUser.eof()) {
        log.warn(String.format("userId %s 没有找到!", userId));
        CustomHandle sess = (CustomHandle) this.getProperty(null);
        sess.setProperty(Application.token, null);
        return false;
    }
    Record headOut = getDataOut().getHead();
    headOut.setField("LoginTime_", cdsCurrent.getDateTime("LoginTime_"));
    headOut.setField("Language_", cdsCurrent.getString("Language_"));
    copyData(cdsUser, headOut);
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) Record(cn.cerc.jdb.core.Record) CustomHandle(cn.cerc.jbean.core.CustomHandle)

Example 28 with Record

use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.

the class SvrBookOption method execute.

@Override
public IStatus execute(DataSet dataIn, DataSet dataOut) throws ServiceException {
    Record head = dataIn.getHead();
    SqlQuery ds = new SqlQuery(this);
    ds.add("select Value_ from %s ", SystemTable.get(SystemTable.getBookOptions));
    ds.add("where CorpNo_ = '%s' and Code_ = '%s'", this.getCorpNo(), head.getString("Code_"));
    ds.open();
    dataOut.appendDataSet(ds);
    return success();
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) Record(cn.cerc.jdb.core.Record)

Example 29 with Record

use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.

the class IServiceProxy method put.

// update
public default boolean put(Object... args) {
    Record headIn = this.getDataIn().getHead();
    headIn.setField("_method_", "put");
    return exec(args);
}
Also used : Record(cn.cerc.jdb.core.Record)

Example 30 with Record

use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.

the class IServiceProxy method get.

// select
public default boolean get(Object... args) {
    Record headIn = this.getDataIn().getHead();
    headIn.setField("_method_", "get");
    return exec(args);
}
Also used : Record(cn.cerc.jdb.core.Record)

Aggregations

Record (cn.cerc.jdb.core.Record)53 SqlQuery (cn.cerc.jdb.mysql.SqlQuery)15 LocalService (cn.cerc.jbean.client.LocalService)9 Webfunc (cn.cerc.jbean.core.Webfunc)4 DataSet (cn.cerc.jdb.core.DataSet)4 Ignore (org.junit.Ignore)4 Test (org.junit.Test)4 MemoryBuffer (cn.cerc.jbean.other.MemoryBuffer)3 StubHandle (cn.cerc.jbean.rds.StubHandle)3 IMemcache (cn.cerc.jdb.cache.IMemcache)3 MessageRecord (cn.cerc.jmis.message.MessageRecord)3 UrlRecord (cn.cerc.jpage.core.UrlRecord)3 Label (jxl.write.Label)3 CustomHandle (cn.cerc.jbean.core.CustomHandle)2 IService (cn.cerc.jbean.core.IService)2 IStatus (cn.cerc.jbean.core.IStatus)2 UserNotFindException (cn.cerc.jbean.other.UserNotFindException)2 QueueQuery (cn.cerc.jdb.queue.QueueQuery)2 Column (cn.cerc.jexport.excel.Column)2 JPushRecord (cn.cerc.jmis.message.JPushRecord)2