MyBatis中如果某个查询不希望使用缓存,可以在映射文件中的select语句上设置flushCache="true"属性

    <select id="xmlGetGuaranteeCount"  databaseId="sqlserver" resultType="Integer" flushCache="true">
        <![CDATA[
            SELECT
                count(appisparea.ID)
            FROM T_APP_ISP_AREA AS appisparea WHERE 1=1
        ]]>
        <if test="ispDataId != null  and ispDataId != '' " >
            <![CDATA[
            AND FK_ISP_DATAID = #{ispDataId}
        ]]>
        </if>
        <if test="beiAnDiQuCode != null and beiAnDiQuCode=='000000' " >
            <![CDATA[
            AND BEIANDIQU_CODE NOT LIKE 'x%'
        ]]>
        </if>
        <if test="beiAnDiQuCode != null  and beiAnDiQuCode.toLowerCase().startsWith('x') " >
            <![CDATA[
            AND BEIANDIQU_CODE = #{beiAnDiQuCode}
        ]]>
        </if>
    </select>

 

posted on 2024-04-09 14:59  五官一体即忢  阅读(137)  评论(0编辑  收藏  举报

导航