fixed PermissionDelete to PermissionUpdate ในส่วนของลบคนครองและสืบทอดตำแหน่ง
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m0s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m0s
This commit is contained in:
parent
7e4dc6434f
commit
bf0dbdf018
3 changed files with 130 additions and 117 deletions
|
|
@ -1190,8 +1190,8 @@ export class EmployeePositionController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `posMaster.orgChild1Id IN (:...child1)`
|
||||
// : `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `posMaster.orgChild1Id is null`
|
||||
: // : `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`posMaster.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -1226,23 +1226,24 @@ export class EmployeePositionController extends Controller {
|
|||
{
|
||||
child4: _data.child4,
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
if (body.keyword != null && body.keyword != "") {
|
||||
query.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? body.isAll == false
|
||||
? searchShortName
|
||||
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
query
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? body.isAll == false
|
||||
? searchShortName
|
||||
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
|
|
@ -1287,7 +1288,7 @@ export class EmployeePositionController extends Controller {
|
|||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
let [posMaster, total] = await query
|
||||
|
|
@ -1706,50 +1707,50 @@ export class EmployeePositionController extends Controller {
|
|||
const type0LastPosMasterNo =
|
||||
requestBody.type == 0
|
||||
? await this.employeePosMasterRepository.find({
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id: IsNull(),
|
||||
},
|
||||
})
|
||||
where: {
|
||||
orgRootId: requestBody.id,
|
||||
orgChild1Id: IsNull(),
|
||||
},
|
||||
})
|
||||
: [];
|
||||
|
||||
const type1LastPosMasterNo =
|
||||
requestBody.type == 1
|
||||
? await this.employeePosMasterRepository.find({
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
orgChild2Id: IsNull(),
|
||||
},
|
||||
})
|
||||
where: {
|
||||
orgChild1Id: requestBody.id,
|
||||
orgChild2Id: IsNull(),
|
||||
},
|
||||
})
|
||||
: [];
|
||||
|
||||
const type2LastPosMasterNo =
|
||||
requestBody.type == 2
|
||||
? await this.employeePosMasterRepository.find({
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
orgChild3Id: IsNull(),
|
||||
},
|
||||
})
|
||||
where: {
|
||||
orgChild2Id: requestBody.id,
|
||||
orgChild3Id: IsNull(),
|
||||
},
|
||||
})
|
||||
: [];
|
||||
|
||||
const type3LastPosMasterNo =
|
||||
requestBody.type == 3
|
||||
? await this.employeePosMasterRepository.find({
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
orgChild4Id: IsNull(),
|
||||
},
|
||||
})
|
||||
where: {
|
||||
orgChild3Id: requestBody.id,
|
||||
orgChild4Id: IsNull(),
|
||||
},
|
||||
})
|
||||
: [];
|
||||
|
||||
const type4LastPosMasterNo =
|
||||
requestBody.type == 4
|
||||
? await this.employeePosMasterRepository.find({
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
},
|
||||
})
|
||||
where: {
|
||||
orgChild4Id: requestBody.id,
|
||||
},
|
||||
})
|
||||
: [];
|
||||
|
||||
const allLastPosMasterNo = [
|
||||
|
|
@ -2413,7 +2414,7 @@ export class EmployeePositionController extends Controller {
|
|||
*/
|
||||
@Post("profile/delete/{id}")
|
||||
async deleteEmpHolder(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_ORG_EMP");
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG_EMP");
|
||||
const dataMaster = await this.employeePosMasterRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["positions", "orgRevision"],
|
||||
|
|
@ -2472,7 +2473,7 @@ export class EmployeePositionController extends Controller {
|
|||
@Body() requestBody: { draftPositionId: string; publishPositionId: string },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionDelete(request, "SYS_ORG_EMP");
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG_EMP");
|
||||
const findDraft = await this.orgRevisionRepository.findOne({
|
||||
where: {
|
||||
orgRevisionIsDraft: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue