checkpoint and fix bug

This commit is contained in:
AdisakKanthawilang 2024-01-31 17:22:45 +07:00
parent 24d0d06b62
commit 2610bd74b4
2 changed files with 57 additions and 3 deletions

View file

@ -690,4 +690,58 @@ export class PositionController extends Controller {
return error;
}
}
/**
* API
*
* @summary ORG_053 - (ADMIN) #56
*
*/
@Post("master/list")
async list(
@Body()
body: {
id: string;
type: number;
// isAll: boolean;
// page: number;
// pageSize: number;
// keyword?: string;
},
) {
try {
let typeCondition: any = {};
if (body.type === 0) {
typeCondition = {
orgRootId: body.id,
};
} else if (body.type === 1) {
typeCondition = {
orgChild1Id: body.id,
};
} else if (body.type === 2) {
typeCondition = {
orgChild2Id: body.id,
};
} else if (body.type === 3) {
typeCondition = {
orgChild3Id: body.id,
};
} else if (body.type === 4) {
typeCondition = {
orgChild4Id: body.id,
};
}
const posMaster = await this.posMasterRepository.find({
where: typeCondition,
// relations: ["position"]
});
return new HttpSuccess(posMaster);
} catch (error) {
return error;
}
}
}

View file

@ -148,15 +148,15 @@ export class PosMaster extends EntityBase {
orgChild1: OrgChild1;
@ManyToOne(() => OrgChild2, (orgChild2) => orgChild2.posMasters)
@JoinColumn({ name: "orgChild2" })
@JoinColumn({ name: "orgChild2Id" })
orgChild2: OrgChild2;
@ManyToOne(() => OrgChild3, (orgChild3) => orgChild3.posMasters)
@JoinColumn({ name: "orgChild3OrgChild3Id" })
@JoinColumn({ name: "orgChild3Id" })
orgChild3: OrgChild3;
@ManyToOne(() => OrgChild4, (orgChild4) => orgChild4.posMasters)
@JoinColumn({ name: "orgChild4" })
@JoinColumn({ name: "orgChild4Id" })
orgChild4: OrgChild4;
@OneToMany(() => Position, (position) => position.posMaster)