Browse Source

!116 支持BigDecimal
Merge pull request !116 from AE86/V_1.0.0_RC

AE86 2 years ago
parent
commit
73f9871c87

+ 6 - 0
dbsyncer-connector/src/main/java/org/dbsyncer/connector/schema/TinyintValueMapper.java

@@ -4,6 +4,8 @@ import org.dbsyncer.common.spi.ConnectorMapper;
 import org.dbsyncer.connector.AbstractValueMapper;
 import org.dbsyncer.connector.ConnectorException;
 
+import java.math.BigDecimal;
+
 /**
  * @author AE86
  * @version 1.0.0
@@ -25,6 +27,10 @@ public class TinyintValueMapper extends AbstractValueMapper<Integer> {
             String s = (String) val;
             return new Integer(s);
         }
+        if (val instanceof BigDecimal) {
+            BigDecimal bigDecimal = (BigDecimal) val;
+            return bigDecimal.intValue();
+        }
         throw new ConnectorException(String.format("%s can not find type [%s], val [%s]", getClass().getSimpleName(), val.getClass(), val));
     }
 }