sort salaryhis

This commit is contained in:
mamoss 2025-05-21 15:13:13 +07:00
parent 358290e24a
commit 416250cf4b

View file

@ -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
*