🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 存储过程调用 beetlsql 支持存储过程的调用,包含查询和更新 * public <T> List<T> executeCall(CallReady callReady, Class<T> clazz) 执行存储过程,结果映射到clazz对象 * public int executeCall(CallReady callReady ) 执行更新存储过程,返回int表示更新结果 CallReady对象包含了存储过程调用语句,以及输入输出参数说明,比如mytest存储过程定义如下 ```sql CREATE DEFINER=`root`@`%` PROCEDURE `test`.`mytest`(IN s_count INT,OUT s_count2 varchar(10)) BEGIN SELECT * from User; SET s_count2='abc'; END ``` CallReady对象包含了存储过程调用语句,以及输出输出参数说明 ```java CallReady callReady = new CallReady("call test.mytest(?,?)"); callReady.add(new InArg(1)); OutArg nameOut = new OutArg(String.class); callReady.add(nameOut); List<User> users = sqlManager.executeCall(callReady,User.class); String sCount2 = (String)nameOut.getOutValue(); ``` 通常情况,使用Mapper方法更加直观简单,详情参考Mapper章节的@Call 注解