<where>
((s.BUSINESS_SEQ ='1' OR s.BUSINESS_SEQ IS NULL) and (a.BUSINESS_SEQ='1' OR a.BUSINESS_SEQ IS NULL))
<choose>
<when test="ids != null and ids.size()>0">
<foreach collection="ids" item="id" index="index" open="AND p.id in (" close=")" separator=",">
#{id}
</foreach>
</when>
<otherwise>
AND p.id = 'jgiehggiehgiehgiegiehhghiehggiheghheuih'
</otherwise>
</choose>
<if test="ids != null ">
order by FIELD(p.id,
<foreach collection="ids" item="item" separator=",">
#{item}
</foreach>
)
</if>
</where>
//传入参数ids
<when test="ids != null and ids.size()>0">
<foreach collection="ids" item="id" index="index" open="AND p.id in (" close=")" separator=",">
#{id}
</foreach>
</when>
//按传入参数ids进行排序
ORDER BY FIELD(id,
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>