<?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
                    *
                FROM
                    (SELECT
                        t.id,
                        t.project_id,
                        (SELECT
                            pp.project_number
                        FROM
                            prj_project pp
                        WHERE
                            pp.project_id = t.project_id
                        ) project_number,
                        (SELECT
                            pp.project_name
                        FROM
                            prj_project pp
                        WHERE
                            pp.project_id = t.project_id
                        ) project_name,
                        t.type_interface,
                        (SELECT
                            v.code_value_name
                        FROM
                            sys_code_values_v v
                        WHERE
                            v.code       = 'CCX_TYPE_INTERFACE' AND
                            v.code_value = t.type_interface
                        ) AS type_interface_n,
                        t.res_code,
                        t.res_msg,
                        t.tid,
                        t.sign,
                        t.reqtid,
                        t.odd_no,
                        t.customer_id,
                        h.bp_id,
                        h.bp_code,
                        h.bp_name,
                        h.bp_class,
                        h.bp_category,
                        h.bp_type,
                        (SELECT
                            bc.description
                        FROM
                            hls_bp_category bc
                        WHERE
                            bc.bp_category = h.bp_category
                        ) AS bp_category_n,
                        (SELECT bt.description FROM hls_bp_type bt WHERE bt.bp_type = h.bp_type
                        ) AS bp_type_n,
                        (SELECT
                            v.code_value_name
                        FROM
                            sys_code_values_v v
                        WHERE
                            v.code       = 'HLS211_BP_CLASS' AND
                            v.code_value = h.bp_class
                        ) AS bp_class_n,
                        t.card,
                        t.cer_type,
                        (SELECT
                            v.code_value_name
                        FROM
                            sys_code_values_v v
                        WHERE
                            v.code       = 'CCX_CER_TYPE' AND
                            v.code_value = t.cer_type
                        ) AS cer_type_n,
                        t.cid,
                        t.mobile,
                        t.mobphooperator,
                        (SELECT
                            v.code_value_name
                        FROM
                            sys_code_values_v v
                        WHERE
                            v.code       = 'CCX_MOBPHOOPERATOR' AND
                            v.code_value = t.mobphooperator
                        ) AS mobphooperator_n,
                        t.telstatus,
                        t.inusetime,
                        t.canceltime,
                        t.type_key,
                        t.cat,
                        t.create_time,
                        t.creator,
                        t.type_swhy,
                        t.totalnum,
                        t.curtpg,
                        t.curtnum
                    FROM
                        CHK_LIST t,
                        hls_bp_master h
                    WHERE
                        h.bp_id = t.customer_id
                    ) t1
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="project_id" queryExpression="t1.project_id = ${@project_id}"/>
        <bm:query-field name="bp_id" queryOperator="t1.bp_id = ${@bp_id}"/>
    </bm:query-fields>
</bm:model>
