commandType

This commit is contained in:
Bright 2025-07-18 11:15:33 +07:00
parent 1dc7badb4d
commit 437490f293
2 changed files with 66 additions and 5 deletions

View file

@ -266,6 +266,7 @@ export class CommandController extends Controller {
const [commands, total] = await this.commandRepository const [commands, total] = await this.commandRepository
.createQueryBuilder("command") .createQueryBuilder("command")
.leftJoinAndSelect("command.commandType", "commandType")
.andWhere( .andWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.orWhere( qb.orWhere(
@ -343,6 +344,7 @@ export class CommandController extends Controller {
commandYear: _data.commandYear, commandYear: _data.commandYear,
commandAffectDate: _data.commandAffectDate, commandAffectDate: _data.commandAffectDate,
commandExcecuteDate: _data.commandExcecuteDate, commandExcecuteDate: _data.commandExcecuteDate,
commandType: _data.commandType ? _data.commandType.code : null,
assignFullName: null, //xxxxxxxxxxxxxxx assignFullName: null, //xxxxxxxxxxxxxxx
createdFullName: _data.createdFullName, createdFullName: _data.createdFullName,
status: _data.status, status: _data.status,

View file

@ -307,7 +307,22 @@ export class ProfileSalaryController extends Controller {
}, },
order: { order: "ASC" }, order: { order: "ASC" },
}); });
return new HttpSuccess(record); const result = await Promise.all(
record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
} }
@Get("position/user") @Get("position/user")
@ -342,7 +357,22 @@ export class ProfileSalaryController extends Controller {
order: { order: "ASC" }, order: { order: "ASC" },
// order: { commandDateAffect: "ASC" }, // order: { commandDateAffect: "ASC" },
}); });
return new HttpSuccess(record); const result = await Promise.all(
record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
} }
@Get("{profileId}") @Get("{profileId}")
@ -361,7 +391,22 @@ export class ProfileSalaryController extends Controller {
// ? `${r.positionExecutive}(${r.positionExecutiveField})` // ? `${r.positionExecutive}(${r.positionExecutiveField})`
// : r.positionExecutive ?? null, // : r.positionExecutive ?? null,
// })); // }));
return new HttpSuccess(record); const result = await Promise.all(
record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
} }
@Get("position/{profileId}") @Get("position/{profileId}")
@ -403,8 +448,22 @@ export class ProfileSalaryController extends Controller {
// ? `${r.positionExecutive}(${r.positionExecutiveField})` // ? `${r.positionExecutive}(${r.positionExecutiveField})`
// : r.positionExecutive ?? null, // : r.positionExecutive ?? null,
// })); // }));
const result = await Promise.all(
return new HttpSuccess(record); record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
} }
@Get("tenure/user") @Get("tenure/user")