mybaits 使用注解调用存储过程

   在 mapper接口里面直接写sql 语句,不需要使用 xml 文件,PurchaseOrderMapping接口里的方法:

@Select({ "call SP_GET_AUTO_NO(P_ROLE_NAME IN VARCHAR2,P_RET OUT VARCHAR2)" })
    @Options(statementType= StatementType.CALLABLE)
    void getPurchaseOrderNumber(Map<String,String> params);

在seriver层调用

 @Override
    public String getPoNo(String P_ROLE_NAME) {
        Map<String,String> params=new HashMap<>();
        params.put("P_ROLE_NAME ", P_ROLE_NAME);
        fapiaoMapper.getPoNo(params);
        String PoNo=params.get("P_RET");
        return PoNo;

    }

 这样就可以了

发布了92 篇原创文章 · 获赞 92 · 访问量 20万+

猜你喜欢

转载自blog.csdn.net/qq_34359363/article/details/103592039