Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop
This commit is contained in:
commit
6f08bd801d
3 changed files with 143 additions and 24 deletions
|
|
@ -194,6 +194,9 @@ export class ReportController extends Controller {
|
||||||
@Query() tenureType?: string,
|
@Query() tenureType?: string,
|
||||||
@Query() tenureMin?: number,
|
@Query() tenureMin?: number,
|
||||||
@Query() tenureMax?: number,
|
@Query() tenureMax?: number,
|
||||||
|
@Query() positionArea?: string,
|
||||||
|
@Query() educationLevels?: string,
|
||||||
|
@Query() fields?: string,
|
||||||
@Query() sortBy: string = "posMasterNo",
|
@Query() sortBy: string = "posMasterNo",
|
||||||
@Query() sort: "ASC" | "DESC" = "ASC",
|
@Query() sort: "ASC" | "DESC" = "ASC",
|
||||||
) {
|
) {
|
||||||
|
|
@ -293,19 +296,19 @@ export class ReportController extends Controller {
|
||||||
.andWhere(
|
.andWhere(
|
||||||
posType != null && posType != "" ? "registryOfficer.posTypeName = :posTypeName" : "1=1",
|
posType != null && posType != "" ? "registryOfficer.posTypeName = :posTypeName" : "1=1",
|
||||||
{
|
{
|
||||||
posTypeName: `%${posType}%`,
|
posTypeName: `${posType}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
posLevel != null && posLevel != "" ? "registryOfficer.posLevelName = :posLevelName" : "1=1",
|
posLevel != null && posLevel != "" ? "registryOfficer.posLevelName = :posLevelName" : "1=1",
|
||||||
{
|
{
|
||||||
posLevelName: `%${posLevel}%`,
|
posLevelName: `${posLevel}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
position != null && position != "" ? "registryOfficer.position = :position" : "1=1",
|
position != null && position != "" ? "registryOfficer.position = :position" : "1=1",
|
||||||
{
|
{
|
||||||
position: `%${position}%`,
|
position: `${position}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
|
|
@ -313,22 +316,48 @@ export class ReportController extends Controller {
|
||||||
? "registryOfficer.posExecutiveName = :posExecutiveName"
|
? "registryOfficer.posExecutiveName = :posExecutiveName"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
posExecutiveName: `%${positionExecutive}%`,
|
posExecutiveName: `${positionExecutive}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(gender != null && gender != "" ? "registryOfficer.gender = :gender" : "1=1", {
|
.andWhere(gender != null && gender != "" ? "registryOfficer.gender = :gender" : "1=1", {
|
||||||
gender: `%${gender}%`,
|
gender: `${gender}`,
|
||||||
})
|
})
|
||||||
.andWhere(
|
.andWhere(
|
||||||
status != null && status != "" ? "registryOfficer.relationship = :relationship" : "1=1",
|
status != null && status != "" ? "registryOfficer.relationship = :relationship" : "1=1",
|
||||||
{
|
{
|
||||||
relationship: `%${status}%`,
|
relationship: `${status}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
education != null && education != "" ? "registryOfficer.degree LIKE :degree" : "1=1",
|
positionArea != null && positionArea != ""
|
||||||
|
? "registryOfficer.positionArea LIKE :positionArea"
|
||||||
|
: "1=1",
|
||||||
{
|
{
|
||||||
degree: `%${education}%`,
|
positionArea: `%${positionArea}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.andWhere(
|
||||||
|
education != null && education != ""
|
||||||
|
? "registryOfficer.degrees LIKE :degrees"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
degrees: `%${education}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.andWhere(
|
||||||
|
educationLevels != null && educationLevels != ""
|
||||||
|
? "registryOfficer.educationLevels LIKE :educationLevels"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
educationLevels: `%${educationLevels}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.andWhere(
|
||||||
|
fields != null && fields != ""
|
||||||
|
? "registryOfficer.fields LIKE :fields"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
fields: `%${fields}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orderBy(`registryOfficer.${sortBy}`, sort)
|
.orderBy(`registryOfficer.${sortBy}`, sort)
|
||||||
|
|
@ -369,7 +398,7 @@ export class ReportController extends Controller {
|
||||||
dateRetire: x.dateRetire,
|
dateRetire: x.dateRetire,
|
||||||
dateRetireLaw: x.dateRetireLaw,
|
dateRetireLaw: x.dateRetireLaw,
|
||||||
birthdate: x.birthdate,
|
birthdate: x.birthdate,
|
||||||
degree: x.degree,
|
degree: x.degrees,
|
||||||
age: x.age,
|
age: x.age,
|
||||||
currentPosition: null,
|
currentPosition: null,
|
||||||
lengthPosition: null,
|
lengthPosition: null,
|
||||||
|
|
@ -386,6 +415,84 @@ export class ReportController extends Controller {
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
// const mapData = [];
|
||||||
|
// for await (const x of lists) {
|
||||||
|
// let _educations:any = []
|
||||||
|
// if(education == "" && educationLevels == "" && fields == "") {
|
||||||
|
// _educations = (x.Educations as any[]).filter(
|
||||||
|
// (i: any) => i.isEducation === true
|
||||||
|
// );
|
||||||
|
// if(_educations.length == 0) {
|
||||||
|
// _educations = (x.Educations as any[]).filter(
|
||||||
|
// (i: any) => i.isHigh === true
|
||||||
|
// );
|
||||||
|
// if(_educations.length == 0) {
|
||||||
|
// _educations = (x.Educations as any[])[0] || []
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// _educations = (x.Educations as any[]).filter(
|
||||||
|
// (i: any) =>
|
||||||
|
// i.degrees === education ||
|
||||||
|
// i.educationLevel === educationLevels ||
|
||||||
|
// i.field === fields
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// mapData.push({
|
||||||
|
// profileId: x.profileId,
|
||||||
|
// citizenId: x.citizenId,
|
||||||
|
// prefix: x.prefix,
|
||||||
|
// firstName: x.firstName,
|
||||||
|
// lastName: x.lastName,
|
||||||
|
// isProbation: x.isProbation,
|
||||||
|
// isLeave: x.isLeave,
|
||||||
|
// isRetirement: x.isRetirement,
|
||||||
|
// leaveType: x.leaveType,
|
||||||
|
// posMasterNo: x.posMasterNo,
|
||||||
|
// orgRootId: x.orgRootId,
|
||||||
|
// orgChild1Id: x.orgChild1Id,
|
||||||
|
// orgChild2Id: x.orgChild2Id,
|
||||||
|
// orgChild3Id: x.orgChild3Id,
|
||||||
|
// orgChild4Id: x.orgChild4Id,
|
||||||
|
// orgRootName: x.orgRootName,
|
||||||
|
// orgChild1Name: x.orgChild1Name,
|
||||||
|
// orgChild2Name: x.orgChild2Name,
|
||||||
|
// orgChild3Name: x.orgChild3Name,
|
||||||
|
// orgChild4Name: x.orgChild4Name,
|
||||||
|
// org: x.org,
|
||||||
|
// searchShortName: x.searchShortName,
|
||||||
|
// posExecutiveName: x.posExecutiveName,
|
||||||
|
// position: x.position,
|
||||||
|
// positionArea: x.positionArea,
|
||||||
|
// posTypeName: x.posTypeName,
|
||||||
|
// posLevelName: x.posLevelName,
|
||||||
|
// gender: x.gender,
|
||||||
|
// relationship: x.relationship,
|
||||||
|
// dateAppoint: x.dateAppoint,
|
||||||
|
// dateRetire: x.dateRetire,
|
||||||
|
// dateRetireLaw: x.dateRetireLaw,
|
||||||
|
// birthdate: x.birthdate,
|
||||||
|
// education: _educations,
|
||||||
|
// degree: x.degrees,
|
||||||
|
// educationLevels: x.educationLevels,
|
||||||
|
// fields: x.fields,
|
||||||
|
// age: x.age,
|
||||||
|
// currentPosition: null,
|
||||||
|
// lengthPosition: null,
|
||||||
|
// positionDate: {
|
||||||
|
// Years: x.Years ? x.Years : 0,
|
||||||
|
// Months: x.Months ? x.Months : 0,
|
||||||
|
// Days: x.Days ? x.Days : 0,
|
||||||
|
// },
|
||||||
|
// levelDate: {
|
||||||
|
// posExecutiveYears: x.levelYears ? x.levelYears : 0,
|
||||||
|
// posExecutiveMonths: x.levelMonths ? x.levelMonths : 0,
|
||||||
|
// posExecutiveDays: x.levelDays ? x.levelDays : 0,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
data: mapData,
|
data: mapData,
|
||||||
total: total,
|
total: total,
|
||||||
|
|
@ -530,6 +637,8 @@ export class ReportController extends Controller {
|
||||||
@Query() tenureType?: string,
|
@Query() tenureType?: string,
|
||||||
@Query() tenureMin?: number,
|
@Query() tenureMin?: number,
|
||||||
@Query() tenureMax?: number,
|
@Query() tenureMax?: number,
|
||||||
|
@Query() educationLevels?: string,
|
||||||
|
@Query() fields?: string,
|
||||||
@Query() sortBy: string = "posMasterNo",
|
@Query() sortBy: string = "posMasterNo",
|
||||||
@Query() sort: "ASC" | "DESC" = "ASC",
|
@Query() sort: "ASC" | "DESC" = "ASC",
|
||||||
) {
|
) {
|
||||||
|
|
@ -630,7 +739,7 @@ export class ReportController extends Controller {
|
||||||
.andWhere(
|
.andWhere(
|
||||||
posType != null && posType != "" ? "registryEmployee.posTypeName LIKE :posTypeName" : "1=1",
|
posType != null && posType != "" ? "registryEmployee.posTypeName LIKE :posTypeName" : "1=1",
|
||||||
{
|
{
|
||||||
posTypeName: `%${posType}%`,
|
posTypeName: `${posType}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
|
|
@ -638,28 +747,38 @@ export class ReportController extends Controller {
|
||||||
? "registryEmployee.posLevelName LIKE :posLevelName"
|
? "registryEmployee.posLevelName LIKE :posLevelName"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
posLevelName: `%${posLevel}%`,
|
posLevelName: `${posLevel}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
position != null && position != "" ? "registryEmployee.position LIKE :position" : "1=1",
|
position != null && position != ""
|
||||||
|
? "registryEmployee.position LIKE :position"
|
||||||
|
: "1=1",
|
||||||
{
|
{
|
||||||
position: `%${position}%`,
|
position: `${position}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(gender != null && gender != "" ? "registryEmployee.gender LIKE :gender" : "1=1", {
|
.andWhere(gender != null && gender != ""
|
||||||
gender: `%${gender}%`,
|
? "registryEmployee.gender LIKE :gender"
|
||||||
})
|
: "1=1",
|
||||||
.andWhere(
|
|
||||||
status != null && status != "" ? "registryEmployee.relationship LIKE :relationship" : "1=1",
|
|
||||||
{
|
{
|
||||||
relationship: `%${status}%`,
|
gender: `${gender}`,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.andWhere(
|
||||||
|
status != null && status != ""
|
||||||
|
? "registryEmployee.relationship LIKE :relationship"
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
relationship: `${status}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
education != null && education != "" ? "registryEmployee.degree LIKE :degree" : "1=1",
|
education != null && education != ""
|
||||||
|
? "registryEmployee.degrees LIKE :degrees"
|
||||||
|
: "1=1",
|
||||||
{
|
{
|
||||||
degree: `%${education}%`,
|
degrees: `%${education}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orderBy(`registryEmployee.${sortBy}`, sort)
|
.orderBy(`registryEmployee.${sortBy}`, sort)
|
||||||
|
|
@ -699,7 +818,7 @@ export class ReportController extends Controller {
|
||||||
dateRetire: x.dateRetire,
|
dateRetire: x.dateRetire,
|
||||||
dateRetireLaw: x.dateRetireLaw,
|
dateRetireLaw: x.dateRetireLaw,
|
||||||
birthdate: x.birthdate,
|
birthdate: x.birthdate,
|
||||||
degree: x.degree,
|
degree: x.degrees,
|
||||||
age: x.age,
|
age: x.age,
|
||||||
currentPosition: null,
|
currentPosition: null,
|
||||||
lengthPosition: null,
|
lengthPosition: null,
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ export class viewRegistryEmployee {
|
||||||
birthdate: Date;
|
birthdate: Date;
|
||||||
|
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
degree: string;
|
degrees: string;
|
||||||
|
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
age: number;
|
age: number;
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ export class viewRegistryOfficer {
|
||||||
birthdate: Date;
|
birthdate: Date;
|
||||||
|
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
degree: string;
|
degrees: string;
|
||||||
|
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
age: number;
|
age: number;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue