public static Persistable getPersistable(String number,
Class clazz, String stateStr) throws WTException {
QueryResult result = null;
try {
QuerySpec queryspec = new QuerySpec(clazz);
LifeCycleConfigSpec lifecycleConfig = new LifeCycleConfigSpec();
lifecycleConfig.setLifeCycleState(State.toState(stateStr.toUpperCase()));
queryspec = lifecycleConfig.appendSearchCriteria(queryspec);
WhereExpression where = new SearchCondition(clazz, "master>number", "=", number);
if(queryspec.getConditionCount()>0 && queryspec.getWhere().endsWith(")")){
queryspec.appendAnd();
}
queryspec.appendWhere(where, new int[] { 0 });
result = PersistenceHelper.manager.find((StatementSpec) queryspec);
LatestConfigSpec configSpec = new LatestConfigSpec();
result = configSpec.process(result);
} catch (Exception e) {}}
查询某个状态的最新版本对象
最新推荐文章于 2021-12-09 16:25:40 发布