Service方法如下:
@Override
@DataSource(name = DataSourceNames.SECOND) //无视,配置的多数据源注解
public String sendCode(String phone, String content) {
System.out.println("开始发送短信");
Map<String,Object> map = new HashMap();
map.put("state",null); //返回参数
map.put("smsid",null);//返回参数
map.put("mobilenoterecordid",null);//返回参数
map.put("mobilesNum",null);//返回参数
map.put("phone",phone);
map.put("content",content);
map.put("plantime","");
map.put("prior","");
map.put("customercode","");
map.put("customername","");
map.put("officecode","");
dxDao.sendCode(map);
System.out.println(map.get("state"));
System.out.println(map.get("smsid"));
System.out.println(map.get("mobilenoterecordid"));
System.out.println(map.get("mobilesNum"));
return null;
}
xml文件:
<select id="sendCode" statementType="CALLABLE" parameterType="java.util.Map" >
{call PKG_SMSSVR.PRC_SendSmsNEW(#{state,mode=OUT,jdbcType=VARCHAR},#{smsid,mode=OUT,jdbcType=VARCHAR},#{mobilenoterecordid,mode=OUT,jdbcType=VARCHAR},#{mobilesNum,mode=OUT,jdbcType=VARCHAR}
,#{phone, jdbcType=VARCHAR, mode=IN},#{content, jdbcType=VARCHAR, mode=IN},#{plantime, jdbcType=VARCHAR, mode=IN},#{prior, jdbcType=VARCHAR, mode=IN}
,#{customercode, jdbcType=VARCHAR, mode=IN},#{customername, jdbcType=VARCHAR, mode=IN},#{officecode, jdbcType=VARCHAR, mode=IN}) }
</select>
测试成功,能获取到返回结果: