This commit is contained in:
AdisakKanthawilang 2024-01-30 16:39:22 +07:00
parent f5c5d21a3e
commit e601dfccab
3 changed files with 34 additions and 2 deletions

View file

@ -97,7 +97,7 @@ export class OrgRootController extends Controller {
}
const chkCode = await this.orgRootRepository.findOne({
where: { orgRootCode: requestBody.orgRootCode },
where: { orgRevisionId: requestBody.orgRevisionId , orgRootCode: requestBody.orgRootCode },
});
if (chkCode != null) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสหน่วยงานนี้มีอยู่ในระบบแล้ว");
@ -176,7 +176,7 @@ export class OrgRootController extends Controller {
}
const chkCode = await this.orgRootRepository.findOne({
where: { orgRootCode: requestBody.orgRootCode },
where: { orgRevisionId: requestBody.orgRevisionId , orgRootCode: requestBody.orgRootCode },
});
if (chkCode?.id != id && chkCode != null) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสหน่วยงานนี้มีอยู่ในระบบแล้ว");

View file

@ -309,6 +309,7 @@ export class OrganizationController extends Controller {
"orgRoot.orgRevisionId",
"orgRoot.orgRootRank",
])
.orderBy("orgRoot.createdAt","ASC")
.getMany();
const orgRootIds = orgRootData.map((orgRoot) => orgRoot.id) || null;
@ -329,6 +330,7 @@ export class OrganizationController extends Controller {
"orgChild1.orgRootId",
"orgChild1.orgChild1Rank",
])
.orderBy("orgChild1.createdAt","ASC")
.getMany()
: [];
@ -352,6 +354,7 @@ export class OrganizationController extends Controller {
"orgChild2.orgChild1Id",
])
.orderBy("orgChild2.createdAt","ASC")
.getMany()
: [];
@ -375,6 +378,7 @@ export class OrganizationController extends Controller {
"orgChild3.orgChild2Id",
])
.orderBy("orgChild3.createdAt","ASC")
.getMany()
: [];
@ -398,6 +402,7 @@ export class OrganizationController extends Controller {
"orgChild4.orgChild3Id",
])
.orderBy("orgChild4.createdAt","ASC")
.getMany()
: [];

View file

@ -57,4 +57,31 @@ export class PosDict extends EntityBase {
default: "string",
})
posDictArea: string;
}
export class CreatePosDict {
@Column()
posDictName: string;
@Column()
posDictField: string;
@Column()
posTypeId: string;
@Column()
posLevelId: string;
@Column()
posExecutiveId: string;
@Column()
posDictExecutiveField: string;
@Column()
posDictArea: string;
}
export type UpdatePosDict = Partial<CreatePosDict>;