Merge branch 'develop' into adiDev
This commit is contained in:
commit
f873f458f6
6 changed files with 157 additions and 7 deletions
|
|
@ -111,6 +111,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileRepository.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
|
||||
|
|
@ -174,6 +175,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileRepository.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before: before_profile, after: profile });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
|
||||
|
|
@ -181,6 +182,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile, { data: req });
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
|
||||
|
|
@ -173,6 +174,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
|||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
profile.prefixMain = profile.rank ?? profile.prefix;
|
||||
await this.profileEmployeeRepo.save(profile);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2087,12 +2087,35 @@ export class ProfileEmployeeController extends Controller {
|
|||
) {
|
||||
let findProfile: any;
|
||||
let total: any;
|
||||
let revision = await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true } });
|
||||
const skip = (page - 1) * 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) {
|
||||
case "citizenId":
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: { citizenId: Like(`%${body.keyword}%`) },
|
||||
where: {
|
||||
citizenId: Like(`%${body.keyword}%`),
|
||||
current_holders: {
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
|
|
@ -2109,9 +2132,35 @@ export class ProfileEmployeeController extends Controller {
|
|||
});
|
||||
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("current_holders.orgRevision = :revisionId", { revisionId: revision?.id })
|
||||
.andWhere(
|
||||
"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({
|
||||
where: { firstName: Like(`%${body.keyword}%`) },
|
||||
where: {
|
||||
position: Like(`%${body.keyword}%`),
|
||||
current_holders: {
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
|
|
@ -2128,9 +2177,97 @@ export class ProfileEmployeeController extends Controller {
|
|||
});
|
||||
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({
|
||||
where: { lastName: Like(`%${body.keyword}%`) },
|
||||
where: {
|
||||
posType: {
|
||||
posTypeName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
current_holders: {
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
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 "posLevel":
|
||||
// [findProfile, total] = await this.profileRepo.findAndCount({
|
||||
// where: {
|
||||
// posLevel: {
|
||||
// posLevelName: Like(`%${body.keyword}%`),
|
||||
// },
|
||||
// current_holders: {
|
||||
// orgRevisionId: revision?.id,
|
||||
// },
|
||||
// },
|
||||
// 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: {
|
||||
orgRevisionId: revision?.id,
|
||||
orgRoot: {
|
||||
orgRootName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
|
|
@ -2149,6 +2286,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
default:
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
current_holders: {
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
|
|
@ -2175,7 +2317,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
const mapDataProfile = await Promise.all(
|
||||
findProfile.map(async (item: ProfileEmployee) => {
|
||||
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
||||
const fullName = `${item.prefix}${item.firstName} ${item.lastName}`;
|
||||
const shortName =
|
||||
item.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2261,7 +2403,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
positionType: item.posTypeId,
|
||||
positionTypeName: item.posType?.posTypeName,
|
||||
posNo: shortName,
|
||||
organization: root == null ? null : root.orgRootShortName,
|
||||
organization: root == null ? null : root.orgRootName,
|
||||
salary: salary == "" ? "" : salary.amount,
|
||||
root: rootHolder?.orgRootName ?? null,
|
||||
rootId: rootHolder?.id ?? null,
|
||||
|
|
|
|||
|
|
@ -812,6 +812,7 @@ export type UpdateProfile = {
|
|||
gender?: string | null;
|
||||
relationship?: string | null;
|
||||
bloodGroup?: string | null;
|
||||
prefixMain?: string | null;
|
||||
};
|
||||
export type UpdateProfileReqEdit = {
|
||||
rank?: string | null;
|
||||
|
|
|
|||
|
|
@ -901,6 +901,7 @@ export type UpdateProfileEmployee = {
|
|||
phone?: string | null;
|
||||
salaryLevel?: number | null;
|
||||
employeeClass?: string | null;
|
||||
prefixMain?: string | null;
|
||||
};
|
||||
|
||||
export type UpdateProfileAddressEmployee = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue