diff --git a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java index f82e4adc..2f1e68ba 100644 --- a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java +++ b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/DbTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2025, Mybatis-Flex (fuhai999@gmail.com). + * Copyright (c) 2022-2024, 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.
@@ -36,6 +36,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -141,8 +142,15 @@ public class DbTest {
Assert.assertEquals(rowList1.toString(), rowList3.toString());
Assert.assertEquals(rowList1.toString(), rowList4.toString());
Assert.assertEquals(rowList1.toString(), rowList5.toString());
+ // 既有 XML (#{}) 参数又有 QueryWrapper (?) 参数是不被允许的
Assert.assertThrows(PersistenceException.class,
() -> Db.selectListBySql("select * from tb_account where age > #{age} and id > ?", map, 1));
+ // 解决 XML 参数顺序问题
+ Map