【匯智學堂】java中使用mybatis調用存儲過程,拿到返回值(單參數返回值)

service業務層調用dao層

注意:返回值直接從對象裏獲取 不需要拿對象接收再獲取

dao.uspGetUser(userPO);//對象封裝了存儲過程的入參和出參
count = userPO.getCount();    //count 是存儲過程的返回值

dao層接口

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

mapper配置文件

<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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章