update query master list
This commit is contained in:
parent
e5b8817cab
commit
ac36b37612
1 changed files with 16 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ import { Position } from "../entities/Position";
|
||||||
import { Profile } from "../entities/Profile";
|
import { Profile } from "../entities/Profile";
|
||||||
@Route("api/v1/org/pos")
|
@Route("api/v1/org/pos")
|
||||||
@Tags("Position")
|
@Tags("Position")
|
||||||
@Security("bearerAuth")
|
// @Security("bearerAuth")
|
||||||
@Response(
|
@Response(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||||
|
|
@ -850,6 +850,7 @@ export class PositionController extends Controller {
|
||||||
let typeCondition: any = {};
|
let typeCondition: any = {};
|
||||||
let checkChildConditions: any = {};
|
let checkChildConditions: any = {};
|
||||||
let keywordAsInt: any;
|
let keywordAsInt: any;
|
||||||
|
let searchShortName = "";
|
||||||
|
|
||||||
if (body.type === 0) {
|
if (body.type === 0) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -859,6 +860,9 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild1Id: IsNull(),
|
orgChild1Id: IsNull(),
|
||||||
};
|
};
|
||||||
|
searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
|
} else {
|
||||||
|
searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
} else if (body.type === 1) {
|
} else if (body.type === 1) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -868,6 +872,9 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild2Id: IsNull(),
|
orgChild2Id: IsNull(),
|
||||||
};
|
};
|
||||||
|
searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
|
} else {
|
||||||
|
searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
} else if (body.type === 2) {
|
} else if (body.type === 2) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -877,6 +884,9 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild3Id: IsNull(),
|
orgChild3Id: IsNull(),
|
||||||
};
|
};
|
||||||
|
searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
|
} else {
|
||||||
|
searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
}
|
}
|
||||||
} else if (body.type === 3) {
|
} else if (body.type === 3) {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
|
|
@ -886,11 +896,15 @@ export class PositionController extends Controller {
|
||||||
checkChildConditions = {
|
checkChildConditions = {
|
||||||
orgChild4Id: IsNull(),
|
orgChild4Id: IsNull(),
|
||||||
};
|
};
|
||||||
|
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||||
|
} else {
|
||||||
|
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,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(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();
|
||||||
|
|
@ -978,6 +992,7 @@ export class PositionController extends Controller {
|
||||||
.leftJoinAndSelect("posMaster.current_holder", "current_holder")
|
.leftJoinAndSelect("posMaster.current_holder", "current_holder")
|
||||||
.leftJoinAndSelect("posMaster.next_holder", "next_holder")
|
.leftJoinAndSelect("posMaster.next_holder", "next_holder")
|
||||||
.where(conditions)
|
.where(conditions)
|
||||||
|
.orWhere(searchShortName)
|
||||||
.orWhere(
|
.orWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where(
|
qb.where(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue