Public Result selectChild (Long departmentId) {
Try {
MapParamentMap=Collections. SingletonMap (" departmentId ", departmentId);
String sqlText="MATCH (N: WechatDepartment) - [child] - & gt; (M: WechatDepartment) \ n + "
"WHERE N.d epartmentId={departmentId} \ n" +
"RETURN ID (M) as ID, m. epartmentId as departmentId, M.n ame as the name, M.o rder as order, M.e nable as enable";
//returns an org. Secondary. Driver. The Result type
Result the Result=session. The run (sqlText paramentMap);
//needs into List
//1 List< method; Record> The list ();
ListRecords.=the result list ();
//method 2 & lt; T> ListThe list (Function Var1)
?????
return result;
} the catch (Exception e) {
System.out.println(e);
Throw e;
} the finally {
//the session. The close ();
}
}
Public interface Result extends Iterator{
ListKeys ();
Boolean hasNext ();
Record next ();
Record in use () throws NoSuchRecordException;
Record the peek ();
StreamThe stream ();
ListThe list (); List The list (Function Var1);
ResultSummary consume ();
}
CodePudding user response:
You can define a Function object, and then passed to the method of listFunction
The return from pumped WechatDepartment logical record;
//such as WechatDepartment department=new WechatDepartment ();
Department. Elegantly-named setName (record. GetName)
Department. SetCode (record. GetDeptCode);
Return department;
}
List