1. 程式人生 > >ibatis動態sql

ibatis動態sql

<select id="MS-DET-ACCOUNT-CACHE-CONFIG-QUERY-BY-COND" resultMap="RM-DET-ACCOUNT-CACHE-CONFIG" >
        select /*MS-FCDEBITTRANS-DET-ACCOUNT-CACHE-CONFIG-QUERY-BY-COND*/ tnt_inst_id, recon_inst, account_no, product_code, event_code, record_model, quota, status, operator, memo, gmt_create, gmt_modified
        from det_account_cache_config
        where tnt_inst_id = #tntInstId#
        <dynamic>
            <isNotEmpty prepend="and" property="reconInst">
                recon_inst = #reconInst#
            </isNotEmpty>
            <isNotEmpty prepend="and" property="accountNo">
                account_no = #accountNo#
            </isNotEmpty>
            <isNotEmpty prepend="and" property="productCode">
                product_code = #productCode#
            </isNotEmpty>
            <isNotEmpty prepend="and" property="eventCode">
                event_code = #eventCode#
            </isNotEmpty>
            <isNotEmpty prepend="and" property="recordMode">
                record_model = #recordMode#
            </isNotEmpty>
        </dynamic>
        and status in
        <iterate property='statusList' open="(" close=")" conjunction=",">
            #statusList[]#
        </iterate>
        <dynamic>
            <isEqual property="isPaging" compareValue="true">
                order by gmt_modified desc
            </isEqual>
            <isEqual property="isPaging" compareValue="true">
                limit #pageStart#,#pageSize#
            </isEqual>
        </dynamic>
    </select>