Commit 1f00cb80 by liuzz

针对处理'-'等未输入的值,插入数据库时直接显示为null值,便于统计

parent 727d3f9b
......@@ -105,6 +105,10 @@ public class DataImportUtils {
* @return
*/
public static String getInsertContent(VerifyVO vo, int index) {
// 没有值就插入null
if (vo.getValues().get(index) == null){
return "null";
}
if (StringUtils.containsIgnoreCase(vo.getFieldType(), "VARCHAR")) {
return "'" + vo.getValues().get(index) + "'";
} else if (StringUtils.containsIgnoreCase(vo.getFieldType(), "NUMBER")) {
......@@ -120,8 +124,8 @@ public class DataImportUtils {
return StrFormatter.format("to_date('{}','YYYY-MM-DD HH24:MI:SS')", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", date));
}
} catch (Exception ignore) {
return "null";
}
return "null";
}
return "'" + vo.getValues().get(index) + "'";
}
......
......@@ -560,6 +560,12 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
for (Integer column : columnList) {
final Cell cell = row.getCell(column, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
String cellValue = DiConfig.getValue(cell);
// 如果没有值一律转换为空值
if (StrUtil.isBlank(cellValue) || StrUtil.equalsAnyIgnoreCase(cellValue,"-","null")){
cellValue = null;
vo.addValue(cellValue);
continue;
}
if (StrUtil.containsIgnoreCase(vo.getFieldType(),"number")){
// 如果是数字
// 计算整数长度in 小数长度de
......
......@@ -47,7 +47,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: zyy
# 文件上传
servlet:
multipart:
......
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