SQL view plain copy stored procedure example:
Createor replace
procedureFSP_PLAN_CHECKPRJ (V_grantno varchar2, v_deptcode number, v_cursor
outSys_refcursor)
is...---Return to the results of a statistic, or ....
OpenV_cursor
for
SelectS.plan_code, S.plan_dept, S.plan_amount, S.exec_amount, p. CName
asPlan_name, D.cname
asDept_name
fromSNAP_PLAN_CHECKPRJ s left join V_plan p
onS.plan_code = P.plan_code LEFT join Org_office D
onS.plan_dept = D.off_org_code
Group
byS.plan_code, S.plan_dept, S.plan_amount, S.exec_amount, P.cname, D.cname;
End;
EndFSP_PLAN_CHECKPRJ;
MyBatis: (MyBatis doc Api:http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#result_maps)
Java layer Code [Java] View plain copy map<string, object> params = new hashmap<string, object> (); grantsetting GS = this. Grantsettingdao.get (Grantcode); Params.put ("Grantno", stringutils. Substring (gs.getgrantno (), 0, 2)); Params.put ("Offorgcode", Securityutils.getpersonofforgcode ()); Params.put ("V_cursor", new arraylist<map<string, object>> ());//pass in a JDBC cursor to receive the return parameter this . Batisdao. Getsearchlist ("Call_fsp_plan_checkprj", params);
MyBatis XML configuration [HTML] view plain copy<ResultmapType = "Java.util.HashMap" id= "Cursormap"><。 --Configuration returns the Resultmap for the alias in the cursor-->< ResultColumn = "Plan_code" property= "Plan_code"/>< ResultColumn = "plan_dept" property= "plan_dept"/>< ResultColumn = "Plan_amount" property= "Plan_amount"/> < ResultColumn = "Exec_amount" property= "Exec_amount"/>< ResultColumn = "Plan_name" property= "Plan_name"/>< ResultColumn = "Dept_name" property= "Dept_name"/></Resultmap><Selectid = "CALL_FSP_PLAN_CHECKPRJ" parametertype= "map" statementtype= "callable"> <!--Annotated statementtype= "callable" means invoking the stored procedure--> &NBSP;&NBSP;{CALL&NBSP;FSP_PLAN_CHECKPRJ (#{grantno, jdbctype=varchar, mode=in}, #{offorgcode, jdbcType=INTEGER, mode=IN}, #{v_cursor, mode=out, jdbctype=cursor, resultmap=cursormap})} <!--incoming outgoing parameters to indicate mode=in/out and to note jdbctype (online can query MyBatis support which JdbctypeType), return the parameter to indicate the corresponding resultmap--> </Select>
Finally, just iterate through the JSP page
Params.put ("V_cursor", Oracletypes. CURSOR); V_cursor in the middle. itself is a traversal of the list result set