Mybatis XML标签使用方法

复制代码
<select id="queryPage" resultType="cn">
        select *
        from Tb
        WHERE 1 = 1
        <if test="param2.urgentDegree!=null and param2.urgentDegree!=''">
            and urgent_Degree = #{param2.urgentDegree}
        </if>
        <if test="param2.deviceId!=null and param2.deviceId!=''">
            and device_Id like CONCAT(CONCAT('%', #{param2.deviceId}), '%')
        </if>
        
        <if test="param2.auditStatusList!=null">
            and status in
            <foreach collection="param2.statusList" item="item" separator="," open="(" close=")" index="">
                #{item}
            </foreach>
        </if>
        <if test="idList !=null">
            and ((1, ARTICLEID) in
            <foreach collection="idList" item="item" separator="," open="(" close=")" index="">
                (1, #{item})
            </foreach>)
        </if>
        Order By CREATE_TIME DESC
    </select>
复制代码

 

posted @   盐排骨  阅读(78)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示