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
|
FROM profileEducation ed
|
||||||
WHERE ed.isUse IS TRUE
|
WHERE ed.isUse IS TRUE
|
||||||
ORDER BY ed.level ASC
|
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
|
SELECT
|
||||||
p.id as profileEmployeeId,
|
p.id as profileEmployeeId,
|
||||||
p.citizenId,
|
p.citizenId,
|
||||||
|
|
@ -93,12 +109,20 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
||||||
p.dateRetireLaw,
|
p.dateRetireLaw,
|
||||||
p.birthdate,
|
p.birthdate,
|
||||||
ed.degree,
|
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
|
FROM profileEmployee p
|
||||||
LEFT JOIN employeePosLevel posLevel ON p.posLevelId = posLevel.id
|
LEFT JOIN employeePosLevel posLevel ON p.posLevelId = posLevel.id
|
||||||
LEFT JOIN employeePosType posType ON p.posTypeId = posType.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 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 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 {
|
export class viewRegistryEmployee {
|
||||||
|
|
|
||||||
|
|
@ -61,30 +61,16 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
||||||
vcto.Years,
|
vcto.Years,
|
||||||
vcto.Months,
|
vcto.Months,
|
||||||
vcto.Days,
|
vcto.Days,
|
||||||
vcto.profileId,
|
vcto.profileId
|
||||||
ROW_NUMBER() OVER (PARTITION BY vcto.profileId) AS vcto_number
|
FROM tenurePositionOfficer vcto
|
||||||
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
|
|
||||||
),
|
),
|
||||||
PositionLevelDate AS (
|
PositionLevelDate AS (
|
||||||
SELECT
|
SELECT
|
||||||
vctlo.Years,
|
vctlo.Years,
|
||||||
vctlo.Months,
|
vctlo.Months,
|
||||||
vctlo.Days,
|
vctlo.Days,
|
||||||
vctlo.profileId,
|
vctlo.profileId
|
||||||
ROW_NUMBER() OVER (PARTITION BY vctlo.profileId) AS vctlo_number
|
FROM tenureLevelOfficer vctlo
|
||||||
FROM view_current_tenure_level_officer vctlo
|
|
||||||
WHERE vctlo.orderNumber Is Null
|
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
p.id as profileId,
|
p.id as profileId,
|
||||||
|
|
@ -131,9 +117,6 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
||||||
vcto.Years,
|
vcto.Years,
|
||||||
vcto.Months,
|
vcto.Months,
|
||||||
vcto.Days,
|
vcto.Days,
|
||||||
vctoExc.Years AS posExecutiveYears,
|
|
||||||
vctoExc.Months AS posExecutiveMonths,
|
|
||||||
vctoExc.Days AS posExecutiveDays,
|
|
||||||
vctlo.Years AS levelYears,
|
vctlo.Years AS levelYears,
|
||||||
vctlo.Months AS levelMonths,
|
vctlo.Months AS levelMonths,
|
||||||
vctlo.Days AS levelDays
|
vctlo.Days AS levelDays
|
||||||
|
|
@ -142,9 +125,8 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
||||||
LEFT JOIN posType ON p.posTypeId = posType.id
|
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 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 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 PositionDate vcto ON p.id = vcto.profileId
|
||||||
LEFT JOIN PositionExcDate vctoExc ON p.id = vctoExc.profileId AND vctoExc.vctoExc_number = 1
|
LEFT JOIN PositionLevelDate vctlo ON p.id = vctlo.profileId
|
||||||
LEFT JOIN PositionLevelDate vctlo ON p.id = vctlo.profileId AND vctlo.vctlo_number = 1
|
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
export class viewRegistryOfficer {
|
export class viewRegistryOfficer {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue