From 07362c87abc7f90802a41959bbc1d86f0b5ca13d Mon Sep 17 00:00:00 2001 From: Suomm <1474983351@qq.com> Date: Thu, 24 Aug 2023 20:14:54 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B5=8B=E8=AF=95=20ignore=20=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=A7=A3=E6=9E=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mybatisflex/test/model/Account.java | 12 +++++++ .../src/main/resources/application.yml | 32 +++++++++---------- .../test/mapper/AccountMapperTest.java | 5 +++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/Account.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/Account.java index 21fc7edb..b2f4dc0a 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/Account.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/Account.java @@ -45,6 +45,9 @@ public class Account extends BaseEntity { @Column(isLogicDelete = true) private Boolean isDelete; + @Column(ignore = true) + private String anotherColumn; + // private Gender gender; // // public Gender getGender() { @@ -95,6 +98,14 @@ public class Account extends BaseEntity { isDelete = delete; } + public String getAnotherColumn() { + return anotherColumn; + } + + public void setAnotherColumn(String anotherColumn) { + this.anotherColumn = anotherColumn; + } + @Override public String toString() { return "Account{" + @@ -103,6 +114,7 @@ public class Account extends BaseEntity { ", age=" + age + ", birthday=" + birthday + ", isDelete=" + isDelete + + ", anotherColumn=" + anotherColumn + // ", roles=" + roles + '}'; } 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 9945e8b6..0ce252f9 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 @@ -1,13 +1,13 @@ # DataSource Config -#spring: +spring: # # h2: # # console: # # enabled: true -# datasource: -## driver-class-name: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://localhost:3306/flex_test -# username: root -# password: 123456 + datasource: +# driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/flex_test + username: root + password: 12345678 # driver-class-name: # datasource: # driver-class-name: org.h2.Driver @@ -36,13 +36,13 @@ # 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/AccountMapperTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/AccountMapperTest.java index 3ef88e4b..ac2ee1d2 100644 --- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/AccountMapperTest.java +++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/mapper/AccountMapperTest.java @@ -178,4 +178,9 @@ class AccountMapperTest { System.out.println(account); } + @Test + void testIgnoreColumn() { + accountMapper.selectListByQuery(QueryWrapper.create()); + } + }