Code Monkey home page Code Monkey logo

deeround / jdbc-plus Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 2.0 171 KB

🚀 jdbc-plus是一款基于JdbcTemplate增强工具包,基于JdbcTemplate已实现分页、多租户、动态表名等插件,可与mybatis、mybatis-plus等混合使用,还可以十分简单的扩展自定义插件

Home Page: https://github.com/deeround/jdbc-plus

License: MIT License

Java 100.00%
jdbc jdbc-plus jdbctemplate multi-tenant mybatis mybatis-plus pagehelper springboot

jdbc-plus's People

Contributors

deeround avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zhangji261

jdbc-plus's Issues

分页问题

sql 语句 select count(*) from t_user where username=? and age=?

//查询汇总
if (localPage.isCount()) {
Object cnt = jdbcTemplate.queryForMap(dialect.getCountSql(sql)).get("PG_COUNT");
localPage.setTotal(Long.parseLong(cnt.toString()));
}

上面代码 是不是不能处理 带有“?” 的sql 语句,可以给联系方式吗

分页问题

demo 中 给出的如下例子

    PageHelper.startPage(2, 2);
    List<Map<String, Object>> list = this.jdbcTemplate.queryForList("select * from test_user");
    //最终执行SQL:select * from test_user LIMIT 2,2
    PageInfo<Map<String, Object>> page = new PageInfo<>(list);
    //PageInfo对象包含了分页信息(总行数等)
    return page;

如果返回的是
List bean=jdbcTemplate.query(sql, new BeanPropertyRowMapper<(XXX.class),object...args);

//查询汇总
if (localPage.isCount()) {
Object cnt = jdbcTemplate.queryForMap(dialect.getCountSql(sql), methodInfo.getParameters()).get("PG_COUNT");
localPage.setTotal(Long.parseLong(cnt.toString()));
}

methodInfo.getParameters() 返回是null 程序直接报错

请作者慎重考虑各种常用情况。

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.