update current
This commit is contained in:
parent
b0f5ff78d8
commit
8b7de2a0ba
6 changed files with 86 additions and 54 deletions
|
|
@ -372,18 +372,22 @@ export class EmployeePositionController extends Controller {
|
|||
// });
|
||||
// }
|
||||
findData = await this.employeePosDictRepository
|
||||
.createQueryBuilder("posDict")
|
||||
.leftJoinAndSelect("posDict.posType", "posType")
|
||||
.leftJoinAndSelect("posDict.posLevel", "posLevel")
|
||||
.where( keyword
|
||||
? "CONCAT(posType.posTypeShortName, ' ', posLevel.posLevelName) LIKE :keyword":"1=1", {keyword: `%${keyword}%`})
|
||||
.orderBy("posDict.posDictName", "ASC")
|
||||
.addOrderBy("posDict.createdAt", "DESC")
|
||||
.addOrderBy("posType.posTypeRank", "ASC")
|
||||
.addOrderBy("posType.createdAt", "DESC")
|
||||
.addOrderBy("posLevel.posLevelName", "ASC")
|
||||
.addOrderBy("posLevel.createdAt", "DESC")
|
||||
.getMany();
|
||||
.createQueryBuilder("posDict")
|
||||
.leftJoinAndSelect("posDict.posType", "posType")
|
||||
.leftJoinAndSelect("posDict.posLevel", "posLevel")
|
||||
.where(
|
||||
keyword
|
||||
? "CONCAT(posType.posTypeShortName, ' ', posLevel.posLevelName) LIKE :keyword"
|
||||
: "1=1",
|
||||
{ keyword: `%${keyword}%` },
|
||||
)
|
||||
.orderBy("posDict.posDictName", "ASC")
|
||||
.addOrderBy("posDict.createdAt", "DESC")
|
||||
.addOrderBy("posType.posTypeRank", "ASC")
|
||||
.addOrderBy("posType.createdAt", "DESC")
|
||||
.addOrderBy("posLevel.posLevelName", "ASC")
|
||||
.addOrderBy("posLevel.createdAt", "DESC")
|
||||
.getMany();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -2258,6 +2262,7 @@ export class EmployeePositionController extends Controller {
|
|||
|
||||
dataMaster.isSit = requestBody.isSit;
|
||||
dataMaster.current_holderId = requestBody.profileId;
|
||||
dataMaster.lastUpdatedAt = new Date();
|
||||
// dataMaster.next_holderId = requestBody.profileId;
|
||||
await this.employeePosMasterRepository.save(dataMaster);
|
||||
|
||||
|
|
@ -2394,7 +2399,10 @@ export class EmployeePositionController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
// if (posMasterOld != null) posMasterOld.next_holderId = null;
|
||||
|
||||
const positionOld = await this.employeePositionRepository.findOne({
|
||||
|
|
@ -2429,6 +2437,7 @@ export class EmployeePositionController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
|
||||
posMaster.current_holderId = body.profileId;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
// posMaster.next_holderId = body.profileId;
|
||||
if (posMasterOld != null) await this.employeePosMasterRepository.save(posMasterOld);
|
||||
await this.employeePosMasterRepository.save(posMaster);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue