提交 00d61fc2 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

close task#7494

上级 8c5cfc87
......@@ -37,8 +37,8 @@ func Generate(defaultFile string, configFile string, total int, fieldsToExportSt
vari.Total = total
rows, colTypes := gen.GenerateForDefinition(defaultFile, configFile, &fieldsToExport, total)
Print(rows, format, out, table, colTypes, fieldsToExport)
rows, colIsNumArr := gen.GenerateForDefinition(defaultFile, configFile, &fieldsToExport, total)
Print(rows, format, table, colIsNumArr, fieldsToExport)
entTime := time.Now().Unix()
if vari.RunMode == constant.RunModeServerRequest {
......@@ -46,7 +46,7 @@ func Generate(defaultFile string, configFile string, total int, fieldsToExportSt
}
}
func Print(rows [][]string, format string, out string, table string, colTypes []bool, fields []string) {
func Print(rows [][]string, format string, table string, colIsNumArr []bool, fields []string) {
if format == constant.FormatText {
printTextHeader(fields)
} else if format == constant.FormatSql {
......@@ -70,7 +70,7 @@ func Print(rows [][]string, format string, out string, table string, colTypes []
rowXml.Cols = append(rowXml.Cols, col)
colVal := stringUtils.ConvertForSql(col)
if !colTypes[j] { colVal = "'" + colVal + "'" }
if !colIsNumArr[j] { colVal = "'" + colVal + "'" }
valuesForSql = append(valuesForSql, colVal)
}
......
......@@ -20,7 +20,7 @@ func GenerateForDefinition(defaultFile, configFile string, fieldsToExport *[]str
fieldNameToValues := map[string][]string{}
colTypes := make([]bool, 0)
colIsNumArr := make([]bool, 0)
// 为每个field生成值列表
for index, field := range vari.Def.Fields {
......@@ -32,7 +32,7 @@ func GenerateForDefinition(defaultFile, configFile string, fieldsToExport *[]str
vari.Def.Fields[index].Precision = field.Precision
fieldNameToValues[field.Field] = values
colTypes = append(colTypes, field.IsNumb)
colIsNumArr = append(colIsNumArr, field.IsNumb)
}
// 生成指定数量行的数据
......@@ -50,7 +50,7 @@ func GenerateForDefinition(defaultFile, configFile string, fieldsToExport *[]str
}
}
return rows, colTypes
return rows, colIsNumArr
}
func GenerateForField(field *model.DefField, total int, withFix bool) []string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册