add isBlank
This commit is contained in:
parent
e805759af5
commit
85657d1c32
3 changed files with 39 additions and 18 deletions
|
|
@ -621,7 +621,8 @@ export class OrganizationController extends Controller {
|
|||
// let attrOwnership = null;
|
||||
if (
|
||||
orgRevision.orgRevisionIsDraft == true &&
|
||||
orgRevision.orgRevisionIsCurrent == false
|
||||
orgRevision.orgRevisionIsCurrent == false &&
|
||||
request.user.role.includes("SUPER_ADMIN")
|
||||
// attrOwnership == false
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ export class PermissionOrgController extends Controller {
|
|||
*/
|
||||
@Get()
|
||||
async GetActiveRootIdAdmin(@Request() request: RequestWithUser) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
const orgRevisionActive = await this.orgRevisionRepository.findOne({
|
||||
where: { orgRevisionIsCurrent: false, orgRevisionIsDraft: true },
|
||||
});
|
||||
|
|
@ -76,9 +76,9 @@ export class PermissionOrgController extends Controller {
|
|||
searchField?: "fullName" | "position" | "posNo" | "postype" | "poslevel",
|
||||
@Query() searchKeyword: string = "",
|
||||
) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
let queryLike =
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
|
||||
if (searchField == "postype") {
|
||||
|
|
@ -233,9 +233,9 @@ export class PermissionOrgController extends Controller {
|
|||
searchKeyword: string;
|
||||
},
|
||||
) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
let profiles: any = [];
|
||||
if (requestBody.id != null) {
|
||||
const _permissionOrg = await this.orgRootRepository.findOne({
|
||||
|
|
@ -423,9 +423,9 @@ export class PermissionOrgController extends Controller {
|
|||
@Request() request: RequestWithUser,
|
||||
@Body() requestBody: { nodeId: string; personId: string },
|
||||
) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
const orgRoot = await this.orgRootRepository.findOne({
|
||||
where: { id: requestBody.nodeId },
|
||||
});
|
||||
|
|
@ -472,9 +472,9 @@ export class PermissionOrgController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async Delete(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
// const orgRoot = await this.orgRootRepository.findOne({
|
||||
// where: { id: nodeId },
|
||||
// relations: ["permissionOrgRoots"],
|
||||
|
|
|
|||
|
|
@ -840,9 +840,13 @@ export class PositionController extends Controller {
|
|||
}
|
||||
let _null: any = null;
|
||||
posMaster.isDirector = requestBody.isDirector;
|
||||
posMaster.isStaff = requestBody.isStaff == null || requestBody.isStaff == undefined ? _null : requestBody.isStaff;
|
||||
posMaster.isStaff =
|
||||
requestBody.isStaff == null || requestBody.isStaff == undefined ? _null : requestBody.isStaff;
|
||||
// posMaster.isOfficer = requestBody.isOfficer;
|
||||
posMaster.positionSign = requestBody.positionSign == null || requestBody.positionSign == undefined ? _null : requestBody.positionSign;
|
||||
posMaster.positionSign =
|
||||
requestBody.positionSign == null || requestBody.positionSign == undefined
|
||||
? _null
|
||||
: requestBody.positionSign;
|
||||
posMaster.posMasterNo = requestBody.posMasterNo;
|
||||
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
||||
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
||||
|
|
@ -1101,6 +1105,7 @@ export class PositionController extends Controller {
|
|||
revisionId: string;
|
||||
type: number;
|
||||
isAll: boolean;
|
||||
isBlank: boolean;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
keyword?: string;
|
||||
|
|
@ -1127,6 +1132,9 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 1) {
|
||||
typeCondition = {
|
||||
orgChild1Id: body.id,
|
||||
|
|
@ -1138,6 +1146,9 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 2) {
|
||||
typeCondition = {
|
||||
orgChild2Id: body.id,
|
||||
|
|
@ -1149,6 +1160,9 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 3) {
|
||||
typeCondition = {
|
||||
orgChild3Id: body.id,
|
||||
|
|
@ -1160,11 +1174,17 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 4) {
|
||||
typeCondition = {
|
||||
orgChild4Id: body.id,
|
||||
};
|
||||
searchShortName = `CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
}
|
||||
let findPosition: any;
|
||||
let masterId = new Array();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue