1. 程式人生 > >mybatis ORDER BY排序問題

mybatis ORDER BY排序問題

<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from tb_user
    where yhbhid = #{yhbhid,jdbcType=INTEGER}
	ORDER BY ${'yhbhid '} DESC
  </select>

注意:用order by 排序時  要用“$”符,不能使用“#”,不解釋為什麼,百度有很多可以查

           “{}”裡的變數一定要用單引號 '' 包起來(${'yhbhid '}

DESC:降序

ASC:升序