首页 > 编程知识 正文

mybatis调用存储过程返回结果集,mybatis存储过程返回游标

时间:2023-05-05 10:15:29 阅读:209446 作者:2718

service业务层调用dao层

注意:返回值直接从对象里获取 不需要拿对象接收再获取

dao.uspGetUser(userPO);//对象封装了存储过程的入参和出参 count = userPO.getCount(); //count 是存储过程的返回值:从对象在获取返回值

dao层接口

public interface userDao { Integer uspGetUser(UserPO userPO); }

mapper配置文件:配置中的count对应UserPO中参数字段

<select id="uspGetUser" statementType="CALLABLE" parameterType="com.entity.UserPO" resultType="integer"> call usp_get_user( #{id,mode=IN,jdbcType=VARCHAR}, #{name,mode=IN,jdbcType=VARCHAR}, #{count,mode=OUT,jdbcType=VARCHAR}); </select>


参考::https://blog.csdn.net/qq_38187437/article/details/84872758

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。