//方法一
SELECT * FROM tablename WHERE id IN(2,3,1) ORDER BY INSTR(',"2,3,1",',CONCAT(',',id,','));
//方法二
SELECT * FROM tablename WHERE id IN(2,3,1) ORDER BY FIND_IN_SET(id,"2,3,1");
//方法三
SELECT * FROM tablename WHERE id IN (2,3,1) ORDER BY FIELD(id,"2,3,1");