码迷,mamicode.com
首页 > 数据库 > 详细

mybatis SQL 根据in条件语句排序

时间:2021-06-28 17:36:49      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:排序   条件   tor   mybatis   order by   ddl   pre   select   open   

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>
    );

mybatis SQL 根据in条件语句排序

标签:排序   条件   tor   mybatis   order by   ddl   pre   select   open   

原文地址:https://www.cnblogs.com/stubborn-dude/p/14931408.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!