<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng  
    $Date: 2017-7-19 上午10:50:58  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HN_CHANCE_BP_INTERVIEWS_V" defaultOrderBy="interview_date desc">
    <bm:fields>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" prompt="HN_CHANCE_BP_INTERVIEWS_V.RECORD_ID"/>
        <bm:field name="chance_bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CHANCE_BP_ID" prompt="HN_CHANCE_BP_INTERVIEWS_V.CHANCE_BP_ID"/>
        <bm:field name="interview_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTERVIEW_NAME" prompt="HN_CHANCE_BP_INTERVIEWS_V.INTERVIEW_NAME"/>
        <bm:field name="interview_date" databaseType="DATE" datatype="java.util.Date" physicalName="INTERVIEW_DATE" prompt="HN_CHANCE_BP_INTERVIEWS_V.INTERVIEW_DATE"/>
        <bm:field name="interview_location" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTERVIEW_LOCATION" prompt="HN_CHANCE_BP_INTERVIEWS_V.INTERVIEW_LOCATION"/>
        <bm:field name="interviewer_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERVIEWER_USER_ID" prompt="HN_CHANCE_BP_INTERVIEWS_V.INTERVIEWER_USER_ID"/>
        <bm:field name="interviewer_user_id_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTERVIEWER_USER_ID_N" prompt="HN_CHANCE_BP_INTERVIEWS_V.INTERVIEWER_USER_ID_N"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="HN_CHANCE_BP_INTERVIEWS_V.DESCRIPTION"/>
        <bm:field name="creation_date_desc" databaseType="DATE" datatype="java.util.Date" physicalName="CREATION_DATE_DESC" prompt="HN_CHANCE_BP_INTERVIEWS_V.CREATION_DATE_DESC"/>
        <bm:field name="chance_bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANCE_BP_NAME" prompt="HN_CHANCE_BP_INTERVIEWS_V.CHANCE_BP_NAME"/>
        <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS" prompt="HN_CHANCE_BP_INTERVIEWS_V.BP_CLASS"/>
        <bm:field name="bp_class_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_N" prompt="HN_CHANCE_BP_INTERVIEWS_V.BP_CLASS_N"/>
        <bm:field name="unit_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNIT_ID" prompt="HN_CHANCE_BP_INTERVIEWS_V.UNIT_ID"/>
        <bm:field name="unit_id_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="UNIT_ID_N" prompt="HN_CHANCE_BP_INTERVIEWS_V.UNIT_ID_N"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="interviewee_name" databaseType="VARCHAR2" datatype="java.lang.String"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="chance_bp_name" queryExpression="t1.chance_bp_name like &apos;%&apos;||${@chance_bp_name}||&apos;%&apos;"/>
        <bm:query-field name="bp_class" queryExpression="t1.bp_class =${@bp_class}"/>
        <bm:query-field name="interview_date_from" queryExpression="trunc(interview_date)  &gt;= to_date(${@interview_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="interview_date_to" queryExpression="trunc(interview_date)  &lt;= to_date(${@interview_date_to},&apos;yyyy-mm-dd&apos;)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter expression="t1.enabled_flag = &apos;Y&apos;"/>
        <bm:data-filter expression="(exists         (select 1             from aut_trx_user_authorize a1, aut_owner_user_authorize a2            where a1.trx_category = &apos;CHANCE_BP&apos;              and a1.trx_id = t1.chance_bp_id              and trunc(sysdate) between a1.start_date and                  nvl(a1.end_date, trunc(sysdate))              and a1.user_id = a2.owner_user_id              and a1.trx_category = a2.trx_category              and a2.authorized_user_id = ${/session/@user_id}              and trunc(sysdate) between a2.start_date and                  nvl(a2.end_date, trunc(sysdate)))                or exists (select 1                       from exp_emp_assign_e_v v                      where v.primary_position_flag = &apos;Y&apos;                        and v.user_id = ${/session/@user_id}                        and v.unit_id = t1.unit_id                      ))"/>
    </bm:data-filters>
</bm:model>
