. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.4.3) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: select it.* from ipa_transaction it where it.transaction_type='visit' and it.vehicle_id=? and it.process_id=? and (it.stage_workflow_status = 'INPROGRESS' or (it.stage_workflow_status = 'CANCELLED' and it.end_time is null)) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: update ipa_visitors_data set contact_no=?, created_at=?, created_by=?, email=?, gender=?, id_proof_ref=?, img_url=?, modified_at=?, modified_by=?, name=? where id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: select max(it.order_id) from ipa_transaction it where plant_id = ? and it.transaction_type = 'trip' Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_transaction (end_time, order_id, plant_id, process_id, stage_workflow_status, start_time, tag_stage_status, transaction_type, vehicle_id, ipa_transaction_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_transaction_stage_detail (tag_stage_detail_status, flow_type, modified_by, modified_date, stage_id, stage_destination_code_id, time_in, time_out, ipa_transaction_id, ipa_transaction_stage_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_visitors_data (contact_no, created_at, created_by, email, gender, id_proof_ref, img_url, modified_at, modified_by, name, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_id as ipa_tran1_2_0_, transactio0_.end_time as end_time2_2_0_, transactio0_.order_id as order_id3_2_0_, transactio0_.plant_id as plant_id4_2_0_, transactio0_.process_id as process_5_2_0_, transactio0_.stage_workflow_status as stage_wo6_2_0_, transactio0_.start_time as start_ti7_2_0_, transactio0_.tag_stage_status as tag_stag8_2_0_, transactio0_.transaction_type as transact9_2_0_, transactio0_.vehicle_id as vehicle10_2_0_ from ipa_transaction transactio0_ where transactio0_.ipa_transaction_id=? Hibernate: update ipa_transaction set end_time=?, order_id=?, plant_id=?, process_id=?, stage_workflow_status=?, start_time=?, tag_stage_status=?, transaction_type=?, vehicle_id=? where ipa_transaction_id=? Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iaom.next_action_id from ipa_action_order_mapping iaom where iaom.ipa_action_id=? and iaom.action_type=1 Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_visit_logs (addtime, created_by, emp_id, modified_at, modified_by, permit_txn_detail_id, txn_id, visit_type, visitor_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: select max(it.order_id) from ipa_transaction it where plant_id = ? and it.transaction_type = 'trip' Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_transaction (end_time, order_id, plant_id, process_id, stage_workflow_status, start_time, tag_stage_status, transaction_type, vehicle_id, ipa_transaction_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_transaction_stage_detail (tag_stage_detail_status, flow_type, modified_by, modified_date, stage_id, stage_destination_code_id, time_in, time_out, ipa_transaction_id, ipa_transaction_stage_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_visitors_data (contact_no, created_at, created_by, email, gender, id_proof_ref, img_url, modified_at, modified_by, name, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_id as ipa_tran1_2_0_, transactio0_.end_time as end_time2_2_0_, transactio0_.order_id as order_id3_2_0_, transactio0_.plant_id as plant_id4_2_0_, transactio0_.process_id as process_5_2_0_, transactio0_.stage_workflow_status as stage_wo6_2_0_, transactio0_.start_time as start_ti7_2_0_, transactio0_.tag_stage_status as tag_stag8_2_0_, transactio0_.transaction_type as transact9_2_0_, transactio0_.vehicle_id as vehicle10_2_0_ from ipa_transaction transactio0_ where transactio0_.ipa_transaction_id=? Hibernate: update ipa_transaction set end_time=?, order_id=?, plant_id=?, process_id=?, stage_workflow_status=?, start_time=?, tag_stage_status=?, transaction_type=?, vehicle_id=? where ipa_transaction_id=? Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iaom.next_action_id from ipa_action_order_mapping iaom where iaom.ipa_action_id=? and iaom.action_type=1 Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_visit_logs (addtime, created_by, emp_id, modified_at, modified_by, permit_txn_detail_id, txn_id, visit_type, visitor_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: select max(it.order_id) from ipa_transaction it where plant_id = ? and it.transaction_type = 'trip' Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_transaction (end_time, order_id, plant_id, process_id, stage_workflow_status, start_time, tag_stage_status, transaction_type, vehicle_id, ipa_transaction_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_transaction_stage_detail (tag_stage_detail_status, flow_type, modified_by, modified_date, stage_id, stage_destination_code_id, time_in, time_out, ipa_transaction_id, ipa_transaction_stage_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select visitordat0_.id as id1_6_, visitordat0_.contact_no as contact_2_6_, visitordat0_.created_at as created_3_6_, visitordat0_.created_by as created_4_6_, visitordat0_.email as email5_6_, visitordat0_.gender as gender6_6_, visitordat0_.id_proof_ref as id_proof7_6_, visitordat0_.img_url as img_url8_6_, visitordat0_.modified_at as modified9_6_, visitordat0_.modified_by as modifie10_6_, visitordat0_.name as name11_6_ from ipa_visitors_data visitordat0_ where visitordat0_.contact_no=? Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_visitors_data (contact_no, created_at, created_by, email, gender, id_proof_ref, img_url, modified_at, modified_by, name, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_id as ipa_tran1_2_0_, transactio0_.end_time as end_time2_2_0_, transactio0_.order_id as order_id3_2_0_, transactio0_.plant_id as plant_id4_2_0_, transactio0_.process_id as process_5_2_0_, transactio0_.stage_workflow_status as stage_wo6_2_0_, transactio0_.start_time as start_ti7_2_0_, transactio0_.tag_stage_status as tag_stag8_2_0_, transactio0_.transaction_type as transact9_2_0_, transactio0_.vehicle_id as vehicle10_2_0_ from ipa_transaction transactio0_ where transactio0_.ipa_transaction_id=? Hibernate: update ipa_transaction set end_time=?, order_id=?, plant_id=?, process_id=?, stage_workflow_status=?, start_time=?, tag_stage_status=?, transaction_type=?, vehicle_id=? where ipa_transaction_id=? Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select transactio0_.ipa_transaction_detail_id as ipa_tran1_3_, transactio0_.action_id as action_i2_3_, transactio0_.action_type as action_t3_3_, transactio0_.created_by as created_4_3_, transactio0_.created_date as created_5_3_, transactio0_.modified_by as modified6_3_, transactio0_.modified_date as modified7_3_, transactio0_.overriding_status as overridi8_3_, transactio0_.reason_description as reason_d9_3_, transactio0_.response_status as respons10_3_, transactio0_.response_value as respons11_3_, transactio0_.ipa_transaction_stage_detail_id as ipa_tra12_3_ from ipa_transaction_detail transactio0_ where transactio0_.action_id=? and transactio0_.ipa_transaction_stage_detail_id=? Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iaom.next_action_id from ipa_action_order_mapping iaom where iaom.ipa_action_id=? and iaom.action_type=1 Hibernate: select nextval ('ipa_tag_stage_workflow_detail_tag_stage_workflow_detail_id_seq') Hibernate: insert into ipa_transaction_detail (action_id, action_type, created_by, created_date, modified_by, modified_date, overriding_status, reason_description, response_status, response_value, ipa_transaction_stage_detail_id, ipa_transaction_detail_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select nextval ('hibernate_sequence') Hibernate: insert into ipa_visit_logs (addtime, created_by, emp_id, modified_at, modified_by, permit_txn_detail_id, txn_id, visit_type, visitor_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid,itsd.ipa_transaction_stage_detail_id as txn_stage_id ,ivd.id as visitor_id, ivd.name as visitor_name , ivd.contact_no as visitor_no,itsd.stage_id as stage_id ,it."stage_workflow_status" as trip_status,itsd.stage_destination_code_id as destination_id,it.transaction_type as type, itd.response_status as status , ivd.gender as gender , iu.user_name as meet_with from ipa_transaction_stage_detail itsd join ipa_transaction it on it.ipa_transaction_id = itsd.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where (itsd.stage_id = ? and ((itsd.tag_stage_detail_status = 'IN' and ivl.permit_txn_detail_id is not null) or (itsd.tag_stage_detail_status = 'OUT' and it.start_time > now()::date)) and it.transaction_type = 'visit' and (it.stage_workflow_status = 'INPROGRESS' or ( it.end_time is not null and it.stage_workflow_status='CANCELLED')))order by it.start_time desc java.lang.NullPointerException: null at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? java.lang.NullPointerException: null at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? java.lang.NullPointerException: null at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.order_id,ivd.*,iu.user_id,iu.user_name,ivl.visit_type,itd.response_value::varchar from ipa_visit_logs ivl right join ipa_visitors_data ivd on ivd.id=ivl.visitor_id join ipa_user iu on iu.user_id=ivl.emp_id join ipa_transaction_detail itd on itd.ipa_transaction_detail_id=ivl.permit_txn_detail_id left join ipa_transaction it on it.ipa_transaction_id=ivl.txn_id where ivl.txn_id=? java.lang.NullPointerException: null at inplantVisitorModule.interceptor.AuthInterceptor.preHandle(AuthInterceptor.java:40) ~[classes!/:?] at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:148) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.doHead(HttpServlet.java:240) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:649) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.4.jar!/:5.3.4] at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.43.jar!/:4.0.FR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at inplantVisitorModule.configuration.JwtRequestFilter.doFilterInternal(JwtRequestFilter.java:21) ~[classes!/:?] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.2.jar!/:5.6.2] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.3.jar!/:2.4.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.4.jar!/:5.3.4] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.4.jar!/:5.3.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] java.lang.IllegalArgumentException: Invalid character found in method name [MGLNDD_13.126.162.170_8118...]. HTTP method names must be tokens at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:417) ~[tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:261) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.43.jar!/:9.0.43] at java.lang.Thread.run(Thread.java:834) [?:?] Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select iusm.user_id,ipso.process_id,ipp.process_name, ips.entry_type,ips.entry_method_id , jsonb_agg(jsonb_build_object('stageId',is2.stage_id, 'stageName',is2.stage_name,'stageIndex',ipso.stage_ranking_index, 'nextStage', (select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 1 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res), 'nextRejectStage',(select coalesce(jsonb_agg(res) , '[]' ::jsonb) from (select is4.stage_id ,is4.stage_name, ist.stage_type_name from ipa_stage_configuration isc left join ipa_stage is4 on is4.stage_id = isc.next_stage_id join ipa_stage_type ist on ist.stage_type_id = is4.stage_type_id where isc.mapping_type = 0 and isc.next_stage_id is not null and isc.stage_id = is2.stage_id and isc.process_id = ipso.process_id) as res) )) ::varchar stages from ipa_user_shift_mapping iusm join ipa_shift_stage_mapping issm on issm.id=iusm.shift_stage_mapping_id join ipa_shift_master ism on ism.shift_id = issm.shift_master_id join ipa_process_stage_order ipso on ipso.process_stage_order_id=issm.process_stage_order_id and ipso.is_active join ipa_plant_process ipp on ipp.process_id= ipso.process_id join ipa_work_type iwt on iwt.work_type_id = ipp.work_type_id join ipa_plant ip on ip.plant_id = iwt.plant_id join ipa_plant_setting ips on ips.plant_id = ip.plant_id join ipa_stage is2 on is2.stage_id=ipso.stage_id where iusm.user_id= ? and iwt.work_type_name = 'Visit' and (now() ::date between iusm.shift_start_time ::date and iusm.shift_end_time ::date) and (case when ism.shift_start_time = ism.shift_end_time then true when ism.shift_start_time < ism.shift_end_time then now() ::time between ism.shift_start_time ::time and ism.shift_end_time ::time else now() ::timestamp between (now() ::date||' '||ism.shift_start_time ::time) ::timestamp and ((now()+ interval '1day') ::date||' '||ism.shift_end_time ::time) ::timestamp end) group by user_id,ipso.process_id ,ipp.process_name,ips.entry_type,ips.entry_method_id; Hibernate: select count(*) from ipa_transaction it where it.transaction_type='visit' and it."stage_workflow_status"='COMPLETED' and it.start_time>=CURRENT_DATE::timestamp Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =? Hibernate: select it.ipa_transaction_id as txnid, it.vehicle_id as visitor_id, itsd.ipa_transaction_stage_detail_id as txn_stage_id, ivd.name as visitor_name, ivd.contact_no as visitor_no, itsd.stage_id, itsd.stage_destination_code_id as destination_id, it.transaction_type as type, ivd.gender, it."stage_workflow_status" as trip_status, coalesce(itd.response_status, 'PENDING') as status, iu.user_name as meet_with from ipa_transaction it join ipa_transaction_stage_detail itsd on itsd.ipa_transaction_id = it.ipa_transaction_id left join ipa_visitors_data ivd on ivd.id = it.vehicle_id left join ipa_visit_logs ivl on ivl.txn_id = it.ipa_transaction_id left join ipa_transaction_detail itd on itd.ipa_transaction_detail_id = ivl.permit_txn_detail_id left join ipa_user iu on iu.user_id = ivl.emp_id where it.transaction_type = 'visit' and (it. stage_workflow_status = 'INPROGRESS' or (it. stage_workflow_status = 'CANCELLED' and it.end_time is null)) and itsd. tag_stage_detail_status::text =? and itsd.stage_id =?