后台dao层接口:
Map<String,Object> detail(IwResultSpot vo);
中间层:
//接收为map Map<String,Object> map = this.detail(vo); List list1 = new ArrayList(); list1.add(map); Object n = 0; for (int i=0;i<list1.size();i++) { Map map1=(Map)list1.get(i); Iterator iterator = map1.keySet().iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); Object object = map1.get(key); if("D_CNT".equals(key)){ n = object; break; } } }
//把obj转string再转int int count = Integer.parseInt(n.toString());
因为我的D_CNT是select count(*)查出来的数字,所以我直接将obj转string 再转int,然后对这个count进行业务上的判断