Kaynağa Gözat

查询停靠点、巡检点列表

shiwn 3 ay önce
ebeveyn
işleme
f53fd366fd

+ 16 - 4
src/main/java/com/sw/patroleditor/controller/LocationController.java

@@ -1,5 +1,6 @@
 package com.sw.patroleditor.controller;
 
+import com.github.pagehelper.PageInfo;
 import com.sw.patroleditor.common.ResultData;
 import com.sw.patroleditor.domain.vo.PointVO;
 import com.sw.patroleditor.domain.vo.TargetVO;
@@ -7,10 +8,7 @@ import com.sw.patroleditor.exception.ErrorCode;
 import com.sw.patroleditor.service.LocationService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 
@@ -67,4 +65,18 @@ public class LocationController {
             return ResultData.fail(ErrorCode.FAIL);
         }
     }
+
+    @ApiOperation(value = "查询停靠点列表")
+    @GetMapping("/getPointList")
+    public ResultData<PageInfo> getPointList(Integer pageNum, Integer pageSize) {
+        PageInfo list = locationService.getPointList(pageNum, pageSize);
+        return ResultData.success(list);
+    }
+
+    @ApiOperation(value = "查询巡检点列表")
+    @GetMapping("/getTargetList")
+    public ResultData<PageInfo> getTargetList(Integer pageNum, Integer pageSize, Integer pointId) {
+        PageInfo list = locationService.getTargetList(pageNum, pageSize, pointId);
+        return ResultData.success(list);
+    }
 }

+ 12 - 0
src/main/java/com/sw/patroleditor/mapper/PointMapper.java

@@ -2,9 +2,21 @@ package com.sw.patroleditor.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sw.patroleditor.domain.dto.PointDTO;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 @Component
 public interface PointMapper extends BaseMapper<PointDTO> {
+    /**
+     * @Description: 查询停靠点list
+     * @Date: 2024/8/19 17:36
+     * @Author: shiwn
+     * @Param: :
+     * @Return:
+     */
+    @Select("select * from point order by id")
+    List<PointDTO> getList();
 
 }

+ 12 - 1
src/main/java/com/sw/patroleditor/mapper/TargetMapper.java

@@ -2,9 +2,20 @@ package com.sw.patroleditor.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sw.patroleditor.domain.dto.TargetDTO;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 @Component
 public interface TargetMapper extends BaseMapper<TargetDTO> {
-
+    /**
+     * @Description: 查询巡检点list
+     * @Date: 2024/8/19 17:36
+     * @Author: shiwn
+     * @Param: :
+     * @Return:
+     */
+    @Select("select * from target where point_id =#{pointId} order by id")
+    List<TargetDTO> getList(Integer pointId);
 }

+ 5 - 0
src/main/java/com/sw/patroleditor/service/LocationService.java

@@ -1,5 +1,6 @@
 package com.sw.patroleditor.service;
 
+import com.github.pagehelper.PageInfo;
 import com.sw.patroleditor.domain.vo.PointVO;
 import com.sw.patroleditor.domain.vo.TargetVO;
 
@@ -14,4 +15,8 @@ public interface LocationService {
     int deletePoint(Integer pointId);
 
     int deleteTarget(Long targetId);
+
+    PageInfo getPointList(Integer pageNum, Integer pageSize);
+
+    PageInfo getTargetList(Integer pageNum, Integer pageSize, Integer pointId);
 }

+ 42 - 0
src/main/java/com/sw/patroleditor/service/impl/LocationServiceImpl.java

@@ -1,5 +1,8 @@
 package com.sw.patroleditor.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.sw.patroleditor.component.rosBridge.RobotDataCallBack;
 import com.sw.patroleditor.component.rosBridge.RobotDataModel;
 import com.sw.patroleditor.domain.dto.AimDTO;
@@ -19,6 +22,8 @@ import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 /**
@@ -149,4 +154,41 @@ public class LocationServiceImpl implements LocationService {
             return 0;
         }
     }
+
+    /**
+     * @Description: 查询停靠点列表
+     * @Date: 2024/8/19 17:31
+     * @Author: shiwn
+     * @Param: pageNum:
+     * @Param: pageSize:
+     * @Return:
+     */
+    @Override
+    public PageInfo getPointList(Integer pageNum, Integer pageSize) {
+        pageNum = pageNum == null ? 1 : pageNum;
+        pageSize = pageSize == null ? 20 : pageSize;
+        PageHelper.startPage(pageNum, pageSize);
+        List<PointDTO> list = pointMapper.getList();
+        PageInfo<PointDTO> pageInfo = new PageInfo<>(list);
+        return pageInfo;
+    }
+
+    /**
+     * @Description: 查询巡检点列表
+     * @Date: 2024/8/19 17:37
+     * @Author: shiwn
+     * @Param: pageNum:
+     * @Param: pageSize:
+     * @Param: pointId:
+     * @Return:
+     */
+    @Override
+    public PageInfo getTargetList(Integer pageNum, Integer pageSize, Integer pointId) {
+        pageNum = pageNum == null ? 1 : pageNum;
+        pageSize = pageSize == null ? 20 : pageSize;
+        PageHelper.startPage(pageNum, pageSize);
+        List<TargetDTO> list = targetMapper.getList(pointId);
+        PageInfo<TargetDTO> pageInfo = new PageInfo<>(list);
+        return pageInfo;
+    }
 }