queryExpandTo.setLeftJoinSql("left join fixflow_def_processdefinition on processdefinition_id = fixflow_def_processdefinition.process_id");
//增加扩展查询
processInstanceQuery.queryExpandTo(queryExpandTo);
//查询TaskServiceNewTest经过扩展查询后的结果
processInstanceQuery.processDefinitionKey("TaskServiceNewTest");
list = processInstanceQuery.list();
//获取第一个流程实例结果
ProcessInstance processInstance = list.get(0);
//获取扩展查询的字段
String process_name = (String)processInstance.getExtensionField("PROCESS_NAME");
String RESOURCE_NAME = (String)processInstance.getExtensionField("RESOURCE_NAME");