21370 архив по сорг

This commit is contained in:
mirzakaev_tf 2024-07-15 11:47:14 +05:00
parent 540fb24ec6
commit 6c473047f5
1 changed files with 23 additions and 21 deletions

View File

@ -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(<br> select 1 from "tmp_anFilters_for_documentSearch" as an<br> join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"<br> join comdoc."RouteStage" as s on s."PCode" = r."VCode"<br> join comdoc."StageItem" as i on i."PCode" = s."VCode"<br> where an."id" = 'StageUser'<br> and r."RouteStatus" NOT IN (4)<br> and i."StageUser" = an."value"<br>) |
| CUser | Создатель документа | and exists(<br> select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying)) |
| Initiator | Инициатор | and(<br> exists(<br> select 1<br> from "tmp_anFilters_for_documentSearch" as an<br> join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"<br> where an."id" = 'Initiator'<br> 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 <br> exists( <br> select 1 <br> from "tmp_anFilters_for_documentSearch" as an <br> join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName" <br> join comdoc."RouteStage" as s on s."PCode" = r."VCode" <br> join comdoc."StageItem" as i on i."PCode" = s."VCode" <br> where an."id" = 'StageUser' <br> and r."RouteStatus" NOT IN (4) <br> and i."StageUser" = an."value" <br> ) |
| SignatoryUser | Работник | and( <br> exists( <br> select 1 <br> from "tmp_anFilters_for_documentSearch" as an <br> join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName" <br> where an."id" = 'SignatoryUser' <br> and r."DocType" = 'EmployeeStatement' <br> and r."Initiator" = an."value" <br> ) or exists( <br> select 1 <br> from "tmp_anFilters_for_documentSearch" as an <br> join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName" <br> join comdoc."RouteStage" as s on s."PCode" = r."VCode" <br> join comdoc."StageItem" as i on i."PCode" = s."VCode" <br> where an."id" = 'SignatoryUser' <br> and r."DocType" = 'LND' <br> AND r."RouteStatus" NOT IN(4) <br> AND s."IsMarked" IS NOT true <br> AND COALESCE(i."DocumentAction", 0) IN (20, 30) <br> and i."StageUser" = an."value" <br> ) or exists( <br> select 1 <br> from "tmp_anFilters_for_documentSearch" as an <br> join comdoc."ReadListItem" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName" <br> where an."id" = 'SignatoryUser' <br> and r."DocType" = 'LND' <br> and r."DocflowUser" = an."value" <br> ) or exists( <br> select 1 <br> from "tmp_anFilters_for_documentSearch" as an <br> join dfd."EmpowermentWorkerDetail" as ewd on ewd."PCode" = t."VCode" <br> JOIN rp."RP_Person" AS p ON ewd."PersonId" = p."VCode" <br> JOIN rp."RP_PersonContact" AS pc on p."VCode" = pc."Pcode" <br> where an."id" = 'SignatoryUser' <br> and t."TypeName" = 'EmpowermentConstructor' <br> and pc."IdTypeContact" = 6 <br> and pc."Code" = an."value" <br> )) |
| EmpowermentSubject | Полномочия | and <br> exists( <br> select 1 <br> from "tmp_anFilters_for_documentSearch" as an <br> join dfd."EmpowermentSubjectDetail" as esd on esd."PCode" = t."VCode" <br> JOIN dfd."EmpowermentSubject" AS s ON esd."Subject" = s."VCode" <br> where an."id" = 'EmpowermentSubject' <br> and t."TypeName" = 'EmpowermentConstructor' <br> and s."VCode" = an."value"::bigint <br> ) <br> |
**В левую часть указывается скрипт:**
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(<br> select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying)<br>) |
| Initiator | Инициатор | and(<br> exists(<br> select 1<br> from "tmp_anFilters_for_documentSearch" as an<br> join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"<br> where an."id" = 'Initiator'<br> and r."Initiator" = an."value"<br> )) |
| StageUser | Участник маршрута | and <br> exists(<br> select 1<br> from "tmp_anFilters_for_documentSearch" as an<br> join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"<br> join comdoc."RouteStage" as s on s."PCode" = r."VCode"<br> join comdoc."StageItem" as i on i."PCode" = s."VCode"<br> where an."id" = 'StageUser'<br> and r."RouteStatus" NOT IN (4)<br> and i."StageUser" = an."value"<br> ) |
| 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" ) )|
**В левую часть указывается скрипт:**