mybatis SQL 根据in条件语句排序
时间:2021-06-28 17:36:49
收藏:0
阅读:0
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>
);
评论(0)