mybatis SQL 根据in条件语句排序

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>
    );
posted @ 2021-06-25 16:09  倔强的老铁  阅读(272)  评论(0编辑  收藏  举报