传入和接收类型均为CLOB,直接上代码
service服务层:
注意对Clob返回内容的解析及JSONObject的转化。
@Override public JSONObject processCall(JSONObject context) throws Exception { Map<String, Object> paramMap = new HashMap<>(); paramMap.put("p_message", context.toJSONString()); paramMap.put("x_resp_msg", null); callMapper.callInfo(paramMap); Clob clob=(Clob)paramMap.get("x_resp_msg"); String result= (clob != null ? clob.getSubString(1, (int) clob.length()) :""); JSONObject jsonObject=JSONObject.parseObject(result); return jsonObject; }
mapper:
void callInfo(@Param("bean") Map<String,Object> erpMap);
mapper.xml:
<select id="callInfo" parameterType="java.util.Map" statementType="CALLABLE"> {call pkg.handle_message(#{bean.x_resp_msg,mode=OUT,jdbcType=CLOB},#{bean.p_message,mode=IN,jdbcType=CLOB})} </select>