This commit is contained in:
AdisakKanthawilang 2025-03-20 18:03:47 +07:00
parent 91f4c59e35
commit 8c30dc56f4

View file

@ -29,8 +29,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
import { OrgRevision } from "../entities/OrgRevision"; import { OrgRevision } from "../entities/OrgRevision";
import Extension from "../interfaces/extension"; import Extension from "../interfaces/extension";
import { log } from "console"; @Route("api/v1/org/profile/salaryTemp")
@Route("api/v1/org/profile/salaryTemp")
@Tags("ProfileSalaryTemp") @Tags("ProfileSalaryTemp")
@Security("bearerAuth") @Security("bearerAuth")
export class ProfileSalaryTempController extends Controller { export class ProfileSalaryTempController extends Controller {
@ -88,7 +87,7 @@ export class ProfileSalaryTempController extends Controller {
orgRevisionId: findRevision.id, orgRevisionId: findRevision.id,
}) })
.andWhere( .andWhere(
statusCheckEdit != undefined && statusCheckEdit != null statusCheckEdit != undefined && statusCheckEdit != null && statusCheckEdit.toUpperCase() != "ALL"
? "profile.statusCheckEdit = :statusCheckEdit" ? "profile.statusCheckEdit = :statusCheckEdit"
: "1=1", : "1=1",
{ {
@ -640,7 +639,10 @@ export class ProfileSalaryTempController extends Controller {
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
) { ) {
if (type.toLocaleUpperCase() == "OFFICER") { if (type.toLocaleUpperCase() == "OFFICER") {
const salary = await this.salaryRepo.find({ where: { profileId: profileId } }); const salary = await this.salaryRepo.find({
where: { profileId: profileId },
order: { order: "ASC" }
});
if (salary.length <= 0) { if (salary.length <= 0) {
let salaryOld = await this.salaryOldRepo.find({ let salaryOld = await this.salaryOldRepo.find({
where: { profileId: profileId }, where: { profileId: profileId },
@ -669,7 +671,10 @@ export class ProfileSalaryTempController extends Controller {
} }
return new HttpSuccess(salary); return new HttpSuccess(salary);
} else { } else {
const salary = await this.salaryRepo.find({ where: { profileEmployeeId: profileId } }); const salary = await this.salaryRepo.find({
where: { profileEmployeeId: profileId },
order: { order: "ASC" }
});
if (salary.length <= 0) { if (salary.length <= 0) {
let salaryOld = await this.salaryOldRepo.find({ let salaryOld = await this.salaryOldRepo.find({
where: { profileEmployeeId: profileId }, where: { profileEmployeeId: profileId },