Unverified Commit f1e232c9 authored by aiwenmo's avatar aiwenmo Committed by GitHub

[Fix-1494][metadata] Fix tinyint(1) convet error (#1499)

parent 79225236
...@@ -30,6 +30,7 @@ import com.dlink.model.ColumnType; ...@@ -30,6 +30,7 @@ import com.dlink.model.ColumnType;
* @since 2021/7/20 15:21 * @since 2021/7/20 15:21
**/ **/
public class MySqlTypeConvert implements ITypeConvert { public class MySqlTypeConvert implements ITypeConvert {
@Override @Override
public ColumnType convert(Column column) { public ColumnType convert(Column column) {
ColumnType columnType = ColumnType.STRING; ColumnType columnType = ColumnType.STRING;
...@@ -58,7 +59,7 @@ public class MySqlTypeConvert implements ITypeConvert { ...@@ -58,7 +59,7 @@ public class MySqlTypeConvert implements ITypeConvert {
} else { } else {
columnType = ColumnType.DOUBLE; columnType = ColumnType.DOUBLE;
} }
} else if (t.contains("boolean") || t.contains("tinyint(1)") || t.contains("bit")) { } else if (t.contains("boolean") || (t.contains("tinyint") && column.getLength() == 1) || t.contains("bit")) {
if (isNullable) { if (isNullable) {
columnType = ColumnType.JAVA_LANG_BOOLEAN; columnType = ColumnType.JAVA_LANG_BOOLEAN;
} else { } else {
......
...@@ -734,6 +734,7 @@ export default { ...@@ -734,6 +734,7 @@ export default {
'pages.rc.db.isNull': 'Not Null', 'pages.rc.db.isNull': 'Not Null',
'pages.rc.db.null': 'Nullable', 'pages.rc.db.null': 'Nullable',
'pages.rc.db.default': 'Default', 'pages.rc.db.default': 'Default',
'pages.rc.db.length': 'Length',
'pages.rc.db.precision': 'Precision', 'pages.rc.db.precision': 'Precision',
'pages.rc.db.decimalDigits': 'Decimal Digits', 'pages.rc.db.decimalDigits': 'Decimal Digits',
'pages.rc.db.character': 'Character Set', 'pages.rc.db.character': 'Character Set',
......
...@@ -736,6 +736,7 @@ export default { ...@@ -736,6 +736,7 @@ export default {
'pages.rc.db.isNull': '非空', 'pages.rc.db.isNull': '非空',
'pages.rc.db.null': '可为空', 'pages.rc.db.null': '可为空',
'pages.rc.db.default': '默认值', 'pages.rc.db.default': '默认值',
'pages.rc.db.length': '长度',
'pages.rc.db.precision': '精度', 'pages.rc.db.precision': '精度',
'pages.rc.db.decimalDigits': '小数范围', 'pages.rc.db.decimalDigits': '小数范围',
'pages.rc.db.character': '字符集', 'pages.rc.db.character': '字符集',
......
...@@ -106,6 +106,10 @@ const Columns = (props: any) => { ...@@ -106,6 +106,10 @@ const Columns = (props: any) => {
}, { }, {
title: l('pages.rc.db.default'), title: l('pages.rc.db.default'),
dataIndex: 'defaultValue', dataIndex: 'defaultValue',
}, {
title: l('pages.rc.db.length'),
dataIndex: 'length',
isString: false,
}, { }, {
title: l('pages.rc.db.precision'), title: l('pages.rc.db.precision'),
dataIndex: 'precision', dataIndex: 'precision',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment