输入参数 ParameterType 为: HashMap
1.java入参 HashMap<String, Object>
2.调用存储过程
(1)创建存储过程 输入参数是map
sqlplus scott/tiger
(2)SQL> create procedure queryCountByGradeWithProcedure(gName in varchar, scount out number)
2 as
3 begin
4 select count(1) into scount from student where graName = gName ;
5 end ;
6 /
(3)增加映射文件调用
<!-- 通过调用存储过程 -->
<select id="queryCountByGradeWithProcedure" statementType="CALLABLE" parameterType="HashMap">
{CALL queryCountByGradeWithProcedure(#{gName,jdbcType = VARCHAR,mode = IN},#{scount,jdbcType = INTEGER,mode = OUT})}
</select>
(4)增加接口方法
void queryCountByGradeWithProcedure(HashMap<String ,Object> hashmap);
(5)测试类
HashMap<String ,Object> map =new HashMap<String ,Object>();
map.put("gName","ga2");
studentmapper.queryCountByGradeWithProcedure(map);
Object acount= map.get("scount");
注:存储过程返回参数获取方式为 参数hashmap.get(参数名);