Browse Source

--增加分页

develop
mengff 11 months ago
parent
commit
3dcfb1c9a4
  1. 18
      zc-business/src/main/java/com/zc/business/controller/StatusController.java

18
zc-business/src/main/java/com/zc/business/controller/StatusController.java

@ -1,5 +1,7 @@
package com.zc.business.controller; package com.zc.business.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.zc.business.domain.Status; import com.zc.business.domain.Status;
import com.zc.business.service.impl.StatusService; import com.zc.business.service.impl.StatusService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -13,29 +15,33 @@ import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Api("设备状态")
import static com.ruoyi.common.utils.PageUtils.startPage;
@Api(tags="设备状态")
@RestController @RestController
@RequestMapping("/system/status") @RequestMapping("/system/status")
public class StatusController { public class StatusController extends BaseController {
@Autowired @Autowired
private StatusService statusService; private StatusService statusService;
//设备列表 //设备列表
@ApiOperation("设备状态柱状按时间和类型") @ApiOperation("设备状态列表按时间和类型")
@GetMapping ("/tablist") @GetMapping ("/tablist")
public AjaxResult getTabList(Status status) public TableDataInfo getTabList(Status status)
{ {
startPage();
LocalDateTime todayStart = status.getStartTime().truncatedTo(ChronoUnit.DAYS); LocalDateTime todayStart = status.getStartTime().truncatedTo(ChronoUnit.DAYS);
LocalDateTime currentTime = status.getTime().truncatedTo(ChronoUnit.DAYS).plusDays(1); LocalDateTime currentTime = status.getTime().truncatedTo(ChronoUnit.DAYS).plusDays(1);
status.setStartTime(todayStart); status.setStartTime(todayStart);
status.setTime(currentTime); status.setTime(currentTime);
List<Status> listStatus = statusService.list(status); List<Status> listStatus = statusService.list(status);
return AjaxResult.success(listStatus); return getDataTable(listStatus);
} }
//按时间划分设备柱状图 //按时间划分设备柱状图
@ApiOperation("设备状态列表按时间和类型") @ApiOperation("设备状态柱状图按时间和类型")
@GetMapping ("/list") @GetMapping ("/list")
public AjaxResult getStatusList(Status status) public AjaxResult getStatusList(Status status)
{ {

Loading…
Cancel
Save