This commit is contained in:
parent
5e9189a489
commit
e4f864a2ec
1 changed files with 64 additions and 68 deletions
|
|
@ -2301,52 +2301,48 @@ export class PositionController extends Controller {
|
||||||
child4: _data.child4,
|
child4: _data.child4,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.orWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.orWhere(
|
qb.andWhere(
|
||||||
new Brackets((qb) => {
|
body.keyword != null && body.keyword != ""
|
||||||
qb.andWhere(
|
? body.isAll == false
|
||||||
body.keyword != null && body.keyword != ""
|
? searchShortName
|
||||||
? body.isAll == false
|
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
|
||||||
? searchShortName
|
: "1=1",
|
||||||
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
|
|
||||||
: "1=1",
|
|
||||||
)
|
|
||||||
.andWhere(checkChildConditions)
|
|
||||||
.andWhere(typeCondition)
|
|
||||||
.andWhere(revisionCondition);
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
.orWhere(
|
.andWhere(checkChildConditions)
|
||||||
new Brackets((qb) => {
|
.andWhere(typeCondition)
|
||||||
qb.andWhere(
|
.andWhere(revisionCondition);
|
||||||
body.keyword != null && body.keyword != ""
|
}),
|
||||||
? `CONCAT(current_holder.prefix, current_holder.firstName," ",current_holder.lastName) like '%${body.keyword}%'`
|
)
|
||||||
: "1=1",
|
.orWhere(
|
||||||
{
|
new Brackets((qb) => {
|
||||||
keyword: `%${body.keyword}%`,
|
qb.andWhere(
|
||||||
},
|
body.keyword != null && body.keyword != ""
|
||||||
)
|
? `CONCAT(current_holder.prefix, current_holder.firstName," ",current_holder.lastName) like '%${body.keyword}%'`
|
||||||
.andWhere(checkChildConditions)
|
: "1=1",
|
||||||
.andWhere(typeCondition)
|
{
|
||||||
.andWhere(revisionCondition);
|
keyword: `%${body.keyword}%`,
|
||||||
}),
|
},
|
||||||
)
|
)
|
||||||
.orWhere(
|
.andWhere(checkChildConditions)
|
||||||
new Brackets((qb) => {
|
.andWhere(typeCondition)
|
||||||
qb.andWhere(
|
.andWhere(revisionCondition);
|
||||||
body.keyword != null && body.keyword != ""
|
}),
|
||||||
? `CASE WHEN orgRevision.orgRevisionIsDraft = true THEN CONCAT(next_holder.prefix, next_holder.firstName,' ', next_holder.lastName) ELSE CONCAT(current_holder.prefix, current_holder.firstName,' ' , current_holder.lastName) END LIKE '%${body.keyword}%'`
|
)
|
||||||
: "1=1",
|
.orWhere(
|
||||||
{
|
new Brackets((qb) => {
|
||||||
keyword: `%${body.keyword}%`,
|
qb.andWhere(
|
||||||
},
|
body.keyword != null && body.keyword != ""
|
||||||
)
|
? `CASE WHEN orgRevision.orgRevisionIsDraft = true THEN CONCAT(next_holder.prefix, next_holder.firstName,' ', next_holder.lastName) ELSE CONCAT(current_holder.prefix, current_holder.firstName,' ' , current_holder.lastName) END LIKE '%${body.keyword}%'`
|
||||||
.andWhere(checkChildConditions)
|
: "1=1",
|
||||||
.andWhere(typeCondition)
|
{
|
||||||
.andWhere(revisionCondition);
|
keyword: `%${body.keyword}%`,
|
||||||
}),
|
},
|
||||||
);
|
)
|
||||||
|
.andWhere(checkChildConditions)
|
||||||
|
.andWhere(typeCondition)
|
||||||
|
.andWhere(revisionCondition);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("orgRoot.orgRootOrder", "ASC")
|
.orderBy("orgRoot.orgRootOrder", "ASC")
|
||||||
|
|
@ -2824,50 +2820,50 @@ export class PositionController extends Controller {
|
||||||
const type0LastPosMasterNo =
|
const type0LastPosMasterNo =
|
||||||
requestBody.type == 0
|
requestBody.type == 0
|
||||||
? await this.posMasterRepository.find({
|
? await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: requestBody.id,
|
orgRootId: requestBody.id,
|
||||||
orgChild1Id: IsNull(),
|
orgChild1Id: IsNull(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const type1LastPosMasterNo =
|
const type1LastPosMasterNo =
|
||||||
requestBody.type == 1
|
requestBody.type == 1
|
||||||
? await this.posMasterRepository.find({
|
? await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
orgChild1Id: requestBody.id,
|
orgChild1Id: requestBody.id,
|
||||||
orgChild2Id: IsNull(),
|
orgChild2Id: IsNull(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const type2LastPosMasterNo =
|
const type2LastPosMasterNo =
|
||||||
requestBody.type == 2
|
requestBody.type == 2
|
||||||
? await this.posMasterRepository.find({
|
? await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
orgChild2Id: requestBody.id,
|
orgChild2Id: requestBody.id,
|
||||||
orgChild3Id: IsNull(),
|
orgChild3Id: IsNull(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const type3LastPosMasterNo =
|
const type3LastPosMasterNo =
|
||||||
requestBody.type == 3
|
requestBody.type == 3
|
||||||
? await this.posMasterRepository.find({
|
? await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
orgChild3Id: requestBody.id,
|
orgChild3Id: requestBody.id,
|
||||||
orgChild4Id: IsNull(),
|
orgChild4Id: IsNull(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const type4LastPosMasterNo =
|
const type4LastPosMasterNo =
|
||||||
requestBody.type == 4
|
requestBody.type == 4
|
||||||
? await this.posMasterRepository.find({
|
? await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
orgChild4Id: requestBody.id,
|
orgChild4Id: requestBody.id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const allLastPosMasterNo = [
|
const allLastPosMasterNo = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue