1:模糊查询sql注入
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 <if test="changeObj != null" > 2 AND change_obj like '%${changeObj}%' 3 </if>
2:日期时间段查询
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 <if test="startDate != null"> 2 and #{startDate} <![CDATA[ <= ]]> create_date 3 </if> 4 5 <if test="endDate != null"> 6 and create_date <![CDATA[ <= ]]> #{endDate } 7 </if>
3:遍历
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 <delete id="delByTableIds" parameterType="java.util.List"> 2 DELETE FROM meta_log WHERE table_id IN 3 ( 4 <foreach collection="list" item="item" index="index" separator="," > 5 #{item.tableId,jdbcType=INTEGER} 6 </foreach> 7 ) 8 </delete>