diff --git a/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java b/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java index 4ac597f2..46bd1aaa 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java +++ b/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java @@ -75,4 +75,20 @@ public class TourismController { boolean result = tourismService.removeById(tourism); return result ? Result.succeed(tourism, "操作成功") : Result.failed("操作失败"); } + + /** + * 获取景区设备列表 + * 通过景区下的二维码信息查询二维码绑定的设备 + */ + @Operation(summary = "获取景区设备列表") + @GetMapping("/{tourismId}/devices") + public Result getTourismDevices(@PathVariable("tourismId") Long tourismId) { + try { + var devices = tourismService.getDevicesByTourismId(tourismId); + return Result.succeed(devices, "获取景区设备列表成功"); + } catch (Exception e) { + log.error("获取景区设备列表失败", e); + return Result.failed("获取景区设备列表失败:" + e.getMessage()); + } + } } diff --git a/zlt-business/order-center/src/main/java/com/central/order/mapper/TourismMapper.java b/zlt-business/order-center/src/main/java/com/central/order/mapper/TourismMapper.java index a49b5690..914cc42a 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/mapper/TourismMapper.java +++ b/zlt-business/order-center/src/main/java/com/central/order/mapper/TourismMapper.java @@ -32,4 +32,12 @@ public interface TourismMapper extends SuperMapper { // ID查询 Tourism getTourismById(@Param("id") Long id); + /** + * 获取景区设备列表 + * 通过景区下的二维码信息查询二维码绑定的设备 + * @param tourismId 景区ID + * @return 设备列表 + */ + List> getDevicesByTourismId(@Param("tourismId") Long tourismId); + } diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java b/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java index d63fc9d3..4ba8ebb2 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java @@ -35,5 +35,13 @@ public interface ITourismService extends ISuperService { * @return */ Tourism getTourismById(Long id); + + /** + * 获取景区设备列表 + * 通过景区下的二维码信息查询二维码绑定的设备 + * @param tourismId 景区ID + * @return 设备列表 + */ + java.util.List> getDevicesByTourismId(Long tourismId); } diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java index 982ebcaf..345ad3f7 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java @@ -47,4 +47,9 @@ public class TourismServiceImpl extends SuperServiceImpl return baseMapper.getTourismById(id); } + @Override + public List> getDevicesByTourismId(Long tourismId) { + return baseMapper.getDevicesByTourismId(tourismId); + } + } diff --git a/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml b/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml index 43ee01eb..06356e3d 100644 --- a/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml +++ b/zlt-business/order-center/src/main/resources/mapper/TourismMapper.xml @@ -17,4 +17,23 @@ INSERT INTO tourisms (tourism_no, tourism_name, tourism_address,tourism_phone) VALUES (#{tourismNo}, #{tourismName}, #{tourismAddress},#{tourismPhone}) + + +