版权声明:feixie https://blog.csdn.net/qq_36850813/article/details/84320300
MySQL中的field()函数,可以用来对SQL中查询结果集进行指定顺序排序。
str与str1,str2,str3,str4比较,其中str指的是字段名字
意为:字段str按照字符串str1,str2,str3,str4的顺序返回查询到的结果集。如果表中str字段值不存在于str1,str2,str3,str4中的记录,放在结果集最前面返回。
<select id="selectMapByBizIds" resultType="java.util.Map">
select mch.name,mch.bizMchId appId,mch.mch_logo,mch.redirect_url,mch.type,mch.require_user_auth,bmap.mchId merchantId
from agency_biz_mch mch inner join agency_merchant_map_bizmch bmap on mch.bizMchId=bmap.bizMchId
where mch.status=1 and mch.bizMchId in (${bizIds})
order by field (mch.bizMchId,${bizIds})
</select>