博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mybatis springmvc调用oracle存储过程,返回记录集
阅读量:7116 次
发布时间:2019-06-28

本文共 1603 字,大约阅读时间需要 5 分钟。

参考:

http://bbs.csdn.net/topics/390866155

辅助参考:

http://www.2cto.com/kf/201307/226848.html

http://blog.csdn.net/grhlove123/article/details/7549290

在smm中,这样的controller编写方式是不一样的;

存储过程:

create or replace procedure pro_getchart(chart_cur out sys_refcursor) isbegin  open chart_cur for    select * from dic_chart;end pro_getchart;

 

MapperXML:

 

DAO Interface:

package com.stono.dao.server.chart;import java.util.List;import java.util.Map;import com.stono.model.server.chart.DicChart;public interface DicChartMapper {         List
getChartByPro(Map
map);}

 

service :

......@Service("DicChartService")public class DicChartServiceImpl implements DicChartServiceI {         @Autowired    DicChartMapper dicChartMapper;         @SuppressWarnings("unchecked")    @Override    public List
getChartByPro() { Map
map = new HashMap
(); dicChartMapper.getChartByPro(map); return (List
) map.get("chart_cur"); }}

 

Controller:

......@Controller@RequestMapping("/DicChart")public class DicChartController {    @Autowired    DicChartServiceI chartServiceI;     @RequestMapping(value = "/getChartByPro")    @ResponseBody    List
getChartByPro() { return chartServiceI.getChartByPro(); }}

 

就是在调用Mapper的时候使用map参数,调用结束之后再用get方法得到对象;

 如果返回的是一个字段,也要用这样的方式,返回的是对象;然后再从对象中获取该属性;

 

你可能感兴趣的文章
继电器是如何成为CPU的
查看>>
分布式缓存
查看>>
Android-ViewPager+Fragment数据更新问题
查看>>
[WASM] Compile C Code into WebAssembly
查看>>
JAVA8-让代码更优雅之List排序
查看>>
为什么我的淘宝排名会突然下降?
查看>>
SecureCRT常用快捷键
查看>>
java使用Rome解析Rss的实例(转)
查看>>
零基础 Vue 开发环境搭建 打开运行Vue项目
查看>>
tensorflow 笔记12:函数区别:placeholder,variable,get_variable,参数共享
查看>>
(转)漫谈MySql中的事务
查看>>
将逗号分隔的字符串与List互转
查看>>
MongoDB下Map-Reduce使用简单翻译及示例
查看>>
Model Metadata
查看>>
对象图(Object Diagram)—UML图(三)
查看>>
300+Jquery, CSS, MooTools 和 JS的导航菜单资源(总有一个适合你!)
查看>>
梯度和方向导数的概念
查看>>
【008】Form窗体引用(dll)
查看>>
如何在类中调用session。
查看>>
使用xenu查找web站点死链接使用方法及结果分析 - Binbby - 博客园
查看>>