sort salaryhis
This commit is contained in:
parent
358290e24a
commit
416250cf4b
1 changed files with 31 additions and 0 deletions
|
|
@ -1462,6 +1462,37 @@ export class ProfileSalaryTempController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้้ไขลำดับรายคน
|
||||
*
|
||||
* @summary API แก้้ไขลำดับรายคน
|
||||
*
|
||||
*/
|
||||
@Get("change/sort/all")
|
||||
public async changeSortEditGenAll() {
|
||||
try {
|
||||
const profiles = await this.profileRepo.find();
|
||||
let num = 1;
|
||||
for await (const item of profiles) {
|
||||
let salaryOld = await this.salaryRepo.find({
|
||||
where: { profileId: item.id },
|
||||
order: { commandDateAffect: "ASC", order: "ASC" },
|
||||
});
|
||||
|
||||
salaryOld.forEach((item: any, i) => {
|
||||
item.order = i + 1;
|
||||
});
|
||||
num = num + 1;
|
||||
console.log(num);
|
||||
await this.salaryRepo.save(salaryOld);
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
} catch {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถดําเนินการได้");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้้ไขลำดับรายคน
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue