From 250b04cbc6a1eccb56142a8b85425af53e1dfa37 Mon Sep 17 00:00:00 2001 From: msyu Date: Fri, 28 Feb 2025 16:02:20 +0300 Subject: [PATCH] instance_ls optimized --- v1/Application.cfc | 2 +- v1/resources/instance_ls.cfc | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/v1/Application.cfc b/v1/Application.cfc index 5f59f40..fb498ed 100644 --- a/v1/Application.cfc +++ b/v1/Application.cfc @@ -51,7 +51,7 @@ //variables.framework.docs={}; variables.framework.docs.APIName="Deck API"; - variables.framework.docs.APIVersion="0.059"; + variables.framework.docs.APIVersion="0.060"; variables.framework.globalHeaders = structNew(); variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location"; diff --git a/v1/resources/instance_ls.cfc b/v1/resources/instance_ls.cfc index 7f0feb6..6b2b85d 100644 --- a/v1/resources/instance_ls.cfc +++ b/v1/resources/instance_ls.cfc @@ -79,6 +79,28 @@ + + select count(*) as cnt + from ( + select 1 + from instance e + join specification_item i on (e.specification_item_id=i.specification_item_id) + join specification s on (i.specification_id=s.specification_id) + join contract d on (s.contract_id=d.contract_id) + join contragent k on (d.contragent_id=k.contragent_id) + join svc v on (e.service_id=v.svc_id) + left outer join usr u on (e.updater_id=u.usr_id) + where s.specification_id= + + AND ( + lower(e.display_name) like lower() + OR lower(v.svc) like lower() + ) + + ) inr + where 1=1 + + select #local.fields#* @@ -159,7 +181,7 @@ where 1=1 order by - --limit #maxrows# + limit #maxrows# @@ -171,7 +193,6 @@ join specification s on (i.specification_id=s.specification_id) join contract d on (s.contract_id=d.contract_id) join contragent k on (d.contragent_id=k.contragent_id) - --join usr u on (k.contragent_id=u.contragent_id) join svc v on (e.service_id=v.svc_id) where s.specification_id= @@ -182,7 +203,7 @@ - +