fix report & comment

This commit is contained in:
Bright 2025-02-24 11:22:58 +07:00
parent 88805b6040
commit f1f38ca3eb
2 changed files with 20 additions and 20 deletions

View file

@ -177,12 +177,12 @@ export class ReportController extends Controller {
@Query() posType?: string,
@Query() posLevel?: string,
@Query() position?: string,
@Query() posExecutiveName?: string,
@Query() positionExecutive?: string,
@Query() gender?: string,
@Query() status?: string,
@Query() education?: string,
@Query() startDateAppoint?: Date,
@Query() endDateAppoint?: Date,
@Query() dateStart?: Date,
@Query() dateEnd?: Date,
@Query() ageMin?: number,
@Query() ageMax?: number,
@Query() isProbation?: boolean,
@ -216,12 +216,12 @@ export class ReportController extends Controller {
nodeCondition = "registryOfficer.orgChild4Id = :nodeId";
}
let dateAppointCondition = "1=1";
if (startDateAppoint && endDateAppoint) {
if (dateStart && dateEnd) {
dateAppointCondition =
"DATE(registryOfficer.dateAppoint) >= :startDateAppoint AND DATE(registryOfficer.dateAppoint) <= :endDateAppoint";
} else if (startDateAppoint) {
} else if (dateStart) {
dateAppointCondition = "DATE(registryOfficer.dateAppoint) >= :startDateAppoint";
} else if (endDateAppoint) {
} else if (dateEnd) {
dateAppointCondition = "DATE(registryOfficer.dateAppoint) <= :endDateAppoint";
}
@ -243,8 +243,8 @@ export class ReportController extends Controller {
ageMax,
})
.andWhere(dateAppointCondition, {
startDateAppoint: startDateAppoint?.toISOString().split("T")[0],
endDateAppoint: endDateAppoint?.toISOString().split("T")[0],
startDateAppoint: dateStart?.toISOString().split("T")[0],
endDateAppoint: dateEnd?.toISOString().split("T")[0],
})
.andWhere("registryOfficer.isProbation = :isProbation", {
isProbation: isProbation,
@ -275,11 +275,11 @@ export class ReportController extends Controller {
}
)
.andWhere(
posExecutiveName != null && posExecutiveName != ""
positionExecutive != null && positionExecutive != ""
? "registryOfficer.posExecutiveName LIKE :posExecutiveName"
: "1=1",
{
posExecutiveName: `%${posExecutiveName}%`,
posExecutiveName: `%${positionExecutive}%`,
}
)
.andWhere(
@ -477,8 +477,8 @@ export class ReportController extends Controller {
@Query() gender?: string,
@Query() status?: string,
@Query() education?: string,
@Query() startDateAppoint?: Date,
@Query() endDateAppoint?: Date,
@Query() dateStart?: Date,
@Query() dateEnd?: Date,
@Query() isProbation?: boolean,
@Query() isRetire?: boolean,
@Query() retireType?: string,
@ -512,12 +512,12 @@ export class ReportController extends Controller {
nodeCondition = "registryEmployee.orgChild4Id = :nodeId";
}
let dateAppointCondition = "1=1";
if (startDateAppoint && endDateAppoint) {
if (dateStart && dateEnd) {
dateAppointCondition =
"DATE(registryEmployee.dateAppoint) >= :startDateAppoint AND DATE(registryEmployee.dateAppoint) <= :endDateAppoint";
} else if (startDateAppoint) {
} else if (dateStart) {
dateAppointCondition = "DATE(registryEmployee.dateAppoint) >= :startDateAppoint";
} else if (endDateAppoint) {
} else if (dateEnd) {
dateAppointCondition = "DATE(registryEmployee.dateAppoint) <= :endDateAppoint";
}
@ -538,8 +538,8 @@ export class ReportController extends Controller {
ageMax,
})
.andWhere(dateAppointCondition, {
startDateAppoint: startDateAppoint?.toISOString().split("T")[0],
endDateAppoint: endDateAppoint?.toISOString().split("T")[0],
startDateAppoint: dateStart?.toISOString().split("T")[0],
endDateAppoint: dateEnd?.toISOString().split("T")[0],
})
.andWhere("registryEmployee.isProbation = :isProbation", {
isProbation: isProbation,