Mybatis-xml映射文件与动态SQL

 xml映射文件

 动态SQL

 

<where>
            <if test="name!=null">
                name like concat('%',#{name},'%')
            </if>
            <if test="username!=null">
                and username=#{username}
            </if>
        </where>

 

<!--    collection:遍历的集合-->
<!--    item:遍历出来的元素-->
<!--    separator:分隔符-->
<!--    open:遍历开始的字符-->
<!--    close:遍历结束的字符-->
    <delete id="delectIds">
        delete from emp where id in
        <foreach collection="ids" item="id" separator="," open="(" close=")">
            #{id}
        </foreach>
    </delete>

 

 

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-03-18 07:30:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-18 07:30:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-18 07:30:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-18 07:30:02       18 阅读

热门阅读

  1. 清理ubuntu空间

    2024-03-18 07:30:02       21 阅读
  2. ubuntu(jammy)安装docker步骤

    2024-03-18 07:30:02       19 阅读
  3. A Decade’s Battle on Dataset Bias: Are We There Yet

    2024-03-18 07:30:02       18 阅读
  4. Llama 2: 深入探讨ChatGPT的开源挑战者

    2024-03-18 07:30:02       21 阅读
  5. Spring Cloud - Eureka版-学习理解

    2024-03-18 07:30:02       16 阅读
  6. vue2和vue3的区别

    2024-03-18 07:30:02       18 阅读
  7. SpringMVC总结二

    2024-03-18 07:30:02       21 阅读
  8. 计算机等级考试:信息安全技术 知识点十二

    2024-03-18 07:30:02       19 阅读