fix posNo

This commit is contained in:
Bright 2024-12-03 17:37:54 +07:00
parent e8ed7c774b
commit 04c200027f
3 changed files with 21 additions and 45 deletions

View file

@ -107,21 +107,13 @@ export class PermissionOrgController extends Controller {
queryLike = "profile.position LIKE :keyword";
} else if (searchField == "posNo") {
queryLike = `
IF(current_holders.orgChild4Id IS NOT NULL,
CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild3Id IS NOT NULL,
CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild2Id IS NOT NULL,
CONCAT(orgChild2.orgChild2ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild1Id IS NOT NULL,
CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild1Id IS NULL,
CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo), ''
) LIKE :keyword
CASE
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT(orgChild2.orgChild2ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo)
ELSE CONCAT(orgRoot.orgRootShortName, current_holders.posMasterNo)
END LIKE :keyword
`;
}
const findRevision = await this.orgRevisionRepository.findOne({

View file

@ -3758,21 +3758,13 @@ export class ProfileController extends Controller {
queryLike = "profile.position LIKE :keyword";
} else if (searchField == "posNo") {
queryLike = `
IF(current_holders.orgChild4Id IS NOT NULL,
CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild3Id IS NOT NULL,
CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild2Id IS NOT NULL,
CONCAT(orgChild2.orgChild2ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild1Id IS NOT NULL,
CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild1Id IS NULL,
CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo), ''
) LIKE :keyword
CASE
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT(orgChild2.orgChild2ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo)
ELSE CONCAT(orgRoot.orgRootShortName, current_holders.posMasterNo)
END LIKE :keyword
`;
}
let nodeCondition = "1=1";

View file

@ -1386,21 +1386,13 @@ export class ProfileEmployeeController extends Controller {
queryLike = "profileEmployee.position LIKE :keyword";
} else if (searchField == "posNo") {
queryLike = `
IF(current_holders.orgChild4Id IS NOT NULL,
CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild3Id IS NOT NULL,
CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild2Id IS NOT NULL,
CONCAT(orgChild2.orgChild2ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild1Id IS NOT NULL,
CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo), ''
) LIKE :keyword OR
IF(current_holders.orgChild1Id IS NULL,
CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo), ''
) LIKE :keyword
CASE
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT(orgChild2.orgChild2ShortName, current_holders.posMasterNo)
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo)
ELSE CONCAT(orgRoot.orgRootShortName, current_holders.posMasterNo)
END LIKE :keyword
`;
}
let nodeCondition = "1=1";