提交 86e7b200 authored 作者: ww1xhqc's avatar ww1xhqc

[数据模型] 修改length为nul导致xml报错

上级 2b84cf00
......@@ -335,7 +335,7 @@ public class ModelImpl implements ModelService {
primaryColumn.setPrimaryKey(0);
primaryColumn.setFieldType(getTypeName(genericType.toString()));
primaryColumn.setFieldName(getClassName(declaredField.toString()));
// primaryColumn.setFieldLength(setLength(genericType.toString()));
primaryColumn.setFieldLength(setLength(genericType.toString()));
//获得属性中文描述
if (declaredField.isAnnotationPresent(ApiModelProperty.class)) {
......@@ -355,7 +355,7 @@ public class ModelImpl implements ModelService {
ColumnVO otherColumn = new ColumnVO();
otherColumn.setFieldType(getTypeName(genericType.toString()));
otherColumn.setFieldName(getClassName(declaredField.toString()));
// otherColumn.setFieldLength(setLength(genericType.toString()));
otherColumn.setFieldLength(setLength(genericType.toString()));
otherColumns.add(otherColumn);
//获得属性中文描述
......@@ -521,11 +521,22 @@ public class ModelImpl implements ModelService {
}
if (modelType.equals(ModelType.BASICS_EXTENSION)) {
columnInfoDao.deleteAllByDbId(updateTableInfoVO.getDbId());
List<ColumnInfo> dataList = updateTableInfoVO.getTableVO().getDataList().stream()
.map(columnVO -> columnInfo(tableInfo.getId(), tableInfo.getModelName(), columnVO))
.collect(Collectors.toList());
columnInfoDao.saveAll(dataList);
for (ColumnInfo columnInfo : dataList) {
columnInfo.setId(null);
columnInfoDao.save(columnInfo);
}
tableInfo.setUpdatedTime(new Date());
// String xml = createTable(tableVO);
//重新存xml
// tableInfo.setXml(xml);
tableInfoDao.save(tableInfo);
}
return 1;
}
......
......@@ -85,20 +85,20 @@ public class CreateTableUtil {
"<hibernate-mapping>\n" +
" <class entity-name=\"" + entityName + "\" table=\"" + tableName + "\">\n";
xmlMapping += " <id name=\""+primaryColumn.getFieldName()+"\" type=\""+primaryColumn.getFieldType()+"\" unsaved-value=\"null\" >\n" +
xmlMapping += " <id name=\""+primaryColumn.getFieldName()+"\" type=\""+primaryColumn.getFieldType()+"\" length=\"" + primaryColumn.getFieldLength()+"\" unsaved-value=\"null\" >\n" +
" </id>";
for (ColumnVO columnVO : dataList) {
xmlMapping +=
"\n <property type=\"" + columnVO.getFieldType() + "\" name=\"" + columnVO.getFieldName() +
"\" column=\"" + columnVO.getFieldName() + "\"/>\n";
// xmlMapping +=
// "\n <property type=\"" + columnVO.getFieldType() + "\" name=\"" + columnVO.getFieldName() + "\" length=\"" + columnVO.getFieldLength() +
// "\n <property type=\"" + columnVO.getFieldType() + "\" name=\"" + columnVO.getFieldName() +
// "\" column=\"" + columnVO.getFieldName() + "\"/>\n";
xmlMapping +=
"\n <property type=\"" + columnVO.getFieldType() + "\" name=\"" + columnVO.getFieldName() + "\" length=\"" + columnVO.getFieldLength() +
"\" column=\"" + columnVO.getFieldName() + "\"/>\n";
}
xmlMapping += " </class>\n" +
"</hibernate-mapping>";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论