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