🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 执行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 =?] ━━━ ```