mybatis中使用order by 排序
如果编码格式为utf-8型,并且需要为中文字段排序, 那么可以使用如下代码
<select id="selectGoodsManageList" parameterType="GoodsManage" resultMap="GoodsManageResult">
<include refid="selectGoodsManageVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<!-- <if test="shopId != null "> and shop_id = #{shopId}</if>-->
<if test="goodType != null and goodType != ''"> and good_type = #{goodType}</if>
<if test="state != null "> and state = #{state}</if>
</where>
// 这个里name为数据库字段名,可以直接使用
order by CONVERT( name USING gbk ) COLLATE gbk_chinese_ci ASC
</select>