ค้นหารายชื่อผู้ยื่นอุธรณ์/ร้องทุกข์
This commit is contained in:
parent
4479507ae8
commit
a963841306
2 changed files with 53 additions and 14 deletions
|
|
@ -10800,14 +10800,27 @@ export class ProfileController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Post("search-personal-no-keycloak")
|
@Post("search-personal-no-keycloak")
|
||||||
async getProfileBySearchKeywordNoKeyCloak(
|
async getProfileBySearchKeywordNoKeyCloak(
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
@Query("page") page: number = 1,
|
@Query("page") page: number = 1,
|
||||||
@Query("pageSize") pageSize: number = 10,
|
@Query("pageSize") pageSize: number = 10,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
|
system?: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
|
// ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
|
||||||
|
let _system: string = "SYS_REGISTRY_OFFICER";
|
||||||
|
if (body.system) _system = body.system;
|
||||||
|
let _data = await new permission().PermissionOrgList(request, _system);
|
||||||
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
if (!findRevision) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||||
|
}
|
||||||
|
|
||||||
let findProfile: any;
|
let findProfile: any;
|
||||||
let total: any;
|
let total: any;
|
||||||
const skip = (page - 1) * pageSize;
|
const skip = (page - 1) * pageSize;
|
||||||
|
|
@ -10825,6 +10838,22 @@ export class ProfileController extends Controller {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "fullName":
|
||||||
|
[findProfile, total] = await this.profileRepo
|
||||||
|
.createQueryBuilder("profile")
|
||||||
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
|
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
|
.where("profile.keycloak IS NULL")
|
||||||
|
.andWhere(
|
||||||
|
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword",
|
||||||
|
{ keyword: `%${body.keyword}%` }
|
||||||
|
)
|
||||||
|
.skip(skip)
|
||||||
|
.take(take)
|
||||||
|
.getManyAndCount();
|
||||||
|
break;
|
||||||
|
|
||||||
case "firstname":
|
case "firstname":
|
||||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -10861,13 +10890,6 @@ export class ProfileController extends Controller {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
|
||||||
where: { orgRevisionIsCurrent: true },
|
|
||||||
});
|
|
||||||
if (!findRevision) {
|
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDataProfile = await Promise.all(
|
const mapDataProfile = await Promise.all(
|
||||||
findProfile.map(async (item: Profile) => {
|
findProfile.map(async (item: Profile) => {
|
||||||
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
||||||
|
|
|
||||||
|
|
@ -5726,8 +5726,16 @@ export class ProfileEmployeeController extends Controller {
|
||||||
body: {
|
body: {
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
|
system?: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
if (!findRevision) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||||
|
}
|
||||||
|
|
||||||
let findProfile: any;
|
let findProfile: any;
|
||||||
let total: any;
|
let total: any;
|
||||||
const skip = (page - 1) * pageSize;
|
const skip = (page - 1) * pageSize;
|
||||||
|
|
@ -5746,6 +5754,22 @@ export class ProfileEmployeeController extends Controller {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "fullName":
|
||||||
|
[findProfile, total] = await this.profileRepo
|
||||||
|
.createQueryBuilder("profile")
|
||||||
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
|
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
|
.where("profile.keycloak IS NULL")
|
||||||
|
.andWhere(
|
||||||
|
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword",
|
||||||
|
{ keyword: `%${body.keyword}%` }
|
||||||
|
)
|
||||||
|
.skip(skip)
|
||||||
|
.take(take)
|
||||||
|
.getManyAndCount();
|
||||||
|
break;
|
||||||
|
|
||||||
case "firstname":
|
case "firstname":
|
||||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -5785,13 +5809,6 @@ export class ProfileEmployeeController extends Controller {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
|
||||||
where: { orgRevisionIsCurrent: true },
|
|
||||||
});
|
|
||||||
if (!findRevision) {
|
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDataProfile = await Promise.all(
|
const mapDataProfile = await Promise.all(
|
||||||
findProfile.map(async (item: ProfileEmployee) => {
|
findProfile.map(async (item: ProfileEmployee) => {
|
||||||
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue