mapperxml配置java
配置時須要注意mybatis
parameterMap在mybatis3.2.6版本已經再也不用了,而是使用
parameterType
<select id="callgetId" parameterType="java.util.HashMap" statementType="CALLABLE"> exec sp_GetID #{RemoteId,mode=IN,jdbcType=NVARCHAR}, #{cAcc_Id,mode=IN,jdbcType=NVARCHAR}, #{cVouchType,mode=IN,jdbcType=NVARCHAR},#{iAmount,mode=IN,jdbcType=INTEGER}, #{iFatherId,mode=OUT,jdbcType=INTEGER},#{iChildId,mode=OUT,jdbcType=INTEGER} </select>
Map<String,Object> paraMap=new HashMap<String, Object>(); paraMap.put("RemoteId", "00"); paraMap.put("cAcc_Id", "005"); paraMap.put("cVouchType", "DISPATCH"); paraMap.put("iAmount", 1); paraMap.put("iFatherId", null); paraMap.put("iChildId", null); int maxid; dispatchlistDao.callgetId(paraMap); //注意:這裏並不是是返回值,執行完存儲過程後,
//後兩個output值自動會寫進去的。一直沒有明白,因此在配置的xml不須要設置resultType maxid=Integer.parseInt(paraMap.get("iFatherId").toString());