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 38c46d43..9ddca909 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
@@ -68,17 +68,6 @@ class AccountMapperTest {
accountMapper.selectListByQuery(QueryWrapper.create()).forEach(System.err::println);
}
- @Test
- void testListString() {
- QueryWrapper queryWrapper = QueryWrapper.create()
- .select(ACCOUNT.ALL_COLUMNS, ROLE.ROLE_NAME.as("roles"))
- .from(ACCOUNT)
- .leftJoin(USER_ROLE).on(USER_ROLE.USER_ID.eq(ACCOUNT.ID))
- .leftJoin(ROLE).on(USER_ROLE.ROLE_ID.eq(ROLE.ROLE_ID));
- accountMapper.selectListByQuery(queryWrapper).forEach(System.err::println);
- accountMapper.selectListByQueryAs(queryWrapper, AccountVO.class).forEach(System.err::println);
- }
-
@Test
void testGenericEntity() {
QueryWrapper queryWrapper = QueryWrapper.create()
diff --git a/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml
new file mode 100644
index 00000000..b928b6b8
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-cloud-test/pom.xml
@@ -0,0 +1,93 @@
+
+
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.mybatisflex.test; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@MapperScan("com.mybatisflex.test.mapper") +public class MybatisFlexSpringCloudTestApplication { + + public static void main(String[] args) { + SpringApplication.run(MybatisFlexSpringCloudTestApplication.class, args); + } + +} diff --git a/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/java/com/mybatisflex/test/controller/AccountController.java b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/java/com/mybatisflex/test/controller/AccountController.java new file mode 100644 index 00000000..611cc9db --- /dev/null +++ b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/java/com/mybatisflex/test/controller/AccountController.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mybatisflex.test.controller;
+
+import com.mybatisflex.test.entity.Account;
+import com.mybatisflex.test.mapper.AccountMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author 王帅
+ * @since 2023-06-18
+ */
+@RestController
+@RequestMapping("/account")
+public class AccountController {
+
+ @Autowired
+ private AccountMapper accountMapper;
+
+ @GetMapping("getAll")
+ public List
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mybatisflex.test.entity;
+
+import com.mybatisflex.annotation.Id;
+import com.mybatisflex.annotation.KeyType;
+import com.mybatisflex.annotation.Table;
+
+import java.util.Date;
+
+/**
+ * @author 王帅
+ * @since 2023-06-18
+ */
+@Table("tb_account")
+public class Account {
+
+ @Id(keyType = KeyType.Auto)
+ private Long id;
+ private String userName;
+ private Integer age;
+ private Date birthday;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+
+ public Date getBirthday() {
+ return birthday;
+ }
+
+ public void setBirthday(Date birthday) {
+ this.birthday = birthday;
+ }
+
+ @Override
+ public String toString() {
+ return "Account{" +
+ "id=" + id +
+ ", userName='" + userName + '\'' +
+ ", age=" + age +
+ ", birthday=" + birthday +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/resources/application.yml
new file mode 100644
index 00000000..4b62f470
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/resources/application.yml
@@ -0,0 +1,7 @@
+spring:
+ cloud:
+ nacos:
+ config:
+ server-addr: localhost:8848
+ config:
+ import: nacos:application-datasource.yml
diff --git a/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/resources/mybatis-flex.properties b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/resources/mybatis-flex.properties
new file mode 100644
index 00000000..812235c5
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/main/resources/mybatis-flex.properties
@@ -0,0 +1,2 @@
+processor.mappersGenerateEnable=true
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/test/java/com/mybatisflex/test/MybatisFlexSpringCloudTestApplicationTests.java b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/test/java/com/mybatisflex/test/MybatisFlexSpringCloudTestApplicationTests.java
new file mode 100644
index 00000000..9fb46caf
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-cloud-test/src/test/java/com/mybatisflex/test/MybatisFlexSpringCloudTestApplicationTests.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mybatisflex.test;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class MybatisFlexSpringCloudTestApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/mybatis-flex-test/pom.xml b/mybatis-flex-test/pom.xml
index 786015b6..93038d8f 100644
--- a/mybatis-flex-test/pom.xml
+++ b/mybatis-flex-test/pom.xml
@@ -16,6 +16,7 @@