"<script>
select from car where 1=1
<if test=\"key!=null and key!=''\"> and car.name like CONCAT('%',#{key},'%')</if>
</script>"
这里注意判断为空和concat的使用,这样可以显著减少代码当中的if判断语句
"<script>
select from car where 1=1
<if test=\"key!=null and key!=''\"> and car.name like CONCAT('%',#{key},'%')</if>
</script>"
这里注意判断为空和concat的使用,这样可以显著减少代码当中的if判断语句