mybatis使用order by注意
直接用动态参数生成,不会排序:
<if test="orderColumn!=null and orderColumn != ''">
ORDER BY #{orderColumn} #{orderDir}
</if>
需要将#改为$:
<if test="orderColumn!=null and orderColumn != ''">
ORDER BY ${orderColumn} ${orderDir}
</if>
直接用动态参数生成,不会排序:
<if test="orderColumn!=null and orderColumn != ''">
ORDER BY #{orderColumn} #{orderDir}
</if>
需要将#改为$:
<if test="orderColumn!=null and orderColumn != ''">
ORDER BY ${orderColumn} ${orderDir}
</if>