sort ข้อมูลหลัก
This commit is contained in:
parent
94f92b5c9a
commit
2df1e19dc3
13 changed files with 171 additions and 57 deletions
|
|
@ -147,12 +147,8 @@ export class BloodGroupController extends Controller {
|
|||
async listBloodGroup() {
|
||||
const bloodGroup = await this.bloodGroupRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
|
||||
// if (!bloodGroup) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(bloodGroup);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,12 +162,11 @@ export class EducationLevelController extends Controller {
|
|||
"createdFullName",
|
||||
"lastUpdateFullName",
|
||||
],
|
||||
order: { rank: "ASC" },
|
||||
order: {
|
||||
rank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
});
|
||||
|
||||
// if (!educationLevel) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(educationLevel);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,8 +197,10 @@ export class EmployeePosTypeController extends Controller {
|
|||
select: ["id", "posTypeName", "posTypeRank", "posTypeShortName", "createdAt", "lastUpdatedAt", "lastUpdateFullName"],
|
||||
where: { id: id },
|
||||
order: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
posLevels: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
}
|
||||
}
|
||||
|
|
@ -246,6 +248,7 @@ export class EmployeePosTypeController extends Controller {
|
|||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
posLevels: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -288,12 +288,17 @@ export class EmployeePositionController extends Controller {
|
|||
findData = await this.employeePosDictRepository.find({
|
||||
where: { posDictName: Like(`%${keyword}%`) },
|
||||
relations: ["posType", "posLevel"],
|
||||
order: {
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelName: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
createdAt: "DESC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -306,12 +311,17 @@ export class EmployeePositionController extends Controller {
|
|||
findData = await this.employeePosDictRepository.find({
|
||||
where: { posTypeId: In(findEmpTypes.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel"],
|
||||
order: {
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelName: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
createdAt: "DESC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -324,24 +334,34 @@ export class EmployeePositionController extends Controller {
|
|||
findData = await this.employeePosDictRepository.find({
|
||||
where: { posLevelId: In(findEmpLevels.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel"],
|
||||
order: {
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelName: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
createdAt: "DESC"
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
//กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย
|
||||
findData = await this.employeePosDictRepository.find({
|
||||
relations: ["posType", "posLevel"],
|
||||
order: {
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelName: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
createdAt: "DESC"
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -350,12 +370,17 @@ export class EmployeePositionController extends Controller {
|
|||
default:
|
||||
findData = await this.employeePosDictRepository.find({
|
||||
relations: ["posType", "posLevel"],
|
||||
order: {
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelName: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
createdAt: "DESC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -41,11 +41,8 @@ export class GenderController extends Controller {
|
|||
async GetResult() {
|
||||
const _gender = await this.genderRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
// if (!_gender) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(_gender);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,9 +210,6 @@ export class PosExecutiveController extends Controller {
|
|||
createdAt: "DESC"
|
||||
},
|
||||
});
|
||||
// if (!posExecutive) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(posExecutive);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,8 +185,10 @@ export class PosTypeController extends Controller {
|
|||
relations: ["posLevels"],
|
||||
where: { id: id },
|
||||
order: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
posLevels: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
}
|
||||
}
|
||||
|
|
@ -248,13 +250,12 @@ export class PosTypeController extends Controller {
|
|||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
posLevels: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
}
|
||||
},
|
||||
});
|
||||
// if (!posType) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
|
||||
const mapPosType = posType.map((item) => ({
|
||||
id: item.id,
|
||||
posTypeName: item.posTypeName,
|
||||
|
|
|
|||
|
|
@ -570,6 +570,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -581,6 +592,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictField: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -588,7 +610,11 @@ export class PositionController extends Controller {
|
|||
case "positionType":
|
||||
const findTypes: PosType[] = await this.posTypeRepository.find({
|
||||
where: { posTypeName: Like(`%${keyword}%`) },
|
||||
order: { posTypeName: "ASC" },
|
||||
order: {
|
||||
// posTypeName: "ASC"
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
|
|
@ -597,6 +623,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -604,7 +641,11 @@ export class PositionController extends Controller {
|
|||
case "positionLevel":
|
||||
const findLevel: PosLevel[] = await this.posLevelRepository.find({
|
||||
where: { posLevelName: Like(`%${keyword}%`) },
|
||||
order: { posLevelName: "ASC" },
|
||||
order: {
|
||||
// posLevelName: "ASC"
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
|
|
@ -613,6 +654,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -620,7 +672,10 @@ export class PositionController extends Controller {
|
|||
case "positionExecutive":
|
||||
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
|
||||
where: { posExecutiveName: Like(`%${keyword}%`) },
|
||||
order: { posExecutiveName: "ASC" },
|
||||
order: {
|
||||
// posExecutiveName: "ASC"
|
||||
posExecutivePriority: "ASC"
|
||||
},
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
|
|
@ -629,6 +684,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -640,6 +706,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -651,6 +728,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -688,6 +776,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
@ -698,6 +797,17 @@ export class PositionController extends Controller {
|
|||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -41,11 +41,8 @@ export class PrefixController extends Controller {
|
|||
async Get() {
|
||||
const _prefix = await this.prefixRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
// if (!_prefix) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(_prefix);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export class ProvinceController extends Controller {
|
|||
async GetResult() {
|
||||
const _province = await this.provinceRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
return new HttpSuccess(_province);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,12 +147,8 @@ export class RankController extends Controller {
|
|||
async listRank() {
|
||||
const rank = await this.rankRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
|
||||
// if (!rank) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(rank);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,11 +147,8 @@ export class RelationshipController extends Controller {
|
|||
async listRelationship() {
|
||||
const relationship = await this.relationshipRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
// if (!relationship) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(relationship);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,12 +146,8 @@ export class ReligionController extends Controller {
|
|||
async listReligion() {
|
||||
const religion = await this.religionRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
|
||||
// if (!religion) {
|
||||
// return new HttpSuccess([]);
|
||||
// }
|
||||
return new HttpSuccess(religion);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue