Merge branch 'master' of github.com:thingsboard/thingsboard
This commit is contained in:
commit
330ff09437
@ -389,6 +389,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
|
|||||||
} else {
|
} else {
|
||||||
entityTypeStr = "'" + entityType.name() + "'";
|
entityTypeStr = "'" + entityType.name() + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(entityFieldsSelection)) {
|
if (!StringUtils.isEmpty(entityFieldsSelection)) {
|
||||||
entityFieldsSelection = String.format("e.id id, %s entity_type, %s", entityTypeStr, entityFieldsSelection);
|
entityFieldsSelection = String.format("e.id id, %s entity_type, %s", entityTypeStr, entityFieldsSelection);
|
||||||
} else {
|
} else {
|
||||||
@ -442,10 +443,10 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
|
|||||||
EntityKeyMapping sortOrderMapping = sortOrderMappingOpt.get();
|
EntityKeyMapping sortOrderMapping = sortOrderMappingOpt.get();
|
||||||
String direction = sortOrder.getDirection() == EntityDataSortOrder.Direction.ASC ? "asc" : "desc";
|
String direction = sortOrder.getDirection() == EntityDataSortOrder.Direction.ASC ? "asc" : "desc";
|
||||||
if (sortOrderMapping.getEntityKey().getType() == EntityKeyType.ENTITY_FIELD) {
|
if (sortOrderMapping.getEntityKey().getType() == EntityKeyType.ENTITY_FIELD) {
|
||||||
dataQuery = String.format("%s order by %s %s", dataQuery, sortOrderMapping.getValueAlias(), direction);
|
dataQuery = String.format("%s order by %s %s, result.id %s", dataQuery, sortOrderMapping.getValueAlias(), direction, direction);
|
||||||
} else {
|
} else {
|
||||||
dataQuery = String.format("%s order by %s %s, %s %s", dataQuery,
|
dataQuery = String.format("%s order by %s %s, %s %s, result.id %s", dataQuery,
|
||||||
sortOrderMapping.getSortOrderNumAlias(), direction, sortOrderMapping.getSortOrderStrAlias(), direction);
|
sortOrderMapping.getSortOrderNumAlias(), direction, sortOrderMapping.getSortOrderStrAlias(), direction, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user