Mybatis调用oracle存储过程

<!-- 进出参数要一一致-->
<parameterMap type="java.util.Map" id="oracleMap">
<parameter property="in_str" mode="IN" jdbcType="VARCHAR"/>
<parameter property="out_str" mode="OUT" jdbcType="VARCHAR"/>
<parameter property="out_others" mode="OUT" jdbcType="VARCHAR"/>
<parameter property="out_extra" mode="OUT" jdbcType="VARCHAR"/>
</parameterMap>
<select id="getDispatch" statementType="CALLABLE" parameterMap="oracleMap">
{call xshtest.APP_DISPATCH(?,?,?,?)}
</select>
public int insertUserInfo(Map param){
        int i=0;
        String phone = String.valueOf(param.get("phone"));
        SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
        String timespan = sf.format(new Date());
        String random =  String.valueOf(Math.random());
        random = timespan+random.substring(random.length()-6,random.length());
        Map parMap = new HashMap();
        parMap.put("userName", phone);
        parMap.put("swapType","1000000001");
        parMap.put("queryId",random);
        Map map = new HashMap();
        map.put("in_str", JsonUtils.toJsonNf(parMap));
        map.put("out_str","");
        log.info("============"+map+"============");
        buyUserListMapper.getDispatch(map);
        Map loginInfo = JsonUtils.toObject(String.valueOf(map.get("out_str")),HashMap.class);
        log.info("============"+loginInfo+"============");
        if(null !=loginInfo && "00".equals(loginInfo.get("resultCode"))){
            param.put("userId",loginInfo.get("userId"));
           i =  buyUserListMapper.insertUserInfo(param);
        }
        return i;
    }
void getDispatch(Map param);

 

posted @ 2018-11-27 10:44  748573200000  阅读(861)  评论(0编辑  收藏  举报