Mybatis 调用存储过程

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sm.able.Userable">
<!-- 调用存储过程 -->
	<select statementType="CALLABLE" id="executeAddUser" parameterType="User">
		{call usp_add_user(#{id},#{name})}
	</select>
<!-- 调用存储过程实现分页功能 ,带输出参数(游标,总页数)-->
	<select statementType="CALLABLE" id="splitPage" parameterType="map">
		{call usp_split_user(
			#{tabName},#{currentPage},#{pageSize},#{total,mode=OUT,jdbcType=INTEGER},
			#{result, mode=OUT, jdbcType=CURSOR,javaType=ResultSet,resultMap=userMap}
		)}
	</select>
	<resultMap type="User" id="userMap">
		<id column="id" property="id"/>
		<result column="name" property="name" />
	</resultMap>
</mapper>

猜你喜欢

转载自liguanfeng.iteye.com/blog/2202409