<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="PRJ_PROJECT_CONTENT">
    <bm:fields>
        <bm:field name="content_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTENT_ID" prompt="PRJ_PROJECT_CONTENT.CONTENT_ID"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" forUpdate="false" physicalName="PROJECT_ID" prompt="PRJ_PROJECT_CONTENT.PROJECT_ID"/>
        <bm:field name="quotation_id" forUpdate="false"/>
        <bm:field name="clause_usage" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CLAUSE_USAGE" prompt="PRJ_PROJECT_CONTENT.CLAUSE_USAGE"/>
        <bm:field name="templet_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TEMPLET_ID" prompt="PRJ_PROJECT_CONTENT.TEMPLET_ID"/>
        <bm:field name="prj_bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRJ_BP_ID" prompt="PRJ_PROJECT_CONTENT.PRJ_BP_ID"/>
        <bm:field name="content_print_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTENT_PRINT_FLAG" prompt="PRJ_PROJECT_CONTENT.CONTENT_PRINT_FLAG"/>
        <bm:field name="available_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="AVAILABLE_FLAG" prompt="PRJ_PROJECT_CONTENT.AVAILABLE_FLAG"/>
        <bm:field name="sign_date" databaseType="DATE" datatype="java.util.Date" physicalName="SIGN_DATE" prompt="PRJ_PROJECT_CONTENT.SIGN_DATE"/>
        <bm:field name="sign_place" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SIGN_PLACE" prompt="PRJ_PROJECT_CONTENT.SIGN_PLACE"/>
        <bm:field name="signer_opposite_side" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SIGNER_OPPOSITE_SIDE" prompt="PRJ_PROJECT_CONTENT.SIGNER_OPPOSITE_SIDE"/>
        <bm:field name="notary" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTARY" prompt="PRJ_PROJECT_CONTENT.NOTARY"/>
        <bm:field name="content_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTENT_NUMBER" prompt="PRJ_PROJECT_CONTENT.CONTENT_NUMBER"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="PRJ_PROJECT_CONTENT.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="PRJ_PROJECT_CONTENT.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="PRJ_PROJECT_CONTENT.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="PRJ_PROJECT_CONTENT.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="PRJ_PROJECT_CONTENT.REF_V05"/>
        <bm:field name="bp_name" expression="(select bm.bp_name from hls_bp_master bm where bm.bp_id=bp.bp_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="bp_category_desc" expression="(select d.description from hls_bp_category d where d.bp_category = bp.bp_category)" forInsert="false" forUpdate="false"/>
        <bm:field name="content_print_flag_name" expression="(decode(t1.content_print_flag, &apos;Y&apos;, &apos;已打印&apos;, &apos;未打印&apos;))" forInsert="false" forUpdate="false"/>
        <bm:field name="bp_class_desc" expression="(select v.code_value_name from sys_code_values_v v where v.code = &apos;HLS211_BP_CLASS&apos; and v.code_value = bp.bp_class)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:relations>
        <bm:relation name="usage" joinType="inner" refModel="sys.sys_code_values_v">
            <bm:reference expression="usage.code=&apos;CON_TMPLET_USAGE&apos; and t1.clause_usage = usage.code_value"/>
        </bm:relation>
        <bm:relation name="templet" joinType="left outer" refModel="cont.CON202.con_clause_templet">
            <bm:reference foreignField="templet_id" localField="templet_id"/>
        </bm:relation>
        <bm:relation name="bp" joinType="inner" refModel="prj.PRJ702N.prj_project_bp_for_lov">
            <bm:reference foreignField="prj_bp_id" localField="prj_bp_id"/>
        </bm:relation>
    </bm:relations>
    <bm:ref-fields>
        <bm:ref-field name="clause_usage_name" relationName="usage" sourceField="code_value_name"/>
        <bm:ref-field name="templet_code" relationName="templet" sourceField="templet_code"/>
        <bm:ref-field name="templet_name" relationName="templet" sourceField="description"/>
        <bm:ref-field name="templet_usage" relationName="templet" sourceField="templet_usage"/>
        <bm:ref-field name="bp_category" relationName="bp" sourceField="bp_category"/>
        <bm:ref-field name="bp_id" relationName="bp" sourceField="bp_id"/>
        <bm:ref-field name="bp_class" relationName="bp" sourceField="bp_class"/>
    </bm:ref-fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="content_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="project_id" queryExpression="t1.project_id=${@project_id}"/>
        <bm:query-field name="quotation_id" queryExpression="t1.quotation_id = ${@quotation_id}"/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			
    			begin
    				update PRJ_PROJECT_CONTENT ppc
    				  set ppc.content_print_flag = 'Y'
    				where ppc.content_id = ${@content_id};
    			end;	  
    			
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
