migrate dna
This commit is contained in:
parent
e16390b787
commit
d51357e715
9 changed files with 243 additions and 183 deletions
|
|
@ -161,7 +161,13 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
@Query("year") year?: number,
|
||||
@Query("scholarshipType") scholarshipType?: string,
|
||||
) {
|
||||
await new permission().PermissionList(request, "SYS_DEV_SCHOLARSHIP");
|
||||
let _data = await new permission().PermissionOrgList(request, "SYS_DEV_SCHOLARSHIP");
|
||||
await new CallAPI()
|
||||
.PostData(request, "/org/finddna", _data)
|
||||
.then((x) => {
|
||||
_data = x;
|
||||
})
|
||||
.catch((x) => {});
|
||||
const [development, total] = await AppDataSource.getRepository(DevelopmentScholarship)
|
||||
.createQueryBuilder("developmentScholarship")
|
||||
.leftJoinAndSelect("developmentScholarship.posLevel", "posLevel")
|
||||
|
|
@ -226,6 +232,16 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
);
|
||||
}),
|
||||
)
|
||||
.andWhere(
|
||||
_data.root != undefined && _data.root != null
|
||||
? _data.root[0] != null
|
||||
? `developmentScholarship.rootDnaId IN (:...root)`
|
||||
: `developmentScholarship.rootDnaId is null`
|
||||
: "1=1",
|
||||
{
|
||||
root: _data.root,
|
||||
},
|
||||
)
|
||||
.orderBy("developmentScholarship.scholarshipYear", "DESC")
|
||||
.addOrderBy("developmentScholarship.createdAt", "DESC")
|
||||
.skip((page - 1) * pageSize)
|
||||
|
|
@ -264,6 +280,7 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทุนการศึกษา/ฝึกอบรมนี้");
|
||||
}
|
||||
const formattedData = {
|
||||
rootDnaId: getDevelopment.rootDnaId ? getDevelopment.rootDnaId : null,
|
||||
rootId: getDevelopment.rootId ? getDevelopment.rootId : null,
|
||||
root: getDevelopment.root ? getDevelopment.root : null,
|
||||
org: getDevelopment.org ? getDevelopment.org : null,
|
||||
|
|
@ -282,6 +299,9 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
: null,
|
||||
posTypeId: getDevelopment.posTypeId ? getDevelopment.posTypeId : null,
|
||||
posTypeName: getDevelopment.posType?.posTypeName ? getDevelopment.posType?.posTypeName : null,
|
||||
guarantorRootDnaId: getDevelopment.guarantorRootDnaId
|
||||
? getDevelopment.guarantorRootDnaId
|
||||
: null,
|
||||
guarantorRootId: getDevelopment.guarantorRootId ? getDevelopment.guarantorRootId : null,
|
||||
guarantorRoot: getDevelopment.guarantorRoot ? getDevelopment.guarantorRoot : null,
|
||||
guarantorOrg: getDevelopment.guarantorOrg ? getDevelopment.guarantorOrg : null,
|
||||
|
|
@ -426,6 +446,7 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทุนการศึกษา/ฝึกอบรมนี้");
|
||||
}
|
||||
const formattedData = {
|
||||
rootDnaId: getDevelopment.rootDnaId ? getDevelopment.rootDnaId : null,
|
||||
rootId: getDevelopment.rootId ? getDevelopment.rootId : null,
|
||||
root: getDevelopment.root ? getDevelopment.root : null,
|
||||
org: getDevelopment.org ? getDevelopment.org : null,
|
||||
|
|
@ -444,6 +465,9 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
: null,
|
||||
posTypeId: getDevelopment.posTypeId ? getDevelopment.posTypeId : null,
|
||||
posTypeName: getDevelopment.posType?.posTypeName ? getDevelopment.posType?.posTypeName : null,
|
||||
guarantorRootDnaId: getDevelopment.guarantorRootDnaId
|
||||
? getDevelopment.guarantorRootDnaId
|
||||
: null,
|
||||
guarantorRootId: getDevelopment.guarantorRootId ? getDevelopment.guarantorRootId : null,
|
||||
guarantorRoot: getDevelopment.guarantorRoot ? getDevelopment.guarantorRoot : null,
|
||||
guarantorOrg: getDevelopment.guarantorOrg ? getDevelopment.guarantorOrg : null,
|
||||
|
|
@ -567,7 +591,10 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
* @param {string} id id รายการ
|
||||
*/
|
||||
@Get("admin/detail/{id}")
|
||||
async GetDevelopemtScholarshipUserDetailAdminById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
async GetDevelopemtScholarshipUserDetailAdminById(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
) {
|
||||
let _workflow = await new permission().Workflow(request, id, "SYS_DEV_SCHOLARSHIP");
|
||||
if (_workflow == false) await new permission().PermissionGet(request, "SYS_DEV_SCHOLARSHIP");
|
||||
const getDevelopment = await this.developmentScholarshipRepository.findOne({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue