update view

This commit is contained in:
Bright 2025-03-05 18:14:40 +07:00
parent 3c0d83631f
commit 935ec5dae2
2 changed files with 32 additions and 26 deletions

View file

@ -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 {