<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZHANGXING  
    $Date: 2013-12-12 下午01:18:58  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="AUT_OWNER_USER_DEFAULT">
    <bm:fields>
        <bm:field name="user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="USER_ID" prompt="AUT_OWNER_USER_DEFAULT.USER_ID"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="AUT_OWNER_USER_DEFAULT.ENABLED_FLAG"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="AUT_OWNER_USER_DEFAULT.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="AUT_OWNER_USER_DEFAULT.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="AUT_OWNER_USER_DEFAULT.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="AUT_OWNER_USER_DEFAULT.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="AUT_OWNER_USER_DEFAULT.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="AUT_OWNER_USER_DEFAULT.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="AUT_OWNER_USER_DEFAULT.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="AUT_OWNER_USER_DEFAULT.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="AUT_OWNER_USER_DEFAULT.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="AUT_OWNER_USER_DEFAULT.REF_N05"/>
        <bm:field name="user_name" forInsert="false" forUpdate="false"/>
        <bm:field name="authorized_user_desc" forInsert="false" forUpdate="false"/>
        <bm:field name="employee_code" forInsert="false" forUpdate="false"/>
        <bm:field name="employee_name" forInsert="false" forUpdate="false"/>
        <bm:field name="bp_category_n" forInsert="false" forUpdate="false"/>
        <bm:field name="extra_nam" forInsert="false" forUpdate="false"/>
        <bm:field name="bp_name" forInsert="false" forUpdate="false"/>
        <bm:field name="unit_name" forInsert="false" forUpdate="false"/>
        <bm:field name="position_desc" forInsert="false" forUpdate="false"/>
        <bm:field name="bp_code" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="user_id"/>
    </bm:primary-key>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="AUT106.USER_ID_UNIQUE_ERROR"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select t1.* from
				(select v.user_id,
				       v.user_name,
				       v.description authorized_user_desc,
				       v.employee_code,
				       v.employee_name,
				       t.enabled_flag,
				       t.ref_v01,
				       t.ref_v02,
				       t.ref_v03,
				       t.ref_v04,
				       t.ref_v05,
				       t.ref_n01,
				       t.ref_n02,
				       t.ref_n03,
				       t.ref_n04,
				       t.ref_n05,
				       v.bp_category,
				       decode(v.bp_category,'EMPLOYEE','员工','AGENT','代理商')bp_category_n,
				       v.extra_nam,
				       v.bp_name,
				       v.unit_name,
				       v.position_desc,
				       v.bp_code
				  from sys_user_v v, aut_owner_user_default t
				  where v.user_id(+)=t.user_id) t1
				  #WHERE_CLAUSE#
			]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <!-- <bm:query-field name="unit_name" queryExpression="t1.unit_name =(select v.code_value from sys_code_values_v v where v.code_value_name=${@unit_name} and v.code =&apos;USER_NATURE&apos;)"/> -->
        <!--<bm:query-field name="province_description" queryExpression="t1.province_description =${@province_description}"/>-->
        <bm:query-field name="unit_name" queryExpression="t1.unit_name like ${@unit_name}"/>
        <bm:query-field name="position_desc" queryExpression="t1.position_desc like ${@position_desc}"/>
        <bm:query-field name="user_name" queryExpression="t1.user_name like ${@user_name}"/>
        <bm:query-field name="employee_name" queryExpression="t1.employee_name like ${@employee_name}"/>
        <bm:query-field name="bp_category" queryExpression="t1.bp_category like ${@bp_category}" />
        <bm:query-field name="bp_name" queryExpression="t1.bp_name like ${@bp_name}" />
        <bm:query-field name="extra_nam" queryExpression="t1.extra_nam like ${@extra_nam}" />
        <bm:query-field name="bp_code" queryExpression="t1.bp_code like ${@bp_code}" />
    </bm:query-fields>
</bm:model>
