Fix [Bug] คำนวนระยะเวลาดำรงตำแหน่งในสายงาน, ระยะเวลาดำรงตำแหน่งตามระดับ และทางการบริหารของคนที่พ้นจากราชการ #137

This commit is contained in:
Bright 2025-07-18 13:41:52 +07:00
parent ea74db7005
commit 42cc69cbbe
5 changed files with 131 additions and 22 deletions

View file

@ -5050,10 +5050,19 @@ export class PositionController extends Controller {
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
: "1=1",
)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition)
.andWhere({ current_holderId: IsNull() });
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition)
.andWhere({ current_holderId: IsNull() });
}),
)
.orWhere(
new Brackets((qb) => {
qb.andWhere(`posMaster.conditionReason LIKE '%${body.keyword}%' AND posMaster.conditionReason IS NOT NULL`)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
.andWhere(revisionCondition)
.andWhere({ current_holderId: IsNull() });
}),
)
.orderBy("orgRoot.orgRootOrder", "ASC")