Mybatis 存储过程调用

1 存储过程

create or replace procedure proc_bus_tendstatus(v_tendid in Integer,cur_tendstatus out sys_refcursor)
as
v_zbbg varchar2(2);--生命变量
begin
     
    --编写逻辑体内容
      commit;
      --返回游标
      open cur_tendstatus for
      select * from tp_buss_tendstatus where tendid = v_tendid;

end proc_bus_tendstatus;

 

2 mapper.xml 文件配置

<select id="queryTenderStByTendid" statementType="CALLABLE" parameterType="Map">
        call proc_bus_tendstatus(
            #{tendid,mode=IN,jdbcType=NUMERIC,javaType=Integer},
            #{tenderSts,mode=OUT,jdbcType=CURSOR,javaType=java.sql.ResultSet,resultMap=tenderStMap}
        )
</select>

 

3 Dao 层编码

public List<TenderStBean> queryTenderStByTendid(int tendid) {
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("tendid", tendid);
        this.getSqlSession().selectList("ebidding.sp.tendrep.Project.queryTenderStByTendid", map);
        List<TenderStBean> rows = (List<TenderStBean>)map.get("tenderSts");
        return rows;
}

 

你可能感兴趣的:(Mybatis 存储过程调用)