Browse Source

修正为使用 column, 对不上号的不管了

miemie 6 years ago
parent
commit
c7ff123e02

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/LambdaUtils.java

@@ -104,9 +104,9 @@ public final class LambdaUtils {
         }
         tableInfo.getFieldList().forEach(i -> {
             if (i.getClazz() != clazz) {
-                saveCache(i.getClazz().getName(), i.getProperty(), i.getSqlSelect(tableInfo.getDbType()));
+                saveCache(i.getClazz().getName(), i.getProperty(), i.getColumn());
             }
-            map.put(i.getProperty(), i.getSqlSelect(tableInfo.getDbType()));
+            map.put(i.getProperty(), i.getColumn());
         });
         return map;
     }

+ 2 - 1
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/base/entity/pg/PgData.java

@@ -13,8 +13,9 @@ import lombok.experimental.Accessors;
 public class PgData {
 
     private Long id;
-    @TableField("pgInt")
+    @TableField("\"pgInt\"")
     private Integer pgInt;
     private Integer pgInt2;
+    @TableField("\"group\"")
     private Integer group;
 }

+ 2 - 2
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/postgres/PostgresTestDataMapperTest.java

@@ -80,8 +80,8 @@ public class PostgresTestDataMapperTest {
         Assert.assertEquals(0, commonLogicMapper.deleteByMap(map));
         Map<String, Object> map2 = new HashMap<>();
         map2.put("id", 2L);
-        map2.put("group", 5);
-        map2.put("pgInt", 5);
+        map2.put("\"group\"", 5);
+        map2.put("\"pgInt\"", 5);
         Assert.assertEquals(0, pgMapper.deleteByMap(map2));
     }