测试代码中演示如何获取 id。

pull/1/head
ZhouXY108 2024-11-02 00:22:26 +08:00
parent f5cef8f730
commit a1b6492355
1 changed files with 6 additions and 0 deletions

View File

@ -122,6 +122,12 @@ class SimpleJdbcTemplateTests {
assertTrue(key.containsKey("create_time"));
assertInstanceOf(Date.class, key.get("create_time"));
}
List<Long> ids = jdbcTemplate.update(
"INSERT INTO sys_account(username, account_status, created_by) VALUES (?, ?, ?), (?, ?, ?)",
buildParams("zhouxy21", "2", 123L, "code22", '2', 456L),
(rs, rowNumber) -> rs.getObject("id", Long.class));
log.info("ids: {}", ids);
assertEquals(2, ids.size());
}
@Test