mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-09 12:03:15 +08:00
update 优化 项目中的一些存在null的问题 与一些性能问题 小优化
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user