| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.dto.DeviceStatus; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | | import com.sandu.ximon.admin.param.PoleParam; |
| | | import com.sandu.ximon.admin.service.PoleService; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listPole(@RequestParam String keyword) { |
| | | LambdaQueryWrapper<Pole> wrapper = Wrappers.lambdaQuery(Pole.class); |
| | | public ResponseVO<Object> listPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<Pole> wrapper = Wrappers.lambdaQuery(Pole.class).orderByDesc(Pole::getId); |
| | | if (StrUtil.isNotBlank(keyword)) { |
| | | wrapper.like(Pole::getPoleCode, keyword) |
| | | .or(lampPostLambdaQueryWrapper -> { |
| | |
| | | }); |
| | | } |
| | | List<Pole> list = poleService.list(wrapper); |
| | | return ResponseUtil.success(list); |
| | | return ResponseUtil.successPage(list); |
| | | } |
| | | |
| | | @GetMapping("listPoleAndState") |
| | | public ResponseVO<Object> listPoleAndState() { |
| | | public ResponseVO<Object> listPoleAndState(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | |
| | | return ResponseUtil.success(poleService.queryStatesAndList()); |
| | | List<Pole> poles = poleService.queryStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | return ResponseUtil.successPage(poles); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置三元码 |
| | | */ |
| | | @PostMapping("/setMac") |
| | | public ResponseVO<Object> setMac(@PathVariable Long poleId) { |
| | | return ResponseUtil.success(poleService.setMac(poleId)); |
| | | @PostMapping("/setMac/{baseMac}") |
| | | public ResponseVO<Object> setMac(@PathVariable String baseMac) { |
| | | //public ResponseVO<Object> setMac() { |
| | | return ResponseUtil.success(poleService.setMac(baseMac)); |
| | | // return ResponseUtil.success(poleService.setMac()); |
| | | } |
| | | |
| | | /** |
| | | * 恢复灯杆出厂设置 |
| | | */ |
| | | @PostMapping("/poleReset") |
| | | @PostMapping("/poleReset/{poleId}") |
| | | public ResponseVO<Object> poleReset(@PathVariable Long poleId) { |
| | | return ResponseUtil.success(poleService.poleReset(poleId)); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/listStatusByDeviceCode") |
| | | public ResponseVO<Object> getStatusById(@RequestBody String[] deviceCodeList) { |
| | | for (String s : deviceCodeList) { |
| | | if (s == null) { |
| | | return ResponseUtil.fail("参数不能为空"); |
| | | } |
| | | |
| | | } |
| | | if (ArrayUtil.isEmpty(deviceCodeList)) { |
| | | return ResponseUtil.fail("参数不能为空"); |
| | | } |
| | | List<DeviceStatus> statusList = poleService.listStatusByDeviceCode(CollectionUtil.toList(deviceCodeList)); |
| | | return ResponseUtil.success(statusList); |
| | | } |
| | | |
| | | @PostMapping("/ClientBindingPole") |
| | | public ResponseVO<Object> ClientBindingPole(@RequestBody long clientId, @RequestBody int[] poleIds) { |
| | | |
| | | return ResponseUtil.success(poleService.ClientBindingPole(clientId, poleIds));////////////// |
| | | } |
| | | |
| | | |
| | | } |