update view
This commit is contained in:
parent
3c0d83631f
commit
935ec5dae2
2 changed files with 32 additions and 26 deletions
|
|
@ -51,7 +51,23 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
|||
FROM profileEducation ed
|
||||
WHERE ed.isUse IS TRUE
|
||||
ORDER BY ed.level ASC
|
||||
)
|
||||
),
|
||||
PositionDate AS (
|
||||
SELECT
|
||||
vcto.Years,
|
||||
vcto.Months,
|
||||
vcto.Days,
|
||||
vcto.profileEmployeeId
|
||||
FROM tenurePositionEmployee vcto
|
||||
),
|
||||
PositionLevelDate AS (
|
||||
SELECT
|
||||
vctlo.Years,
|
||||
vctlo.Months,
|
||||
vctlo.Days,
|
||||
vctlo.profileEmployeeId
|
||||
FROM tenureLevelEmployee vctlo
|
||||
)
|
||||
SELECT
|
||||
p.id as profileEmployeeId,
|
||||
p.citizenId,
|
||||
|
|
@ -93,12 +109,20 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
|||
p.dateRetireLaw,
|
||||
p.birthdate,
|
||||
ed.degree,
|
||||
TIMESTAMPDIFF(YEAR, p.birthdate, CURDATE()) AS age
|
||||
TIMESTAMPDIFF(YEAR, p.birthdate, CURDATE()) AS age,
|
||||
vcto.Years,
|
||||
vcto.Months,
|
||||
vcto.Days,
|
||||
vctlo.Years AS levelYears,
|
||||
vctlo.Months AS levelMonths,
|
||||
vctlo.Days AS levelDays
|
||||
FROM profileEmployee p
|
||||
LEFT JOIN employeePosLevel posLevel ON p.posLevelId = posLevel.id
|
||||
LEFT JOIN employeePosType posType ON p.posTypeId = posType.id
|
||||
LEFT JOIN PosMaster pm ON p.id = pm.current_holderId AND pm.pm_number = 1
|
||||
LEFT JOIN Education ed ON p.id = ed.profileEmployeeId AND ed.ed_number = 1
|
||||
LEFT JOIN PositionDate vcto ON p.id = vcto.profileEmployeeId
|
||||
LEFT JOIN PositionLevelDate vctlo ON p.id = vctlo.profileEmployeeId
|
||||
`,
|
||||
})
|
||||
export class viewRegistryEmployee {
|
||||
|
|
|
|||
|
|
@ -61,30 +61,16 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
|||
vcto.Years,
|
||||
vcto.Months,
|
||||
vcto.Days,
|
||||
vcto.profileId,
|
||||
ROW_NUMBER() OVER (PARTITION BY vcto.profileId) AS vcto_number
|
||||
FROM view_current_tenure_officer vcto
|
||||
WHERE vcto.orderNumber Is Null
|
||||
),
|
||||
PositionExcDate AS (
|
||||
SELECT
|
||||
vctoExc.Years,
|
||||
vctoExc.Months,
|
||||
vctoExc.Days,
|
||||
vctoExc.profileId,
|
||||
ROW_NUMBER() OVER (PARTITION BY vctoExc.profileId) AS vctoExc_number
|
||||
FROM view_current_tenure_exc_officer vctoExc
|
||||
WHERE vctoExc.orderNumber Is Null
|
||||
vcto.profileId
|
||||
FROM tenurePositionOfficer vcto
|
||||
),
|
||||
PositionLevelDate AS (
|
||||
SELECT
|
||||
vctlo.Years,
|
||||
vctlo.Months,
|
||||
vctlo.Days,
|
||||
vctlo.profileId,
|
||||
ROW_NUMBER() OVER (PARTITION BY vctlo.profileId) AS vctlo_number
|
||||
FROM view_current_tenure_level_officer vctlo
|
||||
WHERE vctlo.orderNumber Is Null
|
||||
vctlo.profileId
|
||||
FROM tenureLevelOfficer vctlo
|
||||
)
|
||||
SELECT
|
||||
p.id as profileId,
|
||||
|
|
@ -131,9 +117,6 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
|||
vcto.Years,
|
||||
vcto.Months,
|
||||
vcto.Days,
|
||||
vctoExc.Years AS posExecutiveYears,
|
||||
vctoExc.Months AS posExecutiveMonths,
|
||||
vctoExc.Days AS posExecutiveDays,
|
||||
vctlo.Years AS levelYears,
|
||||
vctlo.Months AS levelMonths,
|
||||
vctlo.Days AS levelDays
|
||||
|
|
@ -142,9 +125,8 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
|||
LEFT JOIN posType ON p.posTypeId = posType.id
|
||||
LEFT JOIN PosMaster pm ON p.id = pm.current_holderId AND pm.pm_number = 1
|
||||
LEFT JOIN Education ed ON p.id = ed.profileId AND ed.ed_number = 1
|
||||
LEFT JOIN PositionDate vcto ON p.id = vcto.profileId AND vcto.vcto_number = 1
|
||||
LEFT JOIN PositionExcDate vctoExc ON p.id = vctoExc.profileId AND vctoExc.vctoExc_number = 1
|
||||
LEFT JOIN PositionLevelDate vctlo ON p.id = vctlo.profileId AND vctlo.vctlo_number = 1
|
||||
LEFT JOIN PositionDate vcto ON p.id = vcto.profileId
|
||||
LEFT JOIN PositionLevelDate vctlo ON p.id = vctlo.profileId
|
||||
`,
|
||||
})
|
||||
export class viewRegistryOfficer {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue