no message
This commit is contained in:
parent
c90319d010
commit
91222163d3
1 changed files with 52 additions and 39 deletions
|
|
@ -779,21 +779,22 @@ export class PositionController extends Controller {
|
|||
};
|
||||
}
|
||||
const keywordCondition = {}
|
||||
? {
|
||||
posMasterNoPrefix: Like(`%${body.keyword}%`),
|
||||
positionName: Like(`%${body.keyword}%`),
|
||||
posTypeName: Like(`%${body.keyword}%`),
|
||||
posLevelName: Like(`%${body.keyword}%`),
|
||||
}
|
||||
: {};
|
||||
|
||||
? {
|
||||
posMasterNoPrefix: Like(`%${body.keyword}%`),
|
||||
positionName: Like(`%${body.keyword}%`),
|
||||
posTypeName: Like(`%${body.keyword}%`),
|
||||
posLevelName: Like(`%${body.keyword}%`),
|
||||
}
|
||||
: {};
|
||||
|
||||
const posMaster = await this.posMasterRepository.find({
|
||||
where: {
|
||||
...typeCondition,
|
||||
...checkChildConditions,
|
||||
...keywordCondition,
|
||||
// ...keywordCondition,
|
||||
},
|
||||
order: { posMasterOrder: "ASC" },
|
||||
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
|
||||
skip: (body.page - 1) * body.pageSize,
|
||||
take: body.pageSize,
|
||||
});
|
||||
|
|
@ -815,6 +816,20 @@ export class PositionController extends Controller {
|
|||
posMasterNoPrefix: posMaster.posMasterNoPrefix,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
posMasterNoSuffix: posMaster.posMasterNoSuffix,
|
||||
orgShortname:
|
||||
body.type === 0
|
||||
? posMaster.orgRoot.orgRootShortName
|
||||
: body.type === 1
|
||||
? posMaster.orgChild1.orgChild1ShortName
|
||||
: body.type === 2
|
||||
? posMaster.orgChild2.orgChild2ShortName
|
||||
: body.type === 3
|
||||
? posMaster.orgChild3.orgChild3ShortName
|
||||
: body.type === 4
|
||||
? posMaster.orgChild4.orgChild4ShortName
|
||||
: "-",
|
||||
// profileIdCurrentHolder: posMaster.profileIdCurrentHolder,
|
||||
// profileIdNextHolder: posMaster.profileIdNextHolder,
|
||||
positions: positions.map((position) => ({
|
||||
id: position.id,
|
||||
positionName: position.positionName,
|
||||
|
|
@ -1004,27 +1019,27 @@ export class PositionController extends Controller {
|
|||
* @summary ORG_041 - เพิ่มตำแหน่งทางการบริหาร (ADMIN) #44
|
||||
*
|
||||
*/
|
||||
@Post("executive")
|
||||
async createPosExecutive(
|
||||
@Post("executive")
|
||||
async createPosExecutive(
|
||||
@Body()
|
||||
requestBody: CreatePosMaster,
|
||||
@Request() request: { user: Record<string, any> }
|
||||
) {
|
||||
requestBody: CreatePosMaster,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const posExecutive = Object.assign(new PosExecutive(), requestBody);
|
||||
if (!posExecutive) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
try {
|
||||
posExecutive.createdUserId = request.user.sub;
|
||||
posExecutive.createdFullName = request.user.name;
|
||||
posExecutive.lastUpdateUserId = request.user.sub;
|
||||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
try {
|
||||
posExecutive.createdUserId = request.user.sub;
|
||||
posExecutive.createdFullName = request.user.name;
|
||||
posExecutive.lastUpdateUserId = request.user.sub;
|
||||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขตำแหน่งทางการบริหาร
|
||||
|
|
@ -1033,28 +1048,27 @@ export class PositionController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ตำแหน่งทางการบริหาร
|
||||
*/
|
||||
@Put("executive/{id}")
|
||||
async updatePosExecutive(
|
||||
@Put("executive/{id}")
|
||||
async updatePosExecutive(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: CreatePosMaster,
|
||||
@Request() request: { user: Record<string, any> }
|
||||
) {
|
||||
requestBody: CreatePosMaster,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const posExecutive = Object.assign(new PosExecutive(), requestBody);
|
||||
if (!posExecutive) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id);
|
||||
}
|
||||
try {
|
||||
posExecutive.lastUpdateUserId = request.user.sub;
|
||||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
try {
|
||||
posExecutive.lastUpdateUserId = request.user.sub;
|
||||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API ลบอัตรากำลัง
|
||||
*
|
||||
|
|
@ -1078,5 +1092,4 @@ export class PositionController extends Controller {
|
|||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue