fix เอกสาร กพ.7/กก.1 #1642
This commit is contained in:
parent
ee2221b719
commit
acfac64f9c
6 changed files with 1451 additions and 39 deletions
|
|
@ -1497,6 +1497,15 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
} else if (searchField == "position") {
|
||||
queryLike = "profileEmployee.position LIKE :keyword";
|
||||
}
|
||||
let _conditionAll =
|
||||
`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.orgChild4Id is null AND profileEmployee.createdUserId = :keycloak AND
|
||||
profileEmployee.employeeClass = :type`
|
||||
let _conditionFullname=
|
||||
`CONCAT(profileEmployee.prefix, profileEmployee.firstName, ' ', profileEmployee.lastName) LIKE :keyword`
|
||||
let _conditionCitizenId =
|
||||
`profileEmployee.citizenId LIKE :keyword`
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
|
@ -1598,11 +1607,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
new Brackets((qb) => {
|
||||
if (!searchKeyword) {
|
||||
qb.andWhere(
|
||||
`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.orgChild4Id is null AND profileEmployee.createdUserId = :keycloak AND
|
||||
profileEmployee.employeeClass = :type
|
||||
`,
|
||||
_conditionAll,
|
||||
{
|
||||
keycloak: request.user.sub,
|
||||
type: type ? type.trim().toLocaleUpperCase() : "TEMP"
|
||||
|
|
@ -1610,14 +1615,26 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
)
|
||||
}
|
||||
else {
|
||||
qb.andWhere(
|
||||
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
|
||||
? queryLike
|
||||
: "1=1",
|
||||
if (searchField != "citizenId") {
|
||||
qb.andWhere(
|
||||
`${_conditionAll} AND ${_conditionFullname}`,
|
||||
{
|
||||
keyword: `%${searchKeyword}%`,
|
||||
keycloak: request.user.sub,
|
||||
type: type ? type.trim().toLocaleUpperCase() : "TEMP"
|
||||
},
|
||||
)
|
||||
}
|
||||
else {
|
||||
qb.andWhere(
|
||||
`${_conditionAll} AND ${_conditionCitizenId}`,
|
||||
{
|
||||
keyword: `%${searchKeyword}%`,
|
||||
keycloak: request.user.sub,
|
||||
type: type ? type.trim().toLocaleUpperCase() : "TEMP"
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue