diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java
index 12fbb3f2..b87d9b4f 100644
--- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java
+++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java
@@ -218,8 +218,10 @@ public class TableInfoFactory {
if (Collection.class.isAssignableFrom(fieldType)) {
Type genericType = TypeParameterResolver.resolveFieldType(field, entityClass);
if (genericType instanceof ParameterizedType) {
- Class> actualTypeArgument = (Class>) ((ParameterizedType) genericType).getActualTypeArguments()[0];
- tableInfo.addCollectionType(field, actualTypeArgument);
+ Type actualTypeArgument = ((ParameterizedType) genericType).getActualTypeArguments()[0];
+ if (actualTypeArgument instanceof Class){
+ tableInfo.addCollectionType(field, (Class>) actualTypeArgument);
+ }
}
}
// 实体类嵌套
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml
index 989a614d..9e45e64d 100644
--- a/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/pom.xml
@@ -64,11 +64,11 @@
-
- com.h2database
- h2
- 2.1.214
-
+
+
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/controller/AccountController.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/controller/AccountController.java
index 2574fa48..180e9ec6 100644
--- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/controller/AccountController.java
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/controller/AccountController.java
@@ -22,6 +22,7 @@ import com.mybatisflex.core.row.Row;
import com.mybatisflex.test.mapper.AccountMapper;
import com.mybatisflex.test.mapper.MyAccountMapper;
import com.mybatisflex.test.model.Account;
+import com.mybatisflex.test.model.AccountDto;
import com.mybatisflex.test.service.AccountService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -52,7 +53,7 @@ public class AccountController {
@GetMapping("/account/byName/{name}")
- Account selectName(@PathVariable("name") String name) {
+ AccountDto selectName(@PathVariable("name") String name) {
return myAccountMapper.selectByName(name);
}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/mapper/MyAccountMapper.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/mapper/MyAccountMapper.java
index f111c014..d05038eb 100644
--- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/mapper/MyAccountMapper.java
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/mapper/MyAccountMapper.java
@@ -17,13 +17,14 @@
package com.mybatisflex.test.mapper;
import com.mybatisflex.test.model.Account;
+import com.mybatisflex.test.model.AccountDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
public interface MyAccountMapper extends AccountMapper {
- Account selectByName(@Param("name") String name);
+ AccountDto selectByName(@Param("name") String name);
@Select("select * from tb_account where id = #{id} and id =#{id}")
Account selectById(@Param("id") Object id);
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/AccountDto.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/AccountDto.java
new file mode 100644
index 00000000..a49730f0
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/model/AccountDto.java
@@ -0,0 +1,37 @@
+package com.mybatisflex.test.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class AccountDto {
+
+ private Long id;
+
+ private String name;
+
+ private List