mybatis 中的写法
- id="selectByIds"
- resultType="com.hoohui.electronic.util.ExHashMap">
- select
- refid="Base_Column_List" />
- from doctor t where t.id in
- item="item" index="index" collection="array"
- open="(" separator="," close=")">
- #{item}
- order by field(id,
- item="item" index="index" collection="array"
- open=""separator=","close="">
- #{item}
- )
MySQL 语句的写法
SELECT * FROM `doctor` WHERE id IN(580,579,578,577,576,575,574,573,543,305,321,340,388,402,433) ORDER BY INSTR(',580,579,578,577,576,575,574,573,543,305,321,340,388,402,433,',CONCAT(',',id,','))
来源: http://www.bubuko.com/infodetail-3069305.html