| | |
| | | import com.sandu.ximon.admin.service.IpVolumeService; |
| | | import com.sandu.ximon.admin.service.MonitorService; |
| | | import com.sandu.ximon.admin.service.PoleService; |
| | | import com.sandu.ximon.admin.vo.PoleBindVO; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import com.sandu.ximon.dao.enums.PoleBindingEnums; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return ResponseUtil.success(poleService.deletePole(poleId)); |
| | | } |
| | | |
| | | @PostMapping("/listDetail") |
| | | public ResponseVO<Object> listPoleDetail(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) { |
| | | if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param); |
| | | |
| | | List<PoleBindVO> listResult = new ArrayList<>(); |
| | | for (Pole pole : results) { |
| | | PoleBindVO bindByPoleId = poleService.getBindByPoleId(pole.getId()); |
| | | bindByPoleId.setPole(pole); |
| | | listResult.add(bindByPoleId); |
| | | } |
| | | |
| | | CommonPage commonPage = CommonPage.restPage(listResult); |
| | | int size = results.size(); |
| | | commonPage.setTotal((long) size); |
| | | commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1); |
| | | if (size % baseConditionVO.getPageSize() == 0) { |
| | | commonPage.setTotalPage(size / baseConditionVO.getPageSize()); |
| | | } |
| | | return ResponseUtil.success(commonPage); |
| | | } |
| | | |
| | | @PostMapping("/list") |
| | | public ResponseVO<Object> listPole(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) { |
| | | if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) { |
| | |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param); |
| | | |
| | | CommonPage commonPage = CommonPage.restPage(results); |
| | | int size = results.size(); |
| | | commonPage.setTotal((long) size); |
| | |
| | | commonPage.setTotalPage(size / baseConditionVO.getPageSize()); |
| | | } |
| | | return ResponseUtil.success(commonPage); |
| | | // return ResponseUtil.success(poles); |
| | | } |
| | | |
| | | @GetMapping("/listPoleAndState") |