Giter VIP home page Giter VIP logo

Comments (12)

abel533 avatar abel533 commented on September 4, 2024

这个错只有 foreach 会出现,你分页用的什么版本?

from book.

460541922github avatar 460541922github commented on September 4, 2024
if(page.getAutoCount() == 0) {
                    queryArgs[0] = this.clone(ms, ms.getBoundSql(parameterObject), page);
                }

                Future listFuture1 = this.call(new Callable() {
                    public List call() throws Exception {
                        return (List)invocation.proceed();
                    }
                }, this.asyncCount);
                page.setResult((List)listFuture1.get());
                if(page.getAutoCount() == 0) {
                    Callable countTask = new Callable() {
                        public Object call() throws Exception {
                            Configuration configuration = ms.getConfiguration();
                            String countSql = PageLimitInterceptor.this.dialect.getCountSql(boundSql.getSql());
                            if(PageLimitInterceptor.logger.isDebugEnabled()) {
                                PageLimitInterceptor.logger.debug("生成count语句: " + countSql);
                            }

                            PreparedStatement countStmt = executor.getTransaction().getConnection().prepareStatement(countSql);
                            BoundSql countBS = PageLimitInterceptor.this.dialect.getBoundSql(configuration, countSql, boundSql);
                            PageLimitInterceptor.this.setParameters(countStmt, configuration, countBS, parameterObject);
                            ResultSet rs = countStmt.executeQuery();
                            long count = 0L;
                            if(rs.next()) {
                                count = rs.getLong(1);
                            }

                            rs.close();
                            countStmt.close();
                            return Long.valueOf(count);
                        }
                    };
                    Future countFuture = this.call(countTask, this.asyncCount);
                    page.setTotalCount(((Long)countFuture.get()).longValue());
                }

                return listFuture1.get();

问题就在这里,你所说的分页版本我暂时不清楚,mybatis 是3.4.1 的,拦截器是自己写的,没有用第三方的

from book.

abel533 avatar abel533 commented on September 4, 2024

分页插件的版本?

from book.

abel533 avatar abel533 commented on September 4, 2024

不用提供版本了,这个插件不是我写的,有这个问题很正常。。

我写的分页插件地址:https://github.com/pagehelper/Mybatis-PageHelper

from book.

460541922github avatar 460541922github commented on September 4, 2024

是的

from book.

460541922github avatar 460541922github commented on September 4, 2024

请问我这个啥原因么,我想知道

from book.

abel533 avatar abel533 commented on September 4, 2024

没有处理foreach生成的动态参数。

from book.

460541922github avatar 460541922github commented on September 4, 2024

是mybatis的问题 还是我的拦截器的问题?这个是我之前网上找的!另外处理foreach生成的动态参数的代码能告诉我位置么

from book.

abel533 avatar abel533 commented on September 4, 2024

拦截器的问题

from book.

460541922github avatar 460541922github commented on September 4, 2024

请教你另外一个问题,前天下载了一个阿里的开发人员注意手册,里面说到update同一个表的的同一条记录时候更新的字段的数目多少影响效率,和我自己理解的就不一样(应该是和数目没关系),update实际做的就是delete 和insert

from book.

abel533 avatar abel533 commented on September 4, 2024

这个问题只有大量测试才能看出来效果,不清楚数据库底层如何实现的update。

from book.

460541922github avatar 460541922github commented on September 4, 2024

哦哦,谢谢了哈

from book.

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.