24217 контексПоискПодтип

This commit is contained in:
mirzakaev_tf 2024-12-26 10:50:53 +05:00
parent 95b9c8392c
commit f56905508e
1 changed files with 114 additions and 167 deletions

View File

@ -28,6 +28,8 @@ CUser | Создатель документа |
Curator | Куратор |
StageUser | Участник маршрута |
EmpowermentSubject | Полномочия |
Filial | Организация |
Subtype | Подтип |
Существует строго определённый набор значений поля "Id", приведённый в [таблице ниже](#таблица). Соответствующее им поле "Name" заполняется произвольно. В справочнике «Итоговые выборки поисковой системы» этим значениям будут поставлены в соответствие поля в таблицах, по которым будет осуществляться поиск и фильтрация документов с вложениями.
@ -96,177 +98,122 @@ WHERE 1 = 1
<!-- ![Пример документа "Итог FTS"](./media/ResultFTSForm.png) -->
В табличную часть "Фильтры" указывается следующее:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SQL Syntax Highlighting</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f2f2f2;
text-align: left;
}
code {
background-color: #f9f9f9;
padding: 2px 4px;
border-radius: 4px;
}
.sql-keyword {
color: #0000FF;
font-weight: bold;
}
.sql-identifier {
color: #A31515;
}
.sql-string {
color: #A31515;
}
.sql-comment {
color: #008000;
}
</style>
</head>
<body>
**CUser - Создатель документа**
```sql
and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying)
)
```
<h2>Примеры настраиваемых выборок</h2>
<h3>Настраиваемая выборка для кадрового электронного документооборота</h3>
**Initiator - Инициатор**
```sql
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"
)
)
```
<table>
<thead>
<tr>
<th>Код</th>
<th>Наименование</th>
<th>SQLScript</th>
</tr>
</thead>
<tbody>
<tr>
<td>CUser</td>
<td>Создатель документа</td>
<td><code>and exists( select 1 from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'CUser'</span> and an.<span class="sql-identifier">"value"</span> = cast(t.<span class="sql-identifier">"CUser"</span> as character varying) )</code></td>
</tr>
<tr>
<td>Initiator</td>
<td>Инициатор</td>
<td>
<code>and( <br>
exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
join <span class="sql-identifier">comdoc."Route"</span> as r on r.<span class="sql-identifier">"DocCode"</span> = t.<span class="sql-identifier">"VCode"</span> and r.<span class="sql-identifier">"DocType"</span> = t.<span class="sql-identifier">"TypeName"</span> <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'Initiator'</span> <br>
and r.<span class="sql-identifier">"Initiator"</span> = an.<span class="sql-identifier">"value"</span> <br>
)</code>
</td>
</tr>
<tr>
<td>StageUser</td>
<td>Участник маршрута</td>
<td>
<code>and <br>
exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
join <span class="sql-identifier">comdoc."Route"</span> as r on r.<span class="sql-identifier">"DocCode"</span> = t.<span class="sql-identifier">"VCode"</span> and r.<span class="sql-identifier">"DocType"</span> = t.<span class="sql-identifier">"TypeName"</span> <br>
join <span class="sql-identifier">comdoc."RouteStage"</span> as s on s.<span class="sql-identifier">"PCode"</span> = r.<span class="sql-identifier">"VCode"</span> <br>
join <span class="sql-identifier">comdoc."StageItem"</span> as i on i.<span class="sql-identifier">"PCode"</span> = s.<span class="sql-identifier">"VCode"</span> <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'StageUser'</span> <br>
and r.<span class="sql-identifier">"RouteStatus"</span> NOT IN (4) <br>
and i.<span class="sql-identifier">"StageUser"</span> = an.<span class="sql-identifier">"value"</span> <br>
)</code>
</td>
</tr>
<tr>
<td>SignatoryUser</td>
<td>Работник</td>
<td>
<code>and( <br>
exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
join <span class="sql-identifier">comdoc."Route"</span> as r on r.<span class="sql-identifier">"DocCode"</span> = t.<span class="sql-identifier">"VCode"</span> and r.<span class="sql-identifier">"DocType"</span> = t.<span class="sql-identifier">"TypeName"</span> <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'SignatoryUser'</span> <br>
and r.<span class="sql-identifier">"DocType"</span> = <span class="sql-string">'EmployeeStatement'</span> <br>
and r.<span class="sql-identifier">"Initiator"</span> = an.<span class="sql-identifier">"value"</span> <br>
) or exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
join <span class="sql-identifier">comdoc."Route"</span> as r on r.<span class="sql-identifier">"DocCode"</span> = t.<span class="sql-identifier">"VCode"</span> and r.<span class="sql-identifier">"DocType"</span> = t.<span class="sql-identifier">"TypeName"</span> <br>
join <span class="sql-identifier">comdoc."RouteStage"</span> as s on s.<span class="sql-identifier">"PCode"</span> = r.<span class="sql-identifier">"VCode"</span> <br>
join <span class="sql-identifier">comdoc."StageItem"</span> as i on i.<span class="sql-identifier">"PCode"</span> = s.<span class="sql-identifier">"VCode"</span> <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'SignatoryUser'</span> <br>
and r.<span class="sql-identifier">"DocType"</span> = <span class="sql-string">'LND'</span> <br>
AND r.<span class="sql-identifier">"RouteStatus"</span> NOT IN(4) <br>
AND s.<span class="sql-identifier">"IsMarked"</span> IS NOT true <br>
AND COALESCE(i.<span class="sql-identifier">"DocumentAction"</span>, 0) IN (20, 30) <br>
and i.<span class="sql-identifier">"StageUser"</span> = an.<span class="sql-identifier">"value"</span> <br>
) or exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
join <span class="sql-identifier">comdoc."ReadListItem"</span> as r on r.<span class="sql-identifier">"DocCode"</span> = t.<span class="sql-identifier">"VCode"</span> and r.<span class="sql-identifier">"DocType"</span> = t.<span class="sql-identifier">"TypeName"</span> <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'SignatoryUser'</span> <br>
and r.<span class="sql-identifier">"DocType"</span> = <span class="sql-string">'LND'</span> <br>
and r.<span class="sql-identifier">"DocflowUser"</span> = an.<span class="sql-identifier">"value"</span> <br>
) or exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
join <span class="sql-identifier">dfd."EmpowermentWorkerDetail"</span> as ewd on ewd.<span class="sql-identifier">"PCode"</span> = t.<span class="sql-identifier">"VCode"</span> <br>
JOIN <span class="sql-identifier">rp."RP_Person"</span> AS p ON ewd.<span class="sql-identifier">"PersonId"</span> = p.<span class="sql-identifier">"VCode"</span> <br>
JOIN <span class="sql-identifier">rp."RP_PersonContact"</span> AS pc on p.<span class="sql-identifier">"VCode"</span> = pc.<span class="sql-identifier">"Pcode"</span> <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'SignatoryUser'</span> <br>
and t.<span class="sql-identifier">"TypeName"</span> = <span class="sql-string">'EmpowermentConstructor'</span> <br>
and pc.<span class="sql-identifier">"IdTypeContact"</span> = 6 <br>
and pc.<span class="sql-identifier">"Code"</span> = an.<span class="sql-identifier">"value"</span> <br>
)
)
</code>
</td>
</tr>
<tr>
<td>EmpowermentSubject</td>
<td>Полномочия</td>
<td>
<code>and <br>
exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
join <span class="sql-identifier">dfd."EmpowermentSubjectDetail"</span> as esd on esd.<span class="sql-identifier">"PCode"</span> = t.<span class="sql-identifier">"VCode"</span> <br>
JOIN <span class="sql-identifier">dfd."EmpowermentSubject"</span> AS s ON esd.<span class="sql-identifier">"Subject"</span> = s.<span class="sql-identifier">"VCode"</span> <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'EmpowermentSubject'</span> <br>
and t.<span class="sql-identifier">"TypeName"</span> = <span class="sql-string">'EmpowermentConstructor'</span> <br>
and s.<span class="sql-identifier">"VCode"</span> = an.<span class="sql-identifier">"value"</span>::bigint <br>
)
</code>
</td>
</tr>
<tr>
<td>Filial</td>
<td>Организация</td>
<td>
<code>and exists( <br>
select 1 <br>
from <span class="sql-identifier">"tmp_anFilters_for_documentSearch"</span> as an <br>
where an.<span class="sql-identifier">"id"</span> = <span class="sql-string">'Filial'</span> <br>
and t.<span class="sql-identifier">"COrg"</span>::text = an.<span class="sql-identifier">"value"</span> <br>
)
</code>
</td>
</tr>
</tbody>
</table>
**StageUser - Участник маршрута**
```sql
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"
)
</body>
</html> |
```
**EmpowermentSubject - Полномочия**
```sql
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
)
```
**SignatoryUser - Работник**
```sql
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"
)
)
```
**Filial - Организация**
```sql
and
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
where an."id" = 'Filial'
and t."COrg"::text = an."value"
)
```
**Subtype - Подтип**
```sql
and
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
where an."id" = 'Subtype'
and t."DocumentSubtype"::text = an."value"::text
)
```
## Настройка документов