<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
             select q.project_lease_item_id,
       q.lease_item_seq,
       q.vehicle_class,
       q.brand_id,
      
       (select 

  cb.description  value_name
from hls_car_brands_vl cb
where cb.enabled_flag ='Y'
and  cb.brand_id  =  q.brand_id) brand_id_n,
       q.series_id,
      
       
       (select 

  cs.description value_name
from hls_car_series_vl cs
where cs.enabled_flag ='Y'
and cs.series_id= q.series_id)  series_id_n,
       
       q.model_id,
       
       (select
        
         cm.description value_name
        
          from hls_car_model_vl cm
         where cm.enabled_flag = 'Y'
           and cm.model_id = q.model_id) model_id_n,
       
       q.truck_class,
       
       (select v.code_value_name as value_name
          from sys_code_values_v v
         where v.code = 'TRUCK_CLASS'
           and v.code_enabled_flag = 'Y'
           and v.code_value_enabled_flag = 'Y'
           and v.code_value = q.truck_class) truck_class_n,
       q.bus_type,
       q.color_of_apprearance,
       q.sit_number,
       q.energy_type,
       q.price,
       q.quantity,
       q.gps_flag,
       q.project_id,
        q.guide_price,
        q.insurance_price,
        q.gps_amount,
        q.purchase_tax,
     (select  v.code_value_name as value_name
       from sys_code_values_v v
      where v.code = 'ENERGY_TYPE'
        and v.code_enabled_flag = 'Y'
        and v.code_value_enabled_flag = 'Y'
        and  v.code_value =q.energy_type) energy_type_n,
        (select v.code_value_name as value_name
          from sys_code_values_v v
         where v.code = 'BUS_TYPE'
           and v.code_enabled_flag = 'Y'
           and v.code_value_enabled_flag = 'Y'
           and v.code_value = q.bus_type) bus_type_n
       

  from prj_project_lease_item q

 where 
 q.project_id =${@project_id}

            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="guide_price"/>
        <bm:field name="insurance_price"/>
        <bm:field name="gps_amount"/>
        <bm:field name="purchase_tax"/>
        <bm:field name="energy_type_n"/>
        <bm:field name="bus_type_n"/>
        <bm:field name="gps_flag"/>
        <bm:field name="project_id"/>
        <bm:field name="model_id_n"/>
        <bm:field name="truck_class"/>
        <bm:field name="truck_class_n"/>
        <bm:field name="bus_type"/>
        <bm:field name="color_of_apprearance"/>
        <bm:field name="sit_number"/>
        <bm:field name="energy_type"/>
        <bm:field name="price"/>
        <bm:field name="quantity"/>
        <bm:field name="project_lease_item_id"/>
        <bm:field name="lease_item_seq"/>
        <bm:field name="vehicle_class"/>
        <bm:field name="brand_id"/>
        <bm:field name="brand_id_n"/>
        <bm:field name="series_id"/>
        <bm:field name="series_id_n"/>
        <bm:field name="model_id"/>
    </bm:fields>
</bm:model>
