ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -208,11 +208,19 @@ /** * 查找自己拥有的灯杆 */ @PostMapping("/getOwnerPole") public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { //public ResponseVO<Object> setMac() { return ResponseUtil.success(poleService.getOwnerPole(baseConditionVO,keyword)); // return ResponseUtil.success(poleService.setMac()); @PostMapping("/getOwnerPole/{cilentId}") public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword ,@PathVariable Long cilentId) { List<Pole> results = poleService.getOwnerPole(baseConditionVO, keyword, cilentId); // CommonPage commonPage = CommonPage.restPage(results); // 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); return ResponseUtil.success(results); } ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java
@@ -177,6 +177,23 @@ } /** * \ * 其他类用来查找客户id使用 如果没有上级客户 这返回用户ID * * @param * @return */ public Long getClientId(Long userId) { Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId)); if (one != null && one.getSuperiorId() != null) { return one.getSuperiorId(); } else { return userId; } } /** * 一级客户返回false 二级客户返回true * * @return @@ -191,4 +208,18 @@ } } /** * 一级客户返回false 二级客户返回true * * @return */ public boolean findClientId(Long userId) { Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId)); if (one != null && one.getSuperiorId() != null) { return true; } else { return false; } } } ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -653,20 +653,27 @@ } public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword) { public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword,Long cilentId) { LambdaQueryWrapper<Pole> eq; if(SecurityUtils.getClientId()!=null){ // if(SecurityUtils.getClientId()!=null){ PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); if(clientService.findClientId()){ eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, SecurityUtils.getUserId()); if(clientService.findClientId(cilentId)){ eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, cilentId); }else{ eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, SecurityUtils.getUserId()); PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId) .or( pole->{ pole.eq(Pole::getUserId, cilentId); } ); } }else { PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); eq = Wrappers.lambdaQuery(Pole.class); } // }else { // PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); // eq = Wrappers.lambdaQuery(Pole.class); // } PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); if (!keyword.isEmpty()){ eq.like(Pole::getPoleName,keyword).or( code->{