Map<UUID, Data> refDataMap = new LinkedHashMap<UUID, Data>();
String fieldColName = FieldNameCache.getInstance().getFieldName(fieldId ,templateId);
String[] allRefValue = new DataAccessSessionMySQL().queryFieldByTemplate(templateId, fieldColName);
for(String refValue : allRefValue){
if (refValue == null || refValue.length() ==0) {
continue;
}
if(field.getDataType().equals(DataType.dt_single)){
whereMap.put("id", refValue);
List<Data> refData = new DataAccessSessionMySQL().queryDatas(TableRuleManager.getInstance().getAllDataTables(), queryFieldsList, whereMap, null, null,false,templateId);
if(refData != null && refData.size() > 0){
refDataMap.put(DataAccessFactory.getInstance().createUUID(refValue), refData.get(0));
}
}
else{
String[] allRefValus = refValue.split(",");
if(allRefValus == null){
continue;
}
for(String refDataId : allRefValus){
UUID refId = DataAccessFactory.getInstance().createUUID(refDataId);
if(refDataMap.containsKey(refId)){
continue;
}
whereMap.put("id", refDataId);
List<Data> refData = new DataAccessSessionMySQL().queryDatas(TableRuleManager.getInstance().getAllDataTables(), queryFieldsList, whereMap, null, null,false,templateId);
if(refData != null && refData.size() > 0){
refDataMap.put(DataAccessFactory.getInstance().createUUID(refValue), refData.get(0));
}
}