用到的关键字:field order by field 比如项目中存在的例子: 例如: select software_id from software where status=1 and cd_client_flag=20 and software_code in <foreach item = "code" collection="codeList" separator="," open="(" close=")"> #{code} </foreach> order by field (software_code, <foreach item = "code" collection="codeList" separator=","> #{code} </foreach>)