springboot idea插件pagehelper

其他地方无需修改

html文件

 <table>
       <thead>
        <tr>           
            <th>ID</th>
            <th>房间编号</th>
            <th>房间面积</th>
            <th>备注</th>
            <th>所属楼栋</th>
            <th>是否可用</th>
            <th>操作</th>
        </tr>
       </thead>
        <tbody>
            <tr th:each="room:${roomList.list}">
            <td th:text="${room.roid}"></td>
            <td th:text="${room.ronum}"></td>
            <td th:text="${room.roarea}"></td>
            <td th:text="${room.roremark}"></td>
            <td th:text="${room.robid.bnum}"></td>
            <td th:text="${room.roflag}"></td>
          
            </tr>
        </tbody>
    </table>
    <td><a th:href="@{/allRoom(pageNo=${roomList.firstPage})}">第一页</a></td>
    <td th:if="${roomList.hasPreviousPage}">
        <td><a th:href="@{/allRoom(pageNo=${roomList.pageNum-1})}">上一页</a></td>
    </td>

    <td th:if="${roomList.hasNextPage}">
        <td><a th:href="@{/allRoom(pageNo=${roomList.pageNum+1})}">下一页</a></td>
    </td>

    <td><a th:href="@{/allRoom(pageNo=${roomList.lastPage})}">最后页</a></td>

 controller类

@RequestMapping("allRoom")
    public String allRoom(Model model,@RequestParam(defaultValue="1",required=true,value="pageNo") Integer pageNo){
        Integer pageSize=5;//每页显示记录数
        //分页查询
        PageHelper.startPage(pageNo, pageSize);
        List<RoomEntity> allRoom = roomService.findAllRoomService();
        PageInfo<RoomEntity> pageInfo = new PageInfo<>(allRoom);
        model.addAttribute("roomList",pageInfo);
        return "package/Room/RoomAll";
    }

ps: 添加的时候可能会出现空数据,需要重新写分页的地方

个人使用,仅记录,有错误望指出。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值