?目录
CREATE OR REPLACE PROCEDURE proc_test2(p_id IN NUMBER,
v_cur OUT SYS_REFCURSOR,
p_result_code OUT NUMBER,
p_result_message OUT VARCHAR2) AS
BEGIN
p_result_message := '成功';
p_result_code := '1';
open v_cur for
select 1 id, 'test01' name
from dual
union all
select 2, 'test02' from dual;
END;
????????
<resultMap id="BaseResultMap2" type="com.lxw.lxwDemo.pojo.Test">
<id column="ID" property="id" jdbcType="DECIMAL" />
<result column="NAME" property="name" jdbcType="VARCHAR" />
</resultMap>
<select id="proc_test2" statementType="CALLABLE">
{call proc_test2(
#{p_id,jdbcType=DECIMAL,mode=IN},
#{v_cur,jdbcType=CURSOR,mode=OUT,resultMap=BaseResultMap2,javaType=java.sql.ResultSet},
#{p_result_code,jdbcType=DECIMAL,mode=OUT},
#{p_result_message,jdbcType=VARCHAR,mode=OUT}
)}
</select>
void proc_test2(Map map);
@Autowired
private TestMapper testMapper;
@Test
public void proc_test2() {
Map map=new HashMap();
testMapper.proc_test2(map);
List<com.lxw.lxwDemo.pojo.Test> tests= (List) map.get("v_cur");
System.out.println(map);
System.out.println(JSON.toJSONString(map));
System.out.println(JSON.toJSONString(tests));
}
???????