checkpoint
This commit is contained in:
parent
82d357fe52
commit
d8abb147e6
2 changed files with 119 additions and 8 deletions
|
|
@ -173,7 +173,7 @@ export class DevelopmentRequestController extends Controller {
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("developmentRequest.createdAt", "ASC")
|
.orderBy("developmentRequest.createdAt", "DESC")
|
||||||
.skip((page - 1) * pageSize)
|
.skip((page - 1) * pageSize)
|
||||||
.take(pageSize)
|
.take(pageSize)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
|
||||||
|
|
@ -5978,14 +5978,32 @@ export class ProfileController extends Controller {
|
||||||
@Query("pageSize") pageSize: number = 10,
|
@Query("pageSize") pageSize: number = 10,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
fieldName: string;
|
fieldName?: string | null;
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
let findProfile: any;
|
let findProfile: any;
|
||||||
let total: any;
|
let total: any;
|
||||||
|
let revision = await this.orgRevisionRepo.findOne({where: { orgRevisionIsCurrent: true }});
|
||||||
const skip = (page - 1) * pageSize;
|
const skip = (page - 1) * pageSize;
|
||||||
const take = pageSize;
|
const take = pageSize;
|
||||||
|
let queryLike = `CONCAT(
|
||||||
|
IFNULL(orgChild4.orgChild4ShortName, ''),
|
||||||
|
IFNULL(current_holders.posMasterNo , '')
|
||||||
|
) LIKE :keyword OR CONCAT(
|
||||||
|
IFNULL(orgChild3.orgChild3ShortName, ''),
|
||||||
|
IFNULL(current_holders.posMasterNo , '')
|
||||||
|
) LIKE :keyword OR CONCAT(
|
||||||
|
IFNULL(orgChild2.orgChild2ShortName, ''),
|
||||||
|
IFNULL(current_holders.posMasterNo , '')
|
||||||
|
) LIKE :keyword OR CONCAT(
|
||||||
|
IFNULL(orgChild1.orgChild1ShortName, ''),
|
||||||
|
IFNULL(current_holders.posMasterNo , '')
|
||||||
|
) LIKE :keyword OR CONCAT(
|
||||||
|
IFNULL(orgRoot.orgRootShortName, ''),
|
||||||
|
IFNULL(current_holders.posMasterNo , '')
|
||||||
|
) LIKE :keyword`;
|
||||||
|
|
||||||
switch (body.fieldName) {
|
switch (body.fieldName) {
|
||||||
case "citizenId":
|
case "citizenId":
|
||||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
|
|
@ -6006,9 +6024,25 @@ export class ProfileController extends Controller {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "firstname":
|
case "fullName":
|
||||||
|
[findProfile, total] = await this.profileRepo.createQueryBuilder("profile")
|
||||||
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
|
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
|
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
|
.where("CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword", { keyword: `%${body.keyword}%` })
|
||||||
|
.skip(skip)
|
||||||
|
.take(take)
|
||||||
|
.getManyAndCount();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "position":
|
||||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
where: { firstName: Like(`%${body.keyword}%`) },
|
where: { position: Like(`%${body.keyword}%`) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
|
|
@ -6025,9 +6059,39 @@ export class ProfileController extends Controller {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "lastname":
|
case "posNo":
|
||||||
|
[findProfile, total] = await this.profileRepo.createQueryBuilder("profile")
|
||||||
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
|
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
|
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
|
.where("current_holders.orgRevision = :revisionId", { revisionId: revision?.id })
|
||||||
|
.andWhere(
|
||||||
|
new Brackets((qb) => {
|
||||||
|
qb.orWhere(body.keyword != undefined && body.keyword != null && body.keyword != ""
|
||||||
|
? queryLike
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${body.keyword}%`,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.skip(skip)
|
||||||
|
.take(take)
|
||||||
|
.getManyAndCount();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "posType":
|
||||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
where: { lastName: Like(`%${body.keyword}%`) },
|
where: {
|
||||||
|
posType: {
|
||||||
|
posTypeName:Like(`%${body.keyword}%`)
|
||||||
|
}
|
||||||
|
},
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
|
|
@ -6044,6 +6108,53 @@ export class ProfileController extends Controller {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "posLevel":
|
||||||
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
|
where: {
|
||||||
|
posLevel: {
|
||||||
|
posLevelName:Like(`%${body.keyword}%`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
relations: [
|
||||||
|
"posType",
|
||||||
|
"posLevel",
|
||||||
|
"current_holders",
|
||||||
|
"profileSalary",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "organization":
|
||||||
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
|
where: {
|
||||||
|
current_holders:{
|
||||||
|
orgRoot:{
|
||||||
|
orgRootName:Like(`%${body.keyword}%`)
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
relations: [
|
||||||
|
"posType",
|
||||||
|
"posLevel",
|
||||||
|
"current_holders",
|
||||||
|
"profileSalary",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
relations: [
|
relations: [
|
||||||
|
|
@ -6072,7 +6183,7 @@ export class ProfileController extends Controller {
|
||||||
|
|
||||||
const mapDataProfile = await Promise.all(
|
const mapDataProfile = await Promise.all(
|
||||||
findProfile.map(async (item: Profile) => {
|
findProfile.map(async (item: Profile) => {
|
||||||
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
const fullName = `${item.prefix}${item.firstName} ${item.lastName}`;
|
||||||
const shortName =
|
const shortName =
|
||||||
item.current_holders.length == 0
|
item.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
|
|
@ -6158,7 +6269,7 @@ export class ProfileController extends Controller {
|
||||||
positionType: item.posTypeId,
|
positionType: item.posTypeId,
|
||||||
positionTypeName: item.posType?.posTypeName,
|
positionTypeName: item.posType?.posTypeName,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
organization: root == null ? null : root.orgRootShortName,
|
organization: root == null ? null : root.orgRootName,
|
||||||
salary: salary == "" ? "" : salary.amount,
|
salary: salary == "" ? "" : salary.amount,
|
||||||
root: rootHolder?.orgRootName ?? null,
|
root: rootHolder?.orgRootName ?? null,
|
||||||
rootId: rootHolder?.id ?? null,
|
rootId: rootHolder?.id ?? null,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue