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>