From 6c473047f56e12c86cc934acf62ef3755f71e774 Mon Sep 17 00:00:00 2001 From: mirzakaev_tf Date: Mon, 15 Jul 2024 11:47:14 +0500 Subject: [PATCH] =?UTF-8?q?21370=20=D0=B0=D1=80=D1=85=D0=B8=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=81=D0=BE=D1=80=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Admin manuals/Настройка архива/index.md | 44 ++++++++++---------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/docs/Admin manuals/Настройка архива/index.md b/docs/Admin manuals/Настройка архива/index.md index 87dbfd4..85c5b5b 100644 --- a/docs/Admin manuals/Настройка архива/index.md +++ b/docs/Admin manuals/Настройка архива/index.md @@ -29,7 +29,6 @@ Curator | Куратор | StageUser | Участник маршрута | EmpowermentSubject | Полномочия | - Существует строго определённый набор значений поля "Id", приведённый в [таблице ниже](#таблица). Соответствующее им поле "Name" заполняется произвольно. В справочнике «Итоговые выборки поисковой системы» этим значениям будут поставлены в соответствие поля в таблицах, по которым будет осуществляться поиск и фильтрация документов с вложениями. ## Итоговые выборки поисковой системы @@ -70,12 +69,12 @@ SELECT t."VCode" AS "DocCode" , t."TypeName" AS "DocType" , :DateProperty AS "DocDate" , :NumberProperty AS "DocNumber" - , t."Contractor" AS "ContractorId" - , t."VCode" AS "ContractId" + , NULL::bigint AS "ContractorId" + , NULL::bigint AS "ContractId" , NULL::bigint AS "AddContractId" - , t."Projects" AS "ProjectId" -FROM contract."Contract" as t -WHERE t."COrg" = _orgidparam + , NULL::bigint AS "ProjectId" +FROM dfd."UniversalDocument" as t +WHERE 1 = 1 ``` @@ -86,14 +85,11 @@ SELECT t."VCode" AS "DocCode" , t."TypeName" AS "DocType" , :DateProperty AS "DocDate" , :NumberProperty AS "DocNumber" - , NULL::text AS "DocName" - , t."SubjectOfContract" AS "DocTheme" - , NULL::text AS "DocDefinition" -:ItemSelect -FROM contract."Contract" as t -:ItemFrom -WHERE (t."COrg" = _orgidparam) -:ItemWhere + , NULL AS "DocName" + , NULL AS "DocTheme" + , NULL AS "DocDefinition" +FROM dfd."UniversalDocument" as t +WHERE 1 = 1 ``` В таблицу справа "Фильтры" необходимо занести значения из *Справочника поисковой системы*, по которым будет осуществляться фильтр, и SQL-скрипт – кусок кода, который будет подставлен в предложение WHERE результирующего селекта. Значение, сравниваемое с ```an.Value```, будет совпадать со значением в столбце ```ID``` таблицы "Фильтр". Значение, сравниваемое с ```an.Value```, будет совпадать с полем таблицы, которое присваивается одному из полей селекта. @@ -110,6 +106,10 @@ WHERE (t."COrg" = _orgidparam) | StageUser | Участник маршрута | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
join comdoc."RouteStage" as s on s."PCode" = r."VCode"
join comdoc."StageItem" as i on i."PCode" = s."VCode"
where an."id" = 'StageUser'
and r."RouteStatus" NOT IN (4)
and i."StageUser" = an."value"
) | | CUser | Создатель документа | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying)) | | Initiator | Инициатор | and(
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'Initiator'
and r."Initiator" = an."value")) | +| Filial | Организация | and exists( select 1 from "tmp_anFilters_for_documentSearch" as an + where an."id" = 'Filial' + and t."COrg"::text = an."value" + ) | ## Настройка документов @@ -128,8 +128,7 @@ WHERE (t."COrg" = _orgidparam) | StageUser | Участник маршрута | and
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
join comdoc."RouteStage" as s on s."PCode" = r."VCode"
join comdoc."StageItem" as i on i."PCode" = s."VCode"
where an."id" = 'StageUser'
and r."RouteStatus" NOT IN (4)
and i."StageUser" = an."value"
) | | SignatoryUser | Работник | and(
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'SignatoryUser'
and r."DocType" = 'EmployeeStatement'
and r."Initiator" = an."value"
) or exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
join comdoc."RouteStage" as s on s."PCode" = r."VCode"
join comdoc."StageItem" as i on i."PCode" = s."VCode"
where an."id" = 'SignatoryUser'
and r."DocType" = 'LND'
AND r."RouteStatus" NOT IN(4)
AND s."IsMarked" IS NOT true
AND COALESCE(i."DocumentAction", 0) IN (20, 30)
and i."StageUser" = an."value"
) or exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."ReadListItem" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'SignatoryUser'
and r."DocType" = 'LND'
and r."DocflowUser" = an."value"
) or exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join dfd."EmpowermentWorkerDetail" as ewd on ewd."PCode" = t."VCode"
JOIN rp."RP_Person" AS p ON ewd."PersonId" = p."VCode"
JOIN rp."RP_PersonContact" AS pc on p."VCode" = pc."Pcode"
where an."id" = 'SignatoryUser'
and t."TypeName" = 'EmpowermentConstructor'
and pc."IdTypeContact" = 6
and pc."Code" = an."value"
)) | | EmpowermentSubject | Полномочия | and
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join dfd."EmpowermentSubjectDetail" as esd on esd."PCode" = t."VCode"
JOIN dfd."EmpowermentSubject" AS s ON esd."Subject" = s."VCode"
where an."id" = 'EmpowermentSubject'
and t."TypeName" = 'EmpowermentConstructor'
and s."VCode" = an."value"::bigint
)
| - -**В левую часть указывается скрипт:** +Filial | Организация | and exists( select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'Filial' and t."COrg"::text = an."value" )| ```sql SELECT t."VCode" AS "DocCode" @@ -141,7 +140,8 @@ SELECT t."VCode" AS "DocCode" , NULL::bigint AS "AddContractId" , NULL::bigint AS "ProjectId" FROM dfd."UniversalDocument" as t -WHERE t."COrg" = _orgidparam +WHERE 1 = 1 + ``` **В правую часть:** @@ -151,11 +151,11 @@ SELECT t."VCode" AS "DocCode" , t."TypeName" AS "DocType" , :DateProperty AS "DocDate" , :NumberProperty AS "DocNumber" - , NULL::text AS "DocName" - , NULL::text AS "DocTheme" - , NULL::text AS "DocDefinition" + , NULL AS "DocName" + , NULL AS "DocTheme" + , NULL AS "DocDefinition" FROM dfd."UniversalDocument" as t -WHERE t."COrg" = _orgidparam +WHERE 1 = 1 ``` ### Настраиваемая выборка "Приложение" @@ -167,6 +167,8 @@ WHERE t."COrg" = _orgidparam | CUser | Создатель документа | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying)
) | | Initiator | Инициатор | and(
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'Initiator'
and r."Initiator" = an."value"
)) | | StageUser | Участник маршрута | and
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
join comdoc."RouteStage" as s on s."PCode" = r."VCode"
join comdoc."StageItem" as i on i."PCode" = s."VCode"
where an."id" = 'StageUser'
and r."RouteStatus" NOT IN (4)
and i."StageUser" = an."value"
) | +| SignatoryUser | Работник | and(exists( select 1 from "tmp_anFilters_for_documentSearch" as an join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName" where an."id" = 'SignatoryUser' and r."DocType" = 'EmployeeStatement' and r."Initiator" = an."value" ) or exists( select 1 from "tmp_anFilters_for_documentSearch" as an join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName" join comdoc."RouteStage" as s on s."PCode" = r."VCode" join comdoc."StageItem" as i on i."PCode" = s."VCode" where an."id" = 'SignatoryUser' and r."DocType" = 'LND' AND r."RouteStatus" NOT IN(4) AND s."IsMarked" IS NOT true AND COALESCE(i."DocumentAction", 0) IN (20, 30) and i."StageUser" = an."value" ) or exists( select 1 from "tmp_anFilters_for_documentSearch" as an join comdoc."ReadListItem" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName" where an."id" = 'SignatoryUser' and r."DocType" = 'LND' +and r."DocflowUser" = an."value" ) or exists( select 1 from "tmp_anFilters_for_documentSearch" as an join dfd."EmpowermentWorkerDetail" as ewd on ewd."PCode" = t."VCode" JOIN rp."RP_Person" AS p ON ewd."PersonId" = p."VCode" JOIN rp."RP_PersonContact" AS pc on p."VCode" = pc."Pcode" where an."id" = 'SignatoryUser' and t."TypeName" = 'EmpowermentConstructor' and pc."IdTypeContact" = 6 and pc."Code" = an."value" ) )| **В левую часть указывается скрипт:**