Ibatis传递多个参数
<!-- 为下面查询传参 --><parameterMap id="parameterMap"> <parameter property="xwxh"/> <parameter property="nsrsbh"/> </parameterMap> <!-- 根据纳税人识别号和行为序号取得【事实信息】 --><select id="getFactByNsrAndXwxh" resultMap="factMap" parameterMap="parameterMap"> select ss.* from wfwz_ssb ss,wfwz_djb djwhere ss.djxh=dj.djxhand ss.yxbj_dm=dj.yxbj_dmand dj.yxbj_dm='01'and dj.xwxh=?and dj.nsrsbh=?</select>
?
/** * 根据纳税人识别号和行为序号取得事实信息 */@SuppressWarnings("unchecked")public List<Fact> getFactByNsrAndXwxh(HashMap<String,String> hashMap){return (List<Fact>)getAll("Fact.getFactByNsrAndXwxh", hashMap);}
?
测试
public void testGetFactByNsrAndXwxh(){FactService factService = (FactService)applicationContext.getBean("factService");HashMap<String,String> map=new HashMap<String,String>(); map.put("xwxh", "0005"); map.put("nsrsbh", "460200760106052"); List<Fact> list=factService.getFactByNsrAndXwxh(map);System.out.println(list.size());}
?