动态sql的几个踩坑点:
- 判断条件为数字时应为==,少打一个=,应该为:
<when test="sort == 0 ">
order by goods_sales desc
</when>
若只打了=,编译可以通过,但是条件判断返回值一定是为true
- 判断条件为String类型时,应该为:
<when test="sort == 'aa' ">
order by goods_sales desc
</when>
引文:https://www.jianshu.com/p/9fab369b3959