x_mario 2017-06-22 05:23 采纳率: 40%
浏览 6439

mybatis动态sql后面会自动拼接一个order by

我的mapper里编了一个这个sql,但是我发现执行的时候总是会跟一个order by createTime desc,但是没有指定哪个表,总是报错,也不知道是哪里配置的。我自己在sql中的if里加
order by a.createTime desc 也不好使


 select 
            a.*,
            b.*
        FROM 
            pfzf_organization a 
        LEFT JOIN organizationType b ON a.organizationTypeId = b.organizationTypeId
            <where>
                and 1 = 1
                <if test="organizationTypeId!=null and organizationTypeId!=''">
                and organizationTypeId =#{organizationTypeId}
                </if>
            </where>


 select * from ( select tmp_page.*, rownum row_id from ( SELECT a.*, b.* FROM pfzf_organization a LEFT JOIN organizationType b ON a.organizationTypeId = b.organizationTypeId WHERE 1 = 1 order by createTime desc ) tmp_page where rownum <= ? ) where row_id > ?

去哪能改掉?

  • 写回答

4条回答 默认 最新

  • 摆码王子 2017-06-22 05:33
    关注

    没有的话应该不会自己加上去的吧

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog