|
@@ -161,4 +161,34 @@ public class TableInfoServiceImpl implements ITableInfoService {
|
|
|
public int oracleTableExist(String tableName) {
|
|
|
return tableInfoMapper.oracleTableExist(tableName);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void createOracleTable(Map<String, Object> map) {
|
|
|
+ String tableName = (String) map.get("tableName");
|
|
|
+ List<TableInfo> filedList = JSON.parseArray(JSON.toJSONString(map.get("field")), TableInfo.class);
|
|
|
+ List<String> descriptionList = new ArrayList<>();
|
|
|
+ List<String> list= filedList.stream().map(filed->{
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ stringBuilder.append(filed.getFieldName()+" ")
|
|
|
+ .append(filed.getFieldType()+" ");
|
|
|
+ if(filed.getIsPrimary()){
|
|
|
+ stringBuilder.append("PRIMARY KEY ");
|
|
|
+ }
|
|
|
+ if(filed.getIsNull()){
|
|
|
+ stringBuilder.append("NOT NULL ");
|
|
|
+ }
|
|
|
+ if(StringUtils.hasLength(filed.getFieldDescription())){
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ builder.append("comment on column ")
|
|
|
+ .append(tableName)
|
|
|
+ .append(".")
|
|
|
+ .append(filed.getFieldName()+" is '")
|
|
|
+ .append(filed.getFieldDescription()+"'");
|
|
|
+ descriptionList.add(builder.toString());
|
|
|
+ }
|
|
|
+ return stringBuilder.toString();
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ tableInfoMapper.createOracleTable(tableName,list);
|
|
|
+ descriptionList.stream().forEach(f ->tableInfoMapper.addOracleTableDescription(f));
|
|
|
+ }
|
|
|
}
|