[Bug อัตรากำลังลูกจ้างประจำ] 1 คนเลือกครองได้ 1 ตำแหน่ง #116
This commit is contained in:
parent
5e4f119730
commit
0732071da0
2 changed files with 53 additions and 14 deletions
|
|
@ -2590,7 +2590,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
const [profiles, total] = await this.profileRepo
|
const [profiles, total] = await this.profileRepo
|
||||||
.createQueryBuilder("profileEmployee")
|
.createQueryBuilder("profileEmployee")
|
||||||
.leftJoinAndSelect("profileEmployee.next_holders", "next_holders")
|
.leftJoinAndSelect("profileEmployee.current_holders", "current_holders")
|
||||||
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
|
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("profileEmployee.posType", "posType")
|
.leftJoinAndSelect("profileEmployee.posType", "posType")
|
||||||
.where(
|
.where(
|
||||||
|
|
@ -2606,12 +2606,29 @@ export class ProfileEmployeeController extends Controller {
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where(
|
qb.where(
|
||||||
requestBody.keyword != null && requestBody.keyword != ""
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword`
|
? "profileEmployee.prefix LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
},
|
},
|
||||||
).orWhere(
|
)
|
||||||
|
.orWhere(
|
||||||
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
|
? "profileEmployee.firstName LIKE :keyword"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${requestBody.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
|
? "profileEmployee.lastName LIKE :keyword"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${requestBody.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
requestBody.keyword != null && requestBody.keyword != ""
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
? "profileEmployee.citizenId LIKE :keyword"
|
? "profileEmployee.citizenId LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
|
|
@ -2642,19 +2659,22 @@ export class ProfileEmployeeController extends Controller {
|
||||||
qb.where("profileEmployee.id NOT IN (:...ids)", {
|
qb.where("profileEmployee.id NOT IN (:...ids)", {
|
||||||
ids:
|
ids:
|
||||||
orgRevision.employeePosMasters
|
orgRevision.employeePosMasters
|
||||||
.filter((x) => x.next_holderId != null)
|
.filter((x) => x.current_holderId != null)
|
||||||
.map((x) => x.next_holderId).length == 0
|
.map((x) => x.current_holderId).length == 0
|
||||||
? ["zxc"]
|
? ["zxc"]
|
||||||
: orgRevision.employeePosMasters
|
: orgRevision.employeePosMasters
|
||||||
.filter((x) => x.next_holderId != null)
|
.filter((x) => x.current_holderId != null)
|
||||||
.map((x) => x.next_holderId),
|
.map((x) => x.current_holderId),
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.andWhere("profileEmployee.employeeClass = :employeeClass", { employeeClass: "PERM" })
|
.andWhere("profileEmployee.employeeClass = :employeeClass", { employeeClass: "PERM" })
|
||||||
.skip((requestBody.page - 1) * requestBody.pageSize)
|
.skip((requestBody.page - 1) * requestBody.pageSize)
|
||||||
.take(requestBody.pageSize)
|
.take(requestBody.pageSize)
|
||||||
|
.orderBy("posType.posTypeRank", "ASC")
|
||||||
|
.addOrderBy("posLevel.posLevelRank", "ASC")
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
||||||
const data = profiles.map((_data) => ({
|
const data = profiles.map((_data) => ({
|
||||||
id: _data.id,
|
id: _data.id,
|
||||||
prefix: _data.prefix,
|
prefix: _data.prefix,
|
||||||
|
|
|
||||||
|
|
@ -1704,7 +1704,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
}
|
}
|
||||||
const [profiles, total] = await this.profileRepo
|
const [profiles, total] = await this.profileRepo
|
||||||
.createQueryBuilder("profileEmployee")
|
.createQueryBuilder("profileEmployee")
|
||||||
.leftJoinAndSelect("profileEmployee.next_holderTemps", "next_holderTemps")
|
.leftJoinAndSelect("profileEmployee.current_holderTemps", "current_holderTemps")
|
||||||
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
|
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("profileEmployee.posType", "posType")
|
.leftJoinAndSelect("profileEmployee.posType", "posType")
|
||||||
.where(
|
.where(
|
||||||
|
|
@ -1720,12 +1720,29 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where(
|
qb.where(
|
||||||
requestBody.keyword != null && requestBody.keyword != ""
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword`
|
? "profileEmployee.prefix LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
},
|
},
|
||||||
).orWhere(
|
)
|
||||||
|
.orWhere(
|
||||||
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
|
? "profileEmployee.firstName LIKE :keyword"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${requestBody.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
|
? "profileEmployee.lastName LIKE :keyword"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${requestBody.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
requestBody.keyword != null && requestBody.keyword != ""
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
? "profileEmployee.citizenId LIKE :keyword"
|
? "profileEmployee.citizenId LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
|
|
@ -1780,18 +1797,20 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
qb.where("profileEmployee.id NOT IN (:...ids)", {
|
qb.where("profileEmployee.id NOT IN (:...ids)", {
|
||||||
ids:
|
ids:
|
||||||
orgRevision.employeeTempPosMasters
|
orgRevision.employeeTempPosMasters
|
||||||
.filter((x) => x.next_holderId != null)
|
.filter((x) => x.current_holderId != null)
|
||||||
.map((x) => x.next_holderId).length == 0
|
.map((x) => x.current_holderId).length == 0
|
||||||
? ["zxc"]
|
? ["zxc"]
|
||||||
: orgRevision.employeeTempPosMasters
|
: orgRevision.employeeTempPosMasters
|
||||||
.filter((x) => x.next_holderId != null)
|
.filter((x) => x.current_holderId != null)
|
||||||
.map((x) => x.next_holderId),
|
.map((x) => x.current_holderId),
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.andWhere("profileEmployee.employeeClass = :employeeClass", { employeeClass: "TEMP" })
|
.andWhere("profileEmployee.employeeClass = :employeeClass", { employeeClass: "TEMP" })
|
||||||
.skip((requestBody.page - 1) * requestBody.pageSize)
|
.skip((requestBody.page - 1) * requestBody.pageSize)
|
||||||
.take(requestBody.pageSize)
|
.take(requestBody.pageSize)
|
||||||
|
.orderBy("posType.posTypeRank", "ASC")
|
||||||
|
.addOrderBy("posLevel.posLevelRank", "ASC")
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
const data = profiles.map((_data) => ({
|
const data = profiles.map((_data) => ({
|
||||||
id: _data.id,
|
id: _data.id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue