feat: 增加分页查询监测设备

dev
huangfeng 1 year ago
parent 2197c2cb71
commit ceb44477ce

@ -12,7 +12,9 @@ import com.xydl.cac.service.ParamBindService;
import com.xydl.cac.service.ReportService; import com.xydl.cac.service.ReportService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -53,12 +55,22 @@ public class NSensorController extends BasicController {
} }
@GetMapping("listAll") @GetMapping("listAll")
@ApiOperation("查询列表") @ApiOperation("查询全部")
public Response<List<NSensor>> listAll(@Param("zsbid") Integer zsbid) throws Exception { public Response<List<NSensor>> listAll(@ApiParam("主设备id") @RequestParam(value = "zsbid", required = false) Integer zsbid) throws Exception {
List<NSensor> result = service.listAll(zsbid); List<NSensor> result = service.listAll(zsbid);
return Response.success(result); return Response.success(result);
} }
@GetMapping("list")
@ApiOperation("查询列表")
public Response<Page<NSensor>> list(@ApiParam("页码") @RequestParam(value = "pageNum", required = false) Integer pageNum,
@ApiParam("每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
pageNum = this.initPageNum(pageNum);
pageSize = this.initPageSize(pageSize);
Page<NSensor> result = service.list(pageNum, pageSize);
return Response.success(result);
}
@PostMapping("add") @PostMapping("add")
@ApiOperation("新增") @ApiOperation("新增")
public Response<NSensor> add(@Validated @RequestBody NSensor item) throws Exception { public Response<NSensor> add(@Validated @RequestBody NSensor item) throws Exception {

Loading…
Cancel
Save