diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/GoodOnSetListener.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/GoodOnSetListener.java index 9585ebca..e440b691 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/GoodOnSetListener.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/GoodOnSetListener.java @@ -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; } } diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml index be1c97b5..518df747 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml @@ -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 diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java index 99eede8d..c6e40c36 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/ActiveRecordTest.java @@ -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()