fix: searh org
This commit is contained in:
parent
bc418666ac
commit
cc6696cec8
5 changed files with 70 additions and 80 deletions
|
|
@ -1058,11 +1058,11 @@ export class EmployeePositionController extends Controller {
|
||||||
let checkChildConditions: any = {};
|
let checkChildConditions: any = {};
|
||||||
let keywordAsInt: any;
|
let keywordAsInt: any;
|
||||||
let searchShortName = "1=1";
|
let searchShortName = "1=1";
|
||||||
let searchShortName0 = `CONCAT_WS(" ",orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName0 = `CONCAT_WS(' ',orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName1 = `CONCAT_WS(" ",orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName1 = `CONCAT_WS(' ',orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName2 = `CONCAT_WS(" ",orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName2 = `CONCAT_WS(' ',orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName3 = `CONCAT_WS(" ",orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName3 = `CONCAT_WS(' ',orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName4 = `CONCAT_WS(" ",orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName4 = `CONCAT_WS(' ',orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let _data = await new permission().PermissionOrgList(request, "SYS_ORG_EMP");
|
let _data = await new permission().PermissionOrgList(request, "SYS_ORG_EMP");
|
||||||
if (body.type === 0) {
|
if (body.type === 0) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -1072,7 +1072,7 @@ export class EmployeePositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild1Id: IsNull(),
|
orgChild1Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 1) {
|
} else if (body.type === 1) {
|
||||||
|
|
@ -1083,7 +1083,7 @@ export class EmployeePositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild2Id: IsNull(),
|
orgChild2Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 2) {
|
} else if (body.type === 2) {
|
||||||
|
|
@ -1094,7 +1094,7 @@ export class EmployeePositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild3Id: IsNull(),
|
orgChild3Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 3) {
|
} else if (body.type === 3) {
|
||||||
|
|
@ -1105,14 +1105,14 @@ export class EmployeePositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild4Id: IsNull(),
|
orgChild4Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 4) {
|
} else if (body.type === 4) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild4Id: body.id,
|
orgChild4Id: body.id,
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
let findPosition: any;
|
let findPosition: any;
|
||||||
let masterId = new Array();
|
let masterId = new Array();
|
||||||
|
|
@ -1140,10 +1140,8 @@ export class EmployeePositionController extends Controller {
|
||||||
select: ["posMasterId"],
|
select: ["posMasterId"],
|
||||||
});
|
});
|
||||||
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
||||||
keywordAsInt = body.keyword == null ? null : parseInt(body.keyword, 10);
|
const numericMatch = body.keyword == null ? null : body.keyword.match(/\d+/);
|
||||||
if (isNaN(keywordAsInt)) {
|
keywordAsInt = numericMatch ? parseInt(numericMatch[0], 10) : null;
|
||||||
keywordAsInt = "P@ssw0rd!z";
|
|
||||||
}
|
|
||||||
masterId = [...new Set(masterId)];
|
masterId = [...new Set(masterId)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1158,7 +1156,7 @@ export class EmployeePositionController extends Controller {
|
||||||
...(body.keyword &&
|
...(body.keyword &&
|
||||||
(masterId.length > 0
|
(masterId.length > 0
|
||||||
? { id: In(masterId) }
|
? { id: In(masterId) }
|
||||||
: { posMasterNo: Like(`%${body.keyword}%`) })),
|
: keywordAsInt != null ? { posMasterNo: keywordAsInt } : {})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -777,11 +777,11 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
let checkChildConditions: any = {};
|
let checkChildConditions: any = {};
|
||||||
let keywordAsInt: any;
|
let keywordAsInt: any;
|
||||||
let searchShortName = "1=1";
|
let searchShortName = "1=1";
|
||||||
let searchShortName0 = `CONCAT(orgRoot.orgRootShortName," ",posMaster.posMasterNo)`;
|
let searchShortName0 = `CONCAT(orgRoot.orgRootShortName,' ',posMaster.posMasterNo)`;
|
||||||
let searchShortName1 = `CONCAT(orgChild1.orgChild1ShortName," ",posMaster.posMasterNo)`;
|
let searchShortName1 = `CONCAT(orgChild1.orgChild1ShortName,' ',posMaster.posMasterNo)`;
|
||||||
let searchShortName2 = `CONCAT(orgChild2.orgChild2ShortName," ",posMaster.posMasterNo)`;
|
let searchShortName2 = `CONCAT(orgChild2.orgChild2ShortName,' ',posMaster.posMasterNo)`;
|
||||||
let searchShortName3 = `CONCAT(orgChild3.orgChild3ShortName," ",posMaster.posMasterNo)`;
|
let searchShortName3 = `CONCAT(orgChild3.orgChild3ShortName,' ',posMaster.posMasterNo)`;
|
||||||
let searchShortName4 = `CONCAT(orgChild4.orgChild4ShortName," ",posMaster.posMasterNo)`;
|
let searchShortName4 = `CONCAT(orgChild4.orgChild4ShortName,' ',posMaster.posMasterNo)`;
|
||||||
let _data = await new permission().PermissionOrgList(request, "SYS_ORG_TEMP");
|
let _data = await new permission().PermissionOrgList(request, "SYS_ORG_TEMP");
|
||||||
if (body.type === 0) {
|
if (body.type === 0) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -791,7 +791,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild1Id: IsNull(),
|
orgChild1Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT(orgRoot.orgRootShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT(orgRoot.orgRootShortName,' ',posMaster.posMasterNo) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 1) {
|
} else if (body.type === 1) {
|
||||||
|
|
@ -802,7 +802,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild2Id: IsNull(),
|
orgChild2Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT(orgChild1.orgChild1ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT(orgChild1.orgChild1ShortName,' ',posMaster.posMasterNo) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 2) {
|
} else if (body.type === 2) {
|
||||||
|
|
@ -813,7 +813,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild3Id: IsNull(),
|
orgChild3Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT(orgChild2.orgChild2ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT(orgChild2.orgChild2ShortName,' ',posMaster.posMasterNo) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 3) {
|
} else if (body.type === 3) {
|
||||||
|
|
@ -824,14 +824,14 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild4Id: IsNull(),
|
orgChild4Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT(orgChild3.orgChild3ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,' ',posMaster.posMasterNo) like '%${body.keyword}%'`;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if (body.type === 4) {
|
} else if (body.type === 4) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild4Id: body.id,
|
orgChild4Id: body.id,
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT(orgChild4.orgChild4ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT(orgChild4.orgChild4ShortName,' ',posMaster.posMasterNo) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
let findPosition: any;
|
let findPosition: any;
|
||||||
let masterId = new Array();
|
let masterId = new Array();
|
||||||
|
|
@ -859,10 +859,8 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
select: ["posMasterTempId"],
|
select: ["posMasterTempId"],
|
||||||
});
|
});
|
||||||
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterTempId));
|
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterTempId));
|
||||||
keywordAsInt = body.keyword == null ? null : parseInt(body.keyword, 10);
|
const numericMatch = body.keyword == null ? null : body.keyword.match(/\d+/);
|
||||||
if (isNaN(keywordAsInt)) {
|
keywordAsInt = numericMatch ? parseInt(numericMatch[0], 10) : null;
|
||||||
keywordAsInt = "P@ssw0rd!z";
|
|
||||||
}
|
|
||||||
masterId = [...new Set(masterId)];
|
masterId = [...new Set(masterId)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -877,7 +875,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
...(body.keyword &&
|
...(body.keyword &&
|
||||||
(masterId.length > 0
|
(masterId.length > 0
|
||||||
? { id: In(masterId) }
|
? { id: In(masterId) }
|
||||||
: { posMasterNo: Like(`%${body.keyword}%`) })),
|
: keywordAsInt != null ? { posMasterNo: keywordAsInt } : {})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let query = AppDataSource.getRepository(EmployeeTempPosMaster)
|
let query = AppDataSource.getRepository(EmployeeTempPosMaster)
|
||||||
|
|
|
||||||
|
|
@ -1787,10 +1787,8 @@ export class PositionController extends Controller {
|
||||||
select: ["posMasterId"],
|
select: ["posMasterId"],
|
||||||
});
|
});
|
||||||
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
||||||
keywordAsInt = body.keyword == null ? null : parseInt(body.keyword, 10);
|
const numericMatch = body.keyword == null ? null : body.keyword.match(/\d+/);
|
||||||
if (isNaN(keywordAsInt)) {
|
keywordAsInt = numericMatch ? parseInt(numericMatch[0], 10) : null;
|
||||||
keywordAsInt = "P@ssw0rd!z";
|
|
||||||
}
|
|
||||||
masterId = [...new Set(masterId)];
|
masterId = [...new Set(masterId)];
|
||||||
|
|
||||||
//serch name สิทธิ์
|
//serch name สิทธิ์
|
||||||
|
|
@ -1823,7 +1821,7 @@ export class PositionController extends Controller {
|
||||||
...(body.keyword &&
|
...(body.keyword &&
|
||||||
(masterId.length > 0
|
(masterId.length > 0
|
||||||
? { id: In(masterId) }
|
? { id: In(masterId) }
|
||||||
: { posMasterNo: Like(`%${body.keyword}%`) })),
|
: keywordAsInt != null ? { posMasterNo: keywordAsInt } : {})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let [posMaster, total] = await AppDataSource.getRepository(PosMaster)
|
let [posMaster, total] = await AppDataSource.getRepository(PosMaster)
|
||||||
|
|
@ -2164,11 +2162,11 @@ export class PositionController extends Controller {
|
||||||
let checkChildConditions: any = {};
|
let checkChildConditions: any = {};
|
||||||
let keywordAsInt: any;
|
let keywordAsInt: any;
|
||||||
let searchShortName = "1=1";
|
let searchShortName = "1=1";
|
||||||
let searchShortName0 = `CONCAT_WS(" ",orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName0 = `CONCAT_WS(' ',orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName1 = `CONCAT_WS(" ",orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName1 = `CONCAT_WS(' ',orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName2 = `CONCAT_WS(" ",orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName2 = `CONCAT_WS(' ',orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName3 = `CONCAT_WS(" ",orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName3 = `CONCAT_WS(' ',orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName4 = `CONCAT_WS(" ",orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName4 = `CONCAT_WS(' ',orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let _data = await new permission().PermissionOrgList(request, "SYS_ORG");
|
let _data = await new permission().PermissionOrgList(request, "SYS_ORG");
|
||||||
if (body.type === 0) {
|
if (body.type === 0) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -2178,7 +2176,7 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild1Id: IsNull(),
|
orgChild1Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
} else if (body.type === 1) {
|
} else if (body.type === 1) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -2188,7 +2186,7 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild2Id: IsNull(),
|
orgChild2Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
} else if (body.type === 2) {
|
} else if (body.type === 2) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -2198,7 +2196,7 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild3Id: IsNull(),
|
orgChild3Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
} else if (body.type === 3) {
|
} else if (body.type === 3) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -2208,13 +2206,13 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild4Id: IsNull(),
|
orgChild4Id: IsNull(),
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
} else if (body.type === 4) {
|
} else if (body.type === 4) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild4Id: body.id,
|
orgChild4Id: body.id,
|
||||||
};
|
};
|
||||||
searchShortName = `CONCAT_WS(" ",orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
searchShortName = `CONCAT_WS(' ',orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
let findPosition: any;
|
let findPosition: any;
|
||||||
let masterId = new Array();
|
let masterId = new Array();
|
||||||
|
|
@ -2251,10 +2249,8 @@ export class PositionController extends Controller {
|
||||||
select: ["posMasterId"],
|
select: ["posMasterId"],
|
||||||
});
|
});
|
||||||
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
||||||
keywordAsInt = body.keyword == null ? null : parseInt(body.keyword, 10);
|
const numericMatch = body.keyword == null ? null : body.keyword.match(/\d+/);
|
||||||
if (isNaN(keywordAsInt)) {
|
keywordAsInt = numericMatch ? parseInt(numericMatch[0], 10) : null;
|
||||||
keywordAsInt = "P@ssw0rd!z";
|
|
||||||
}
|
|
||||||
masterId = [...new Set(masterId)];
|
masterId = [...new Set(masterId)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2281,7 +2277,7 @@ export class PositionController extends Controller {
|
||||||
...(body.keyword &&
|
...(body.keyword &&
|
||||||
(masterId.length > 0
|
(masterId.length > 0
|
||||||
? { id: In(masterId) }
|
? { id: In(masterId) }
|
||||||
: { posMasterNo: Like(`%${body.keyword}%`) })),
|
: keywordAsInt != null ? { posMasterNo: keywordAsInt } : {})),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -5478,10 +5474,8 @@ export class PositionController extends Controller {
|
||||||
select: ["posMasterId"],
|
select: ["posMasterId"],
|
||||||
});
|
});
|
||||||
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
|
||||||
keywordAsInt = body.keyword == null ? null : parseInt(body.keyword, 10);
|
const numericMatch = body.keyword == null ? null : body.keyword.match(/\d+/);
|
||||||
if (isNaN(keywordAsInt)) {
|
keywordAsInt = numericMatch ? parseInt(numericMatch[0], 10) : null;
|
||||||
keywordAsInt = "P@ssw0rd!z";
|
|
||||||
}
|
|
||||||
masterId = [...new Set(masterId)];
|
masterId = [...new Set(masterId)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5508,7 +5502,7 @@ export class PositionController extends Controller {
|
||||||
...(body.keyword &&
|
...(body.keyword &&
|
||||||
(masterId.length > 0
|
(masterId.length > 0
|
||||||
? { id: In(masterId) }
|
? { id: In(masterId) }
|
||||||
: { posMasterNo: Like(`%${body.keyword}%`) })),
|
: keywordAsInt != null ? { posMasterNo: keywordAsInt } : {})),
|
||||||
...(!body.isAll && { isCondition: true }),
|
...(!body.isAll && { isCondition: true }),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -6026,11 +6026,11 @@ export class ProfileController extends Controller {
|
||||||
} else if (searchField == "posNo") {
|
} else if (searchField == "posNo") {
|
||||||
queryLike = `
|
queryLike = `
|
||||||
CASE
|
CASE
|
||||||
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(' ', orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(' ', orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(' ', orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(' ', orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
ELSE CONCAT_WS(' ', orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
END LIKE :keyword
|
END LIKE :keyword
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
@ -6616,11 +6616,11 @@ export class ProfileController extends Controller {
|
||||||
} else if (searchField == "posNo") {
|
} else if (searchField == "posNo") {
|
||||||
queryLike = `
|
queryLike = `
|
||||||
CASE
|
CASE
|
||||||
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(' ', orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(' ', orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(' ', orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(' ', orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
ELSE CONCAT_WS(' ', orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
END LIKE :keyword
|
END LIKE :keyword
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
@ -7010,11 +7010,11 @@ export class ProfileController extends Controller {
|
||||||
} else if (searchField == "posNo") {
|
} else if (searchField == "posNo") {
|
||||||
queryLike = `
|
queryLike = `
|
||||||
CASE
|
CASE
|
||||||
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(' ', orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(' ', orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(' ', orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(' ', orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
ELSE CONCAT_WS(' ', orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
END LIKE :keyword
|
END LIKE :keyword
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2848,11 +2848,11 @@ export class ProfileEmployeeController extends Controller {
|
||||||
} else if (searchField == "posNo") {
|
} else if (searchField == "posNo") {
|
||||||
queryLike = `
|
queryLike = `
|
||||||
CASE
|
CASE
|
||||||
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(' ', orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(' ', orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(' ', orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(' ', orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
ELSE CONCAT_WS(' ', orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
END LIKE :keyword
|
END LIKE :keyword
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
@ -3207,11 +3207,11 @@ export class ProfileEmployeeController extends Controller {
|
||||||
} else if (searchField == "posNo") {
|
} else if (searchField == "posNo") {
|
||||||
queryLike = `
|
queryLike = `
|
||||||
CASE
|
CASE
|
||||||
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(' ', orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(' ', orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(' ', orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(' ', orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
ELSE CONCAT_WS(' ', orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
|
||||||
END LIKE :keyword
|
END LIKE :keyword
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue