relation query: group by added to the initial pert of recursive query
This commit is contained in:
parent
f2f3468077
commit
edd96624ae
@ -223,7 +223,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
|
|||||||
private static final String SELECT_API_USAGE_STATE = "(select aus.id, aus.created_time, aus.tenant_id, aus.entity_id, " +
|
private static final String SELECT_API_USAGE_STATE = "(select aus.id, aus.created_time, aus.tenant_id, aus.entity_id, " +
|
||||||
"coalesce((select title from tenant where id = aus.entity_id), (select title from customer where id = aus.entity_id)) as name " +
|
"coalesce((select title from tenant where id = aus.entity_id), (select title from customer where id = aus.entity_id)) as name " +
|
||||||
"from api_usage_state as aus)";
|
"from api_usage_state as aus)";
|
||||||
static final int MAX_LEVEL_DEFAULT = 10; //This value has to be reasonable small to prevent infinite recursion as early as possible
|
static final int MAX_LEVEL_DEFAULT = 50; //This value has to be reasonable small to prevent infinite recursion as early as possible
|
||||||
|
|
||||||
static {
|
static {
|
||||||
entityTableMap.put(EntityType.ASSET, "asset");
|
entityTableMap.put(EntityType.ASSET, "asset");
|
||||||
@ -246,6 +246,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
|
|||||||
" ARRAY[$in_id] as path" + // initial path
|
" ARRAY[$in_id] as path" + // initial path
|
||||||
" FROM relation " +
|
" FROM relation " +
|
||||||
" WHERE $in_id = :relation_root_id and $in_type = :relation_root_type and relation_type_group = 'COMMON'" +
|
" WHERE $in_id = :relation_root_id and $in_type = :relation_root_type and relation_type_group = 'COMMON'" +
|
||||||
|
" GROUP BY from_id, from_type, to_id, to_type, lvl, path" +
|
||||||
" UNION ALL" +
|
" UNION ALL" +
|
||||||
" SELECT r.from_id, r.from_type, r.to_id, r.to_type," +
|
" SELECT r.from_id, r.from_type, r.to_id, r.to_type," +
|
||||||
" (re.lvl + 1) as lvl, " +
|
" (re.lvl + 1) as lvl, " +
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user