Created
July 7, 2021 07:11
-
-
Save siteslave/97e64bb98777070e8cf04bc8bc9ba1db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var position = [ | |
{ | |
"position_id": 1, | |
"position_type_id": 1, | |
"position_name": "เลขาธิการสำนักงานอัยการสูงสุด (นักบริหาร)", | |
"status": "1" | |
}, | |
{ | |
"position_id": 2, | |
"position_type_id": 1, | |
"position_name": "รองเลขาธิการสำนักงานอัยการสูงสุด (นักบริหาร)", | |
"status": "1" | |
}, | |
{ | |
"position_id": 3, | |
"position_type_id": 1, | |
"position_name": "ผู้ช่วยเลขาธิการสำนักงานอัยการสูงสุด (นักบริหาร)", | |
"status": "1" | |
}, | |
{ | |
"position_id": 4, | |
"position_type_id": 2, | |
"position_name": "ผู้อำนวยการ", | |
"status": "1" | |
}, | |
{ | |
"position_id": 5, | |
"position_type_id": 3, | |
"position_name": "นักทรัพยากรบุคคล", | |
"status": "1" | |
}, | |
{ | |
"position_id": 6, | |
"position_type_id": 3, | |
"position_name": "นักวิเคราะห์งบประมาณ", | |
"status": "1" | |
}, | |
{ | |
"position_id": 7, | |
"position_type_id": 3, | |
"position_name": "วิศวกรโยธา", | |
"status": "1" | |
}, | |
{ | |
"position_id": 8, | |
"position_type_id": 3, | |
"position_name": "นักวิเทศสัมพันธ์", | |
"status": "1" | |
}, | |
{ | |
"position_id": 9, | |
"position_type_id": 3, | |
"position_name": "นักวิชาการสถิติ", | |
"status": "1" | |
}, | |
{ | |
"position_id": 10, | |
"position_type_id": 3, | |
"position_name": "บรรณารักษ์", | |
"status": "1" | |
}, | |
{ | |
"position_id": 11, | |
"position_type_id": 3, | |
"position_name": "นักจัดการงานทั่วไป", | |
"status": "1" | |
}, | |
{ | |
"position_id": 12, | |
"position_type_id": 3, | |
"position_name": "นักประชาสัมพันธ์", | |
"status": "1" | |
}, | |
{ | |
"position_id": 13, | |
"position_type_id": 3, | |
"position_name": "นักวิชาการคอมพิวเตอร์", | |
"status": "1" | |
}, | |
{ | |
"position_id": 14, | |
"position_type_id": 3, | |
"position_name": "สถาปนิก", | |
"status": "1" | |
}, | |
{ | |
"position_id": 15, | |
"position_type_id": 3, | |
"position_name": "วิศวกรไฟฟ้า", | |
"status": "1" | |
}, | |
{ | |
"position_id": 16, | |
"position_type_id": 3, | |
"position_name": "นักวิชาการตรวจสอบภายใน", | |
"status": "1" | |
}, | |
{ | |
"position_id": 17, | |
"position_type_id": 3, | |
"position_name": "นิติกร", | |
"status": "1" | |
}, | |
{ | |
"position_id": 18, | |
"position_type_id": 3, | |
"position_name": "นักวิเคราะห์นโยบายและแผน", | |
"status": "1" | |
}, | |
{ | |
"position_id": 19, | |
"position_type_id": 3, | |
"position_name": "นักวิชาการเงินและบัญชี", | |
"status": "1" | |
}, | |
{ | |
"position_id": 20, | |
"position_type_id": 3, | |
"position_name": "นักวิชาการพัสดุ", | |
"status": "1" | |
}, | |
{ | |
"position_id": 21, | |
"position_type_id": 4, | |
"position_name": "เจ้าพนักงานโสตทัศนศึกษา", | |
"status": "1" | |
}, | |
{ | |
"position_id": 22, | |
"position_type_id": 4, | |
"position_name": "นายช่างโยธา", | |
"status": "1" | |
}, | |
{ | |
"position_id": 23, | |
"position_type_id": 4, | |
"position_name": "เจ้าพนักงานสื่อสาร", | |
"status": "1" | |
}, | |
{ | |
"position_id": 24, | |
"position_type_id": 4, | |
"position_name": "เจ้าพนักงานธุรการ", | |
"status": "1" | |
}, | |
{ | |
"position_id": 25, | |
"position_type_id": 4, | |
"position_name": "เจ้าพนักงานพัสดุ", | |
"status": "1" | |
} | |
]; | |
var positiontype = [ | |
{ | |
"position_type_id": 1, | |
"person_type_id": 1, | |
"person_type_name": "บริหาร", | |
"status": "1" | |
}, | |
{ | |
"position_type_id": 2, | |
"person_type_id": 2, | |
"person_type_name": "อำนวยการ", | |
"status": "1" | |
}, | |
{ | |
"position_type_id": 3, | |
"person_type_id": 2, | |
"person_type_name": "วิชาการ", | |
"status": "1" | |
}, | |
{ | |
"position_type_id": 4, | |
"person_type_id": 2, | |
"person_type_name": "ทั่วไป", | |
"status": "1" | |
} | |
]; | |
var results = []; | |
position.forEach(v => { | |
positiontype.forEach(x => { | |
if (v.position_type_id === x.position_type_id) { | |
v.person_type_name = x.person_type_name; | |
} | |
}) | |
results.push(v); | |
}); | |
console.log(results); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment