zoukankan      html  css  js  c++  java
  • 查询

    1,通过id查询

      userMapper.selectById();

    2,同时查询多个id数据

      for (User id : userMapper.selectBatchIds(Arrays.asList(1L, 2L, 3L))) {
        System.out.println(id);
      }

    3,分页查询

      1,添加插件

        @Bean
        public PaginationInterceptor paginationInterceptor() {
            return new PaginationInterceptor();
        }

      2,编写分页代码

        直接new page对象,传入两个参数:当前页数和每页显示的条数;

      3,调用mp方法实现分页查询;

        @Test
        void selectByPage() {
            Page<User> page = new Page<>(1,2);
            IPage<User> userIPage = userMapper.selectPage(page, null);
            System.out.println("分页 :"+userIPage);
            long current = userIPage.getCurrent();
            System.out.println("current : "+current);
        }
  • 相关阅读:
    Javascript事件处理进阶
    Restful API设计指南
    Git&GitHub
    Linux补充
    堡垒机
    Python发送邮件
    js获取当前页面url网址信息
    高并发的秒杀系统
    CMDB开发
    Tornado
  • 原文地址:https://www.cnblogs.com/NBG-SDL/p/14608725.html
Copyright © 2011-2022 走看看