参考:
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 { ListgetChartByPro(Map map);}
service :
......@Service("DicChartService")public class DicChartServiceImpl implements DicChartServiceI { @Autowired DicChartMapper dicChartMapper; @SuppressWarnings("unchecked") @Override public ListgetChartByPro() { 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 ListgetChartByPro() { return chartServiceI.getChartByPro(); }}
就是在调用Mapper的时候使用map参数,调用结束之后再用get方法得到对象;
如果返回的是一个字段,也要用这样的方式,返回的是对象;然后再从对象中获取该属性;