mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 16:48:24 +08:00
test: 测试回调方法。
This commit is contained in:
parent
a858e498d3
commit
c22d382c27
@ -27,7 +27,7 @@ public class GoodOnSetListener implements SetListener {
|
||||
@Override
|
||||
public Object onSet(Object entity, String property, Object value) {
|
||||
System.out.println("Good: " + property + " --- " + value);
|
||||
return null;
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -36,13 +36,13 @@ spring:
|
||||
# url: jdbc:mysql://localhost:3306/flex_test
|
||||
# username: root
|
||||
# password: 12345678
|
||||
mybatis-flex:
|
||||
datasource:
|
||||
ds1:
|
||||
url: jdbc:mysql://127.0.0.1:3306/flex_test
|
||||
username: root
|
||||
password: 123456
|
||||
ds2:
|
||||
url: jdbc:mysql://127.0.0.1:3306/flex_test
|
||||
username: root
|
||||
password: 123456
|
||||
#mybatis-flex:
|
||||
# datasource:
|
||||
# ds1:
|
||||
# url: jdbc:mysql://127.0.0.1:3306/flex_test
|
||||
# username: root
|
||||
# password: 123456
|
||||
# ds2:
|
||||
# url: jdbc:mysql://127.0.0.1:3306/flex_test
|
||||
# username: root
|
||||
# password: 123456
|
||||
|
||||
@ -57,6 +57,18 @@ class ActiveRecordTest {
|
||||
Assertions.assertTrue(saved);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInsertCallback() {
|
||||
Integer goodId = Good.create()
|
||||
.setPrice(28.0)
|
||||
.setName("摆渡人")
|
||||
.saveCallback()
|
||||
.orElseThrow(RuntimeException::new)
|
||||
.getGoodId();
|
||||
|
||||
System.out.println(goodId);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdate() {
|
||||
Good.create()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user