<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gzj
    $Date: 2022年12月8日 17:13:08
    $Revision: 1.0
    $Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                select t.file_name,
                       to_char(t.print_date,'yyyy-mm-dd hh24:mi:ss') print_date,
                       t.print_id,
                        (SELECT su.description FROM sys_user su WHERE su.user_id = t.created_by) user_name
                  from cux_contract_print t
                 where (((SELECT e.role_code
                           FROM sys_role_vl e
                          WHERE e.role_id = ${/session/@role_id}) in ('0018', '0019')
                       and t.created_by = ${/session/@user_id})
                    or (SELECT e.role_code
                          FROM sys_role_vl e
                         WHERE e.role_id = ${/session/@role_id}) not in
                       ('0018', '0019'))
                    and t.contract_id =   ${@contract_id}
                    and t.lease_type = '01'
                    order by t.print_date desc
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
