| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.page.PageDomain; |
| | | import com.ruoyi.common.core.page.TableSupport; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.domain.TDetectionCabinet; |
| | | import com.ruoyi.system.domain.vo.DiscoveredCabinetVo; |
| | | import com.ruoyi.system.service.ITDetectionCabinetService; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保留原设备选择弹窗使用的分页接口,数据来自已持久化检测柜。 |
| | | * |
| | | * @return 可供选择的检测柜分页数据 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:detectionCabinet:list')") |
| | | @GetMapping("/discovered/list") |
| | | public TableDataInfo discoveredList() |
| | | { |
| | | List<DiscoveredCabinetVo> devices = detectionCabinetService.selectDiscoveredCabinetList(); |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | int pageNum = pageDomain.getPageNum() == null || pageDomain.getPageNum() < 1 ? 1 : pageDomain.getPageNum(); |
| | | int pageSize = pageDomain.getPageSize() == null || pageDomain.getPageSize() < 1 ? 10 : pageDomain.getPageSize(); |
| | | long offset = (long) (pageNum - 1) * pageSize; |
| | | int fromIndex = (int) Math.min(offset, devices.size()); |
| | | int toIndex = (int) Math.min((long) fromIndex + pageSize, devices.size()); |
| | | List<DiscoveredCabinetVo> rows = fromIndex == toIndex |
| | | ? Collections.emptyList() |
| | | : devices.subList(fromIndex, toIndex); |
| | | TableDataInfo result = new TableDataInfo(rows, devices.size()); |
| | | result.setCode(HttpStatus.SUCCESS); |
| | | result.setMsg("查询成功"); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 查询检测柜详情。 |
| | | * |
| | | * @param cabinetId 检测柜主键 |