From 402c5f2e1b5376ecaa2fc7bf8f02ad0f0452a6f6 Mon Sep 17 00:00:00 2001 From: jjLv <1981429112@qq.com> Date: Thu, 8 May 2025 15:43:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DoubleScreenMachineController.java | 9 ++++--- .../mapper/DoubleScreenMachineMapper.java | 21 ++++++++++------ .../impl/DoubleScreenMachineServiceImpl.java | 12 +++++----- .../device/DoubleScreenMachineMapper.xml | 24 +++++++++++++++++++ 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DoubleScreenMachineController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DoubleScreenMachineController.java index c632a9a..ef48166 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DoubleScreenMachineController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/DoubleScreenMachineController.java @@ -13,6 +13,7 @@ import com.bonus.canteen.core.alloc.mapper.AllocStallMapper; import com.bonus.canteen.core.device.dto.DeviceDTO; import com.bonus.canteen.core.device.dto.DeviceSearchDTO; import com.bonus.canteen.core.device.service.IDoubleScreenMachineService; +import com.bonus.canteen.core.device.vo.DeviceFullInfoVO; import com.bonus.common.core.exception.ServiceException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -42,8 +43,8 @@ public class DoubleScreenMachineController extends BaseController { value = "分页查询设备信息", notes = "page:分页信息,object:canteenId:食堂ID, stallId:店铺档口id, deviceState:1在线2离线, " ) - @PostMapping({"/getDoubleScreenMachineList"}) - public TableDataInfo getDoubleScreenMachineList(@RequestBody DeviceSearchDTO dto) { + @GetMapping({"/getDoubleScreenMachineList"}) + public TableDataInfo getDoubleScreenMachineList(DeviceSearchDTO dto) { List canteenIds; List stallIds; if (ObjectUtil.isNotEmpty(dto.getAreaId()) && ObjectUtil.isEmpty(dto.getCanteenId())) { @@ -69,7 +70,9 @@ public class DoubleScreenMachineController extends BaseController { return getDataTable(new ArrayList<>()); } } - return getDataTable(screenMachineService.getDoubleScreenMachineList(dto)); + startPage(); + List list = screenMachineService.getDoubleScreenMachineList(dto); + return getDataTable(list); } @ApiOperation( diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DoubleScreenMachineMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DoubleScreenMachineMapper.java index 0370a82..4b2aaae 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DoubleScreenMachineMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/DoubleScreenMachineMapper.java @@ -28,13 +28,7 @@ public interface DoubleScreenMachineMapper { int insertMachine(DeviceDTO dto); int insertMachineBind(DeviceDTO dto); - /** - * 校验设备sn、名称、编号是否已存在 - * - * @param keyWord 设备编号/设备名称/设备sn码 - * @return 结果 - */ - int checkIsExist(@Param("keyWord") String keyWord, @Param("deviceId") String deviceId); + /** * 删除设备绑定多档口子信息 * @@ -74,4 +68,17 @@ public interface DoubleScreenMachineMapper { int insertDeviceRecipe(DeviceDTO dto); int updateDeviceRecipe(DeviceDTO dto); + /** + * 校验设备sn、名称、编号是否已存在 + * + * @param keyWord 设备编号/设备名称/设备sn码 + * @return 结果 + */ + int checkIsExist(@Param("keyWord") String keyWord, @Param("deviceId") String deviceId); + + int checkIsExistDeviceNum(@Param("deviceNum") @NotBlank(message = "设备编号必填") String deviceNum,@Param("deviceId") String deviceId); + + int checkIsExistDeviceName(@Param("deviceName") @NotBlank(message = "设备名称必填") String deviceName,@Param("deviceId") String deviceId); + + int checkIsExistDeviceSn(@Param("deviceSn") @NotBlank(message = "设备sn码必填") String deviceSn,@Param("deviceId") String deviceId); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DoubleScreenMachineServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DoubleScreenMachineServiceImpl.java index 41bb1ba..9eb3aab 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DoubleScreenMachineServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/DoubleScreenMachineServiceImpl.java @@ -59,15 +59,15 @@ public class DoubleScreenMachineServiceImpl implements IDoubleScreenMachineServi dto.setTenantId(GlobalConstants.TENANT_ID); dto.setCreateBy(String.valueOf(SecurityUtils.getUserId())); //判断设备sn、设备编号、设备名称是否存在 - int count = mapper.checkIsExist(dto.getDeviceNum(),null); + int count = mapper.checkIsExistDeviceNum(dto.getDeviceNum(),null); if (count > 0){ throw new RuntimeException("设备编号已存在"); } - count = mapper.checkIsExist(dto.getDeviceName(),null); + count = mapper.checkIsExistDeviceName(dto.getDeviceName(),null); if (count > 0){ throw new RuntimeException("设备名称已存在"); } - count = mapper.checkIsExist(dto.getDeviceSn(),null); + count = mapper.checkIsExistDeviceSn(dto.getDeviceSn(),null); if (count > 0){ throw new RuntimeException("设备sn已存在"); } @@ -105,15 +105,15 @@ public class DoubleScreenMachineServiceImpl implements IDoubleScreenMachineServi throw new RuntimeException("请先讲填写所有必填项,再提交相关数据!"); } //判断设备sn、设备编号、设备名称是否存在 - int count = mapper.checkIsExist(dto.getDeviceNum(), dto.getDeviceId()); + int count = mapper.checkIsExistDeviceNum(dto.getDeviceNum(), dto.getDeviceId()); if (count > 0){ throw new RuntimeException("设备编号已存在"); } - count = mapper.checkIsExist(dto.getDeviceName(), dto.getDeviceId()); + count = mapper.checkIsExistDeviceName(dto.getDeviceName(), dto.getDeviceId()); if (count > 0){ throw new RuntimeException("设备名称已存在"); } - count = mapper.checkIsExist(dto.getDeviceSn(), dto.getDeviceId()); + count = mapper.checkIsExistDeviceSn(dto.getDeviceSn(), dto.getDeviceId()); if (count > 0){ throw new RuntimeException("设备sn已存在"); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml index 3dd0fd7..fe08430 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml @@ -156,6 +156,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + insert into device_recipe(id,device_id, canteen_id,stall_id,