Fix ระบบทะเบียนประวัติ (ลูกจ้างชั่วคราว) >> ค้นหารายชื่อลูกจ้างชั่วคราว #1647
This commit is contained in:
parent
bda80475d1
commit
ffb9ea327d
1 changed files with 25 additions and 19 deletions
|
|
@ -1589,32 +1589,38 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
keyword2: `${posLevel}`,
|
keyword2: `${posLevel}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// .andWhere(
|
|
||||||
// isProbation != undefined && isProbation != null
|
|
||||||
// ? `profileEmployee.isProbation = ${isProbation}`
|
|
||||||
// : "1=1",
|
|
||||||
// )
|
|
||||||
// .andWhere(
|
|
||||||
// isRetire != undefined && isRetire != null
|
|
||||||
// ? isRetire == true
|
|
||||||
// ? `profileEmployee.dateRetire IS null`
|
|
||||||
// : `profileEmployee.dateRetire IS NOT NULL`
|
|
||||||
// : "1=1",
|
|
||||||
// )
|
|
||||||
.andWhere(
|
.andWhere(
|
||||||
"profileEmployee.employeeClass = :type", {
|
"profileEmployee.employeeClass = :type", {
|
||||||
type: type ? type.trim().toLocaleUpperCase() : "TEMP"
|
type: type ? type.trim().toLocaleUpperCase() : "TEMP"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.orWhere(
|
.orWhere(
|
||||||
|
new Brackets((qb) => {
|
||||||
|
if (!searchKeyword) {
|
||||||
|
qb.andWhere(
|
||||||
`current_holderTemps.orgRootId is null AND current_holderTemps.orgChild1Id is null AND
|
`current_holderTemps.orgRootId is null AND current_holderTemps.orgChild1Id is null AND
|
||||||
current_holderTemps.orgChild2Id is null AND current_holderTemps.orgChild3Id is null AND
|
current_holderTemps.orgChild2Id is null AND current_holderTemps.orgChild3Id is null AND
|
||||||
current_holderTemps.orgChild4Id is null AND profileEmployee.createdUserId = :keycloak AND
|
current_holderTemps.orgChild4Id is null AND profileEmployee.createdUserId = :keycloak AND
|
||||||
profileEmployee.employeeClass = :type`, {
|
profileEmployee.employeeClass = :type
|
||||||
|
`,
|
||||||
|
{
|
||||||
keycloak: request.user.sub,
|
keycloak: request.user.sub,
|
||||||
type: type ? type.trim().toLocaleUpperCase() : "TEMP",
|
type: type ? type.trim().toLocaleUpperCase() : "TEMP"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qb.andWhere(
|
||||||
|
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
|
||||||
|
? queryLike
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${searchKeyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
.skip((page - 1) * pageSize)
|
.skip((page - 1) * pageSize)
|
||||||
.take(pageSize)
|
.take(pageSize)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue