为简化代码 在分组等操作时直接将条件当参数传入时,若使用#{} 接收 SQL会将#{}内容直接当作字符串处理。此时应使用${} 接收参数
<sql id="whereBill">
<where>
<if test="params != null">
<if test="params.orderNum != null and params.orderNum != ''">
and order_num = #{params.orderNum}
</if>
</if>
</where>
<if test="params != null">
<if test="params.groupBy != null and params.groupBy != ''">
GROUP BY ${params.groupBy}
</if>
</if>
</sql>