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"; queryLike = "profile.position LIKE :keyword";
} else if (searchField == "posNo") { } else if (searchField == "posNo") {
queryLike = ` queryLike = `
IF(current_holders.orgChild4Id IS NOT NULL, CASE
CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo), '' WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, current_holders.posMasterNo)
) LIKE :keyword OR WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo)
IF(current_holders.orgChild3Id IS NOT NULL, WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT(orgChild2.orgChild2ShortName, current_holders.posMasterNo)
CONCAT(orgChild3.orgChild3ShortName, current_holders.posMasterNo), '' WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT(orgChild1.orgChild1ShortName, current_holders.posMasterNo)
) LIKE :keyword OR ELSE CONCAT(orgRoot.orgRootShortName, current_holders.posMasterNo)
IF(current_holders.orgChild2Id IS NOT NULL, END LIKE :keyword
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
`; `;
} }
const findRevision = await this.orgRevisionRepository.findOne({ const findRevision = await this.orgRevisionRepository.findOne({

View file

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

View file

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