1:模糊查询sql注入
1 <if test="changeObj != null" > 2 AND change_obj like '%${changeObj}%' 3 </if>
2:日期时间段查询
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:遍历
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>