0 0

ibatis调用mysql存储过程返回多个表结果集问题0

ibatis调用mysql存储过程返回多个表结果集,但是只能取到一个查询的结果

首先上存储过程代码:

 

CREATE PROCEDURE  getInfo(in rob_id INT, in name VARCHAR(50))
BEGIN
    declare my_id int DEFAULT 0;

    select * from t_rob hr where hr.id=rob_id;
    
    select * from t_rob_prize hrp where hrp.robId=rob_id;

    select id into my_id from t_rob_my where robId=rob_id and name=name LIMIT 0,1;

    select hrm.id,hrm.robId,hrm.wxNunber,hrm.exchange,hrm.createTime from t_help_rob_my hrm where hrm.id=my_id;
    
    select * from t_help_rob_help hrh where hrh.myId=my_id;
END

 ibatis配置:

 

 

<parameterMap id="robIndexParameter" class="java.util.HashMap">
        <parameter property="rob_id" jdbcType="int" javaType="java.lang.Integer" mode="IN"/>
        <parameter property="name" jdbcType="varchar" javaType="java.lang.String" mode="IN"/>
    </parameterMap>

<resultMap id="helprobInfoResultMap" class="helprobInfo">
        。。。。。。
</resultMap>

<resultMap id="helprobPrizeInfoResultMap" class="helprobPrizeInfo">
        。。。。。
    </resultMap>

<resultMap id="helprobMyInfoResultMap" class="helprobMyInfo">
        。。。。。
    </resultMap>
<resultMap id="helprobHelpInfoResultMap" class="helprobHelpInfo">
。。。。。
    </resultMap>
<!-- 总共四个resultMap -->

 存储过程调用:

 

 

<procedure id="geRobIndexInfo" parameterMap="robIndexParameter"
               resultMap="helprobInfoResultMap,helprobPrizeInfoResultMap,helprobMyInfoResultMap,helprobHelpInfoResultMap">
        {call getInfo(?,?)}
    </procedure>

调用的时候只返回helprobInfoResultMap的值,其它是三个resultMap的值没有返回

paramters.put("rob_id", robId);
paramters.put("name", name);
sqlMapClient.queryForList("RobDAO.geRobIndexInfo", paramters);

 求大神解答


问题补充:mysql版本5.5,ibatis版本是2.3.4
2014年8月09日 17:52
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics