String resultMapSelect = select.getResultMap();
if (StringUtil.isNotEmpty(resultMapSelect)) {
ResultMap resultMap = processEngineConfiguration.getResultMap(resultMapSelect);
if (resultMap == null) {
throw new FixFlowDbException("resultMap " + resultMap + " 未找到!");
}
String mappingType = resultMap.getType();
if (StringUtil.isNotEmpty(mappingType)) {
AbstractPersistentObject persistentObject = (AbstractPersistentObject) ReflectUtil.instantiate(mappingType);
if (returnObjList instanceof List) {
List listObj = (List) returnObjList;
if (listObj.size() == 1 && listObj.get(0) instanceof Map) {
persistentObject.persistentInit(resultMap, (Map) listObj.get(0));
persistentObject.setAdd(false);
scriptLanguageMgmt.setVariable("parameter", parameterOld);
return persistentObject;
}
} else {
if (returnObjList instanceof Map) {
persistentObject.persistentInit(resultMap, (Map) returnObjList);
scriptLanguageMgmt.setVariable("parameter", parameterOld);
return persistentObject;
}
}
scriptLanguageMgmt.setVariable("parameter", parameterOld);
return persistentObject;
} else {
throw new FixFlowDbException("resultMap: " + resultMap + "中的 mappingType为空!");
}
}
}