fix: diff result table show added but overview show none
This commit is contained in:
parent
c5af11f68f
commit
a00fd2278c
|
@ -273,8 +273,16 @@ public class DocumentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.sort(Comparator.comparing(DatabaseDocumentSimpleResponse.TableData::getName));
|
result.sort(Comparator.comparing(DatabaseDocumentSimpleResponse.TableData::getName));
|
||||||
DiffType diffType = result.stream()
|
boolean allAdded = result.stream()
|
||||||
.anyMatch(t -> t.getDiffType() == DiffType.MODIFIED) ? DiffType.MODIFIED : DiffType.NONE;
|
.filter(item -> !item.getDiffType().isNone())
|
||||||
|
.allMatch(item -> item.getDiffType().isAdded());
|
||||||
|
DiffType diffType;
|
||||||
|
if (allAdded) {
|
||||||
|
diffType = DiffType.ADDED;
|
||||||
|
} else {
|
||||||
|
diffType = result.stream()
|
||||||
|
.anyMatch(t -> t.getDiffType() != DiffType.NONE) ? DiffType.MODIFIED : DiffType.NONE;
|
||||||
|
}
|
||||||
return documentSimpleResponseConverter.of(document, result, diffType, projectName);
|
return documentSimpleResponseConverter.of(document, result, diffType, projectName);
|
||||||
} else {
|
} else {
|
||||||
tableMetas.sort(Comparator.comparing(DatabaseDocumentSimpleResponse.TableData::getName));
|
tableMetas.sort(Comparator.comparing(DatabaseDocumentSimpleResponse.TableData::getName));
|
||||||
|
|
|
@ -6,4 +6,12 @@ public enum DiffType {
|
||||||
public static boolean isModified(DiffType type) {
|
public static boolean isModified(DiffType type) {
|
||||||
return type != null && type != NONE;
|
return type != null && type != NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAdded() {
|
||||||
|
return this == ADDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNone() {
|
||||||
|
return this == NONE;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue