refs #703: fix Smilegate annotation metadata query
This commit is contained in:
@@ -20,10 +20,7 @@ public interface SchemaMetadataMapper {
|
||||
@Param("tableName") String tableName
|
||||
);
|
||||
|
||||
List<SchemaMetadataAnnotationRow> findAnnotations(
|
||||
@Param("owner") String owner,
|
||||
@Param("tableName") String tableName
|
||||
);
|
||||
List<SchemaMetadataAnnotationRow> findAnnotations(@Param("tableName") String tableName);
|
||||
|
||||
int countColumn(
|
||||
@Param("owner") String owner,
|
||||
@@ -32,13 +29,11 @@ public interface SchemaMetadataMapper {
|
||||
);
|
||||
|
||||
int countTableAnnotation(
|
||||
@Param("owner") String owner,
|
||||
@Param("tableName") String tableName,
|
||||
@Param("annotationName") String annotationName
|
||||
);
|
||||
|
||||
int countColumnAnnotation(
|
||||
@Param("owner") String owner,
|
||||
@Param("tableName") String tableName,
|
||||
@Param("columnName") String columnName,
|
||||
@Param("annotationName") String annotationName
|
||||
|
||||
@@ -145,7 +145,7 @@ public class SchemaMetadataService {
|
||||
|
||||
private Map<String, List<SchemaAnnotation>> annotationsByTarget(String tableName) {
|
||||
Map<String, LinkedHashMap<String, List<String>>> grouped = new LinkedHashMap<>();
|
||||
for (SchemaMetadataAnnotationRow row : mapper.findAnnotations(OWNER, tableName)) {
|
||||
for (SchemaMetadataAnnotationRow row : mapper.findAnnotations(tableName)) {
|
||||
String target = row.columnName() == null
|
||||
? tableTargetKey()
|
||||
: columnTargetKey(row.columnName());
|
||||
@@ -169,8 +169,8 @@ public class SchemaMetadataService {
|
||||
|
||||
private boolean annotationExists(String tableName, String columnName, String annotationName) {
|
||||
return columnName == null
|
||||
? mapper.countTableAnnotation(OWNER, tableName, annotationName) > 0
|
||||
: mapper.countColumnAnnotation(OWNER, tableName, columnName, annotationName) > 0;
|
||||
? mapper.countTableAnnotation(tableName, annotationName) > 0
|
||||
: mapper.countColumnAnnotation(tableName, columnName, annotationName) > 0;
|
||||
}
|
||||
|
||||
private String requireColumn(String tableName, String columnName) {
|
||||
|
||||
Reference in New Issue
Block a user