| package com.wzy.serviceedu.controller;

    import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
    import com.wzy.commonutils.R;
    import com.wzy.serviceedu.entity.EduTeacher;
    import com.wzy.serviceedu.service.EduTeacherService;
    import io.swagger.annotations.Api;
    import io.swagger.annotations.ApiOperation;
    import io.swagger.annotations.ApiParam;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;

    import java.util.List;

    /


    讲师 前端控制器



    *
    @author wzy
    *
    @since 2021-09-10
    */
    @Api(description=
    “讲师管理”)
    @RestController
    @RequestMapping(
    “/serviceedu/teacher”)
    public class **EduTeacherController {

    1. @Autowired<br /> **private **EduTeacherService **eduTeacherService**;
    2. /*<br /> * @Description: 分页查询<br /> * @Author: WangZiYao<br /> * @Date: 2021/9/10 16:24<br /> */<br /> @GetMapping(value = **"/pageTeacher/{current}/{limit}"**)<br /> **public **R pageListTeacher(@ApiParam(name = **"current"**, value = **"当前页码"**, required = **true**)<br /> @PathVariable Long current,<br /> @ApiParam(name = **"limit"**, value = **"每页记录数"**, required = **true**)<br /> @PathVariable Long limit){<br /> Page<EduTeacher> pageTeacher = **new **Page<>(current,limit);<br /> //调用 page() 方法时候,底层封装,把分页所有数据封装到 pageTeacher<br /> **eduTeacherService**.page(pageTeacher, **null**);
    3. **long **total = pageTeacher.getTotal();//总记录数<br /> List<EduTeacher> records = pageTeacher.getRecords();//数据的list集合<br /> **return **R.ok().data(**"total"**,total).data(**"rows"**,records);<br /> }<br />} |

    | —- |

    swagger测试:
    image.png