รักษาการ
This commit is contained in:
parent
d6f5b87eee
commit
1f7fa3160e
1 changed files with 167 additions and 75 deletions
|
|
@ -722,23 +722,35 @@ export class ProfileController extends Controller {
|
|||
: "",
|
||||
telephone:
|
||||
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
||||
url: ImgUrl
|
||||
? ImgUrl
|
||||
: `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
||||
yearUpload1: profiles.profileAvatars[0] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt)) : null,
|
||||
yearUpload1: profiles.profileAvatars[0]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt))
|
||||
: null,
|
||||
url2: _ImgUrl[1] ? _ImgUrl[1] : null,
|
||||
yearUpload2: profiles.profileAvatars[1] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt)) : null,
|
||||
yearUpload2: profiles.profileAvatars[1]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt))
|
||||
: null,
|
||||
url3: _ImgUrl[2] ? _ImgUrl[2] : null,
|
||||
yearUpload3: profiles.profileAvatars[2] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt)) : null,
|
||||
yearUpload3: profiles.profileAvatars[2]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt))
|
||||
: null,
|
||||
url4: _ImgUrl[3] ? _ImgUrl[3] : null,
|
||||
yearUpload4: profiles.profileAvatars[3] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt)) : null,
|
||||
yearUpload4: profiles.profileAvatars[3]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt))
|
||||
: null,
|
||||
url5: _ImgUrl[4] ? _ImgUrl[4] : null,
|
||||
yearUpload5: profiles.profileAvatars[4] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt)) : null,
|
||||
yearUpload5: profiles.profileAvatars[4]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt))
|
||||
: null,
|
||||
url6: _ImgUrl[5] ? _ImgUrl[5] : null,
|
||||
yearUpload6: profiles.profileAvatars[5] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt)) : null,
|
||||
yearUpload6: profiles.profileAvatars[5]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt))
|
||||
: null,
|
||||
url7: _ImgUrl[6] ? _ImgUrl[6] : null,
|
||||
yearUpload7: profiles.profileAvatars[6] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt)) : null,
|
||||
yearUpload7: profiles.profileAvatars[6]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt))
|
||||
: null,
|
||||
insignias,
|
||||
leaves,
|
||||
certs,
|
||||
|
|
@ -1339,76 +1351,156 @@ export class ProfileController extends Controller {
|
|||
@Post("commander-director")
|
||||
async getProfileCommanderDirector(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body() body: { isDirector: boolean; keyword: string; page: number; pageSize: number },
|
||||
@Body()
|
||||
body: { isAct: boolean; isDirector: boolean; keyword: string; page: number; pageSize: number },
|
||||
) {
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
current_holder: { keycloak: request.user.sub },
|
||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||
},
|
||||
});
|
||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
||||
if (body.isAct == true) {
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
current_holder: { keycloak: request.user.sub },
|
||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||
},
|
||||
});
|
||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
||||
|
||||
let condition: any = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
};
|
||||
if (body.isDirector == true) {
|
||||
condition = {
|
||||
let condition: any = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
isDirector: true,
|
||||
};
|
||||
if (body.isDirector == true) {
|
||||
condition = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
isDirector: true,
|
||||
};
|
||||
}
|
||||
const [lists, total] = await AppDataSource.getRepository(viewDirectorActing)
|
||||
.createQueryBuilder("viewDirectorActing")
|
||||
.andWhere(condition)
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "CONCAT(viewDirectorActing.prefix,viewDirectorActing.firstName,' ',viewDirectorActing.lastName) LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirectorActing.citizenId LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirectorActing.position LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirectorActing.posLevel LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirectorActing.posType LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirectorActing.actFullName LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
);
|
||||
}),
|
||||
)
|
||||
.skip((body.page - 1) * body.pageSize)
|
||||
.take(body.pageSize)
|
||||
.getManyAndCount();
|
||||
return new HttpSuccess({ data: lists, total });
|
||||
} else {
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
current_holder: { keycloak: request.user.sub },
|
||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||
},
|
||||
});
|
||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
||||
|
||||
let condition: any = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
};
|
||||
if (body.isDirector == true) {
|
||||
condition = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
isDirector: true,
|
||||
};
|
||||
}
|
||||
const [lists, total] = await AppDataSource.getRepository(viewDirector)
|
||||
.createQueryBuilder("viewDirector")
|
||||
.andWhere(condition)
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "CONCAT(viewDirector.prefix,viewDirector.firstName,' ',viewDirector.lastName) LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.citizenId LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.position LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.posLevel LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.posType LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
);
|
||||
}),
|
||||
)
|
||||
.skip((body.page - 1) * body.pageSize)
|
||||
.take(body.pageSize)
|
||||
.getManyAndCount();
|
||||
return new HttpSuccess({ data: lists, total });
|
||||
}
|
||||
const [lists, total] = await AppDataSource.getRepository(viewDirector)
|
||||
.createQueryBuilder("viewDirector")
|
||||
.andWhere(condition)
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "CONCAT(viewDirector.prefix,viewDirector.firstName,' ',viewDirector.lastName) LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.citizenId LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.position LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.posLevel LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? "viewDirector.posType LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
);
|
||||
}),
|
||||
)
|
||||
.skip((body.page - 1) * body.pageSize)
|
||||
.take(body.pageSize)
|
||||
.getManyAndCount();
|
||||
return new HttpSuccess({ data: lists, total });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue