Giter Club home page Giter Club logo

sql server 分页的时候查询语句有排序字段会出现 除非另外还指定了 TOP、OFFSET 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。 about mybatis-plus HOT 2 CLOSED

cng1985 avatar cng1985 commented on September 28, 2024
sql server 分页的时候查询语句有排序字段会出现 除非另外还指定了 TOP、OFFSET 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。

from mybatis-plus.

Comments (2)

cng1985 avatar cng1985 commented on September 28, 2024

`
public class SqlPaginationInnerInterceptor extends PaginationInnerInterceptor {

public SqlPaginationInnerInterceptor(DbType dbType) {
    super(dbType);
}

@Override
protected String lowLevelCountSql(String originalSql) {
    int index = originalSql.indexOf("order");
    if (index > 0) {
        String sql = originalSql.substring(0, index);
        return super.lowLevelCountSql(sql);
    }
    return super.lowLevelCountSql(originalSql);
}

}

`

折中办法

from mybatis-plus.

nieqiurong avatar nieqiurong commented on September 28, 2024

用格式提供完整的sql,

SELECT model.DM AS id,

FROM V_CUSTOMER model
LEFT JOIN v_vipset v(nolock) ON model.dm=v.gkdm
LEFT JOIN kehu(nolock) ON model.ckdm=kehu.khdm
LEFT JOIN dianyuan AS d(nolock) ON v.JSDY=d.dydm
WHERE 1=1
AND (model.DM like '%LD00000081%'
OR model.GKMC like '%LD00000081%'
OR model.SJ like '%LD00000081%')
ORDER BY v.xfje ASC

如果你的原始sql是这样的,那都无法执行,如果你后面还有些字段什么的,请提供解析错误的日志。

from mybatis-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.