企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 执行SQL ```java String sql = "select * from sys_user where id=?"; Integer id = 1; SQLReady sqlReady = new SQLReady(sql,new Object[]{id}); List<UserEntity> userEntities = sqlManager.execute(sqlReady,UserEntity.class); String updateSql = "update department set name=? where id =?"; String name="lijz"; SQLReady updateSqlReady = new SQLReady(updateSql,new Object[]{name,id}); sqlManager.executeUpdate(updateSqlReady); ``` `SQLReady` 表示已经准备好的sql和参数,可以直接交给BeetlSQL执行 输出日志如下 ``` ┏━━━━━ Debug [sql.select * from sys_user where id=?] ━━━ ┣ SQL: select * from sys_user where id=? ┣ 参数: [1] ┣ 位置: org.beetl.sql.test.S1QuickStart.executeSql(S1QuickStart.java:77) ┣ 时间: 14ms ┣ 结果: [1] ┗━━━━━ Debug [sql.select * from sys_user where id=?] ━━━ ┏━━━━━ Debug [sql.update department set name=? where id =?] ━━━ ┣ SQL: update department set name=? where id =? ┣ 参数: [lijz, 1] ┣ 位置: org.beetl.sql.test.S1QuickStart.executeSql(S1QuickStart.java:82) ┣ 时间: 3ms ┣ 更新: [1] ┗━━━━━ Debug [sql.update department set name=? where id =?] ━━━ ```