SELECT A.WBXSDDH,A.XSDDLX,B.XSFDH,B.XSZZDM,C.SKUID
FROM GMXSDD A,GMXSDDFD B,GMXSDDSP C
WHERE A.XSDDH=B.XSDDH
AND B.XSFDH=C.XSFDH
AND B.XSFDLX=0
AND B.STATUS!=-10
AND A.XQFDM='PDD'
AND A.WBXSDDH IN
<foreach collection="outerOrders" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
UNION
SELECT B.WBXSDDH,A.XSDDLX,B.XSFDH,B.XSZZDM,C.SKUID
FROM GMXSDD A,GMXSDDFD B,GMXSDDSP C
WHERE A.XSDDH=B.XSDDH
AND B.XSFDH=C.XSFDH
AND B.XSFDLX=0
AND B.STATUS!=-10
AND A.XQFDM !='PDD'
AND B.WBXSDDH IN
<foreach collection="outerOrders" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
ORDER BY field (WBXSDDH,
<foreach collection="outerOrders" item="item" separator=",">
#{item}
</foreach>
);