Package com.starflow.wf.core.key

Examples of com.starflow.wf.core.key.CacheValue


    this.updateSQL = "UPDATE WF_PRIMARYKEY SET code = code + ? WHERE name = ? ";
    this.insertSQL = "INSERT INTO WF_PRIMARYKEY (code, name) VALUES (?, ?)";
  }

  public CacheValue getCacheValue(int cacheNum, String name) {
    CacheValue cache = null;
    try {
      cache = getCurrCode(name);
     
      if(cache == null) {
        insert(name);
            cache = getCurrCode(name);
      }
     
      update(cacheNum, name);
        cache.setMaxVal(cache.getMinVal() + cacheNum);
    } catch(Exception e) {
      logger.error("获取主键失败", e);
    }
    return cache;
  }
View Full Code Here


    }
    return cache;
  }
 
  private CacheValue getCurrCode(String name) {
    CacheValue value = null;
    try {
      Long code = jdbcTemplate.queryForLong(this.selectSQL, new Object[] {name});
      value = new CacheValue();
      value.setMinVal(code + 1);
    } catch (EmptyResultDataAccessException e) {
      logger.debug(name + " 没有找到记录");
    } catch (Exception e) {
      throw new UniqueException(name + " 获取主键失败");
    }
View Full Code Here

TOP

Related Classes of com.starflow.wf.core.key.CacheValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.