private int runServer = SwConsts.SysParam.machineId;
private EntityDao<OnetimeTask> dao = null;//DbEngine.getInstance().findDao(OnetimeTasks.class);
private EntityDao<OnetimeTask> dao;
public OnetimeTaskHelper(int runServer, EntityDao<OnetimeTask> dao) {
this.runServer = runServer;
this.dao = dao;
}
//获取所有等待中的任务,服务启动时执行一次
public List<OnetimeTask> findWaiting() {
return dao.queryWhere(" run_server=? and statu < ?", runServer, OneTimeStatu.FAILED.value);
return dao.queryWhere(" sot_run_server=? and sot_statu < ?", runServer, OneTimeStatu.FAILED.value);
}
public OnetimeTask findOneByTk(String type, String key) {
return dao.queryEntityWhere(" task_type=? and task_key=?", type, key);
return dao.queryEntityWhere(" sot_type=? and sot_code=?", type, key);
}
public boolean isExistByKey(String type, String key) {
return DbEngine.getInstance().isExists("select task_id from " + EntityHelper.getSchemaTableName(OnetimeTask.ENTITY_NAME) + " where task_type=? and task_key=?", type, key);
return DbEngine.getInstance().isExists("select sot_id from " + EntityHelper.getSchemaTableName(OnetimeTask.ENTITY_NAME) + " where sot_type=? and sot_code=?", type, key);
}
public void updateTask(OnetimeTask task) {
@@ -51,13 +56,13 @@ public final class OnetimeTaskHelper {