update 优化 项目中的一些存在null的问题 与一些性能问题 小优化

This commit is contained in:
疯狂的狮子Li
2026-03-31 18:52:37 +08:00
parent 26464c0051
commit d11990bfd8
21 changed files with 137 additions and 91 deletions

View File

@@ -241,9 +241,7 @@ public class GenTableServiceImpl implements IGenTableService {
genTable.setOptions(options);
int row = baseMapper.updateById(genTable);
if (row > 0) {
for (GenTableColumn cenTableColumn : genTable.getColumns()) {
genTableColumnMapper.updateById(cenTableColumn);
}
genTableColumnMapper.updateBatchById(genTable.getColumns());
}
}
@@ -289,6 +287,7 @@ public class GenTableServiceImpl implements IGenTableService {
}
}
} catch (Exception e) {
log.error("导入失败", e);
throw new ServiceException("导入失败:" + e.getMessage());
}
}
@@ -471,7 +470,7 @@ public class GenTableServiceImpl implements IGenTableService {
zip.flush();
zip.closeEntry();
} catch (IOException e) {
log.error("渲染模板失败,表名:" + table.getTableName(), e);
log.error("渲染模板失败,表名:{}", table.getTableName(), e);
}
}
}

View File

@@ -180,7 +180,7 @@ public class GenUtils {
String text = replacementm;
for (String searchString : searchList) {
if (replacementm.startsWith(searchString)) {
text = replacementm.replaceFirst(searchString, StringUtils.EMPTY);
text = StringUtils.removeStart(replacementm, searchString);
break;
}
}
@@ -220,6 +220,10 @@ public class GenUtils {
public static Integer getColumnLength(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0) {
String length = StringUtils.substringBetween(columnType, "(", ")");
// 处理 decimal(10,2) 这类带精度的类型,只取长度部分
if (length.contains(",")) {
length = StringUtils.substringBefore(length, ",");
}
return Integer.valueOf(length);
} else {
return 0;