我的表,通过product_price来排序,规则传入
mapper接口List<Product> selectProductByOrder(@Param("order") String order);
mapper配置<select id="selectProductByOrder" parameterType="string" resultType="cn.ccl.entity.Product"> select * from shop_tb order by product_price ${order} </select>
要用$符,并且接口里要加注解
如果不加注解会报错Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'order' in 'class java.lang.String'
转载于:https://my.oschina.net/u/4110234/blog/3057963