mybatis执行mysql的存储过程,储蓄过程里有out参数

mybatis执行mysql的存储过程,储蓄过程里有out参数。

首先是我的储蓄过程,只是一些查询,所以全是out输出

CREATE DEFINER=`root`@`localhost` PROCEDURE `statisticsPaper`(OUT `usernum` int,OUT `papernum` int,OUT `papersubmitnum` int,OUT `paperreportingnum` int,OUT `paperpassnum` int)
BEGIN
	
SET usernum = ( SELECT count( * ) FROM USER u, user_role u_r WHERE u_r.uId = u.id AND u_r.rId = 3 );

SET papernum = ( SELECT count( * ) FROM paper );

SET papersubmitnum =  (SELECT count( * ) FROM answer_paper WHERE answer_paper.state = 0);

SET paperreportingnum =  (SELECT count( * ) FROM answer_paper WHERE answer_paper.state = 1);

SET paperpassnum =  (SELECT count( * ) FROM answer_paper WHERE answer_paper.state = 2);

END

然后是mybatis的mapper的xml

    

mapper接口方法

void FindStatistics(StatisticsPaperViewModel statisticsPaperViewModel);

最后out出来的值全在statisticsPaperViewModel里面!

over

你可能感兴趣的:(java)