<?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 SU.USER_NAME,
          USER_ID,
          SU.DESCRIPTION,
          SU.BP_CATEGORY,
          to_char(SU.START_DATE,'yyyy-mm-dd') START_DATE ,
          to_char(SU.END_DATE,'yyyy-mm-dd') END_DATE,
          decode(SU.FROZEN_FLAG, 'Y', '已冻结', '未冻结') P_FROZEN_FLAG,
          SU.FROZEN_FLAG,
          to_char(SU.FROZEN_DATE,'yyyy-mm-dd') FROZEN_DATE,
          (SELECT EE.EMPLOYEE_CODE
			  FROM EXP_EMPLOYEES EE
			 WHERE EE.EMPLOYEE_ID = SU.EMPLOYEE_ID) EMPLOYEE_CODE,
		   (SELECT EE.NAME
			  FROM EXP_EMPLOYEES EE
			 WHERE EE.EMPLOYEE_ID = SU.EMPLOYEE_ID) EMPLOYEE_NAME,
			 (SELECT SCV.CODE_VALUE_NAME FROM SYS_CODE_VALUES_V SCV WHERE CODE='USER_TYPE' AND SCV.CODE_VALUE = SU.BP_CATEGORY) BP_CATEGORY_NAME,
			 (SELECT HD.BP_CODE FROM HLS_BP_MASTER HD WHERE SU.BP_ID=HD.BP_ID) BP_CODE,
			 (SELECT HD.BP_NAME FROM HLS_BP_MASTER HD WHERE SU.BP_ID=HD.BP_ID) BP_NAME,
			 sys_login_pkg.get_login_time(p_user_id =>su.user_id) login_time
     from sys_user su order by su.USER_NAME	)
	
			#WHERE_CLAUSE#]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="user_name" dataType="java.lang.String" queryExpression="upper(USER_NAME) like  upper(&apos;%&apos;||${@user_name}||&apos;%&apos;)"/>
        <bm:query-field name="employee_code" dataType="java.lang.String" queryExpression="upper(EMPLOYEE_CODE) like  upper(&apos;%&apos;||${@employee_code}||&apos;%&apos;)"/>
        <bm:query-field name="employee_name" dataType="java.lang.String" queryExpression="EMPLOYEE_NAME like  &apos;%&apos;||${@employee_name}||&apos;%&apos;"/>
        <bm:query-field name="frozen_flag" dataType="java.lang.String" queryExpression="FROZEN_FLAG =  ${@frozen_flag}"/>
        <bm:query-field name="bp_category" dataType="java.lang.String" queryExpression="BP_CATEGORY = ${@bp_category}"/>
        <bm:query-field name="bp_code" dataType="java.lang.String" queryExpression="upper(BP_CODE) like upper(&apos;%&apos;||${@bp_code}||&apos;%&apos;)"/>
        <bm:query-field name="bp_name" dataType="java.lang.String" queryExpression="BP_NAME like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
        <bm:query-field name="description" dataType="java.lang.String" queryExpression="DESCRIPTION like &apos;%&apos;||${@description}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
