From 3d928674fd6448c533343820262746b91557e5d9 Mon Sep 17 00:00:00 2001 From: XMnhwj_BackTechnologyDevelopment <3512363680@qq.com> Date: Mon, 22 May 2023 15:34:42 +0800 Subject: [PATCH] =?UTF-8?q?2023-05-22=2015:34:46=20=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86=E7=9A=84=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../psdc/entity/request/UpDevUserRequest.java | 33 ++++++++++++++++++ .../com/psdc/mapper/PsdcDeviceMapper.java | 9 +++++ .../com/psdc/service/IPsdcDeviceService.java | 1 + .../service/impl/PsdcDeviceServiceImpl.java | 14 ++++++++ .../mapper/business/PsdcDeviceMapper.xml | 4 +++ .../manager/PsdcDeviceController.java | 9 +++-- .../resources/template/AllDevicesData.xlsx | Bin 9046 -> 9046 bytes 7 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 psdc-business/src/main/java/com/psdc/entity/request/UpDevUserRequest.java diff --git a/psdc-business/src/main/java/com/psdc/entity/request/UpDevUserRequest.java b/psdc-business/src/main/java/com/psdc/entity/request/UpDevUserRequest.java new file mode 100644 index 0000000..d2c955c --- /dev/null +++ b/psdc-business/src/main/java/com/psdc/entity/request/UpDevUserRequest.java @@ -0,0 +1,33 @@ +package com.psdc.entity.request; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Author:戴仕崑 + * @Project:psdc + * @Date:2022/11/30 17:22 + * @Version 1.0 + */ +@Data +@Component +@NoArgsConstructor +@AllArgsConstructor +public class UpDevUserRequest { + + /** + * 设备ID + */ + private List deviceIds; + + /** + * 所属用户Id + */ + private Long userId; + + +} diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java index bd9b1c5..c65e6c8 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java @@ -32,6 +32,15 @@ public interface PsdcDeviceMapper{ List selMyWorkDevices(@Param(value = "devType") Integer devType, @Param(value = "userId") Long userId); + /** + * 设备绑定用户 + * @param userId + * @param devId + * @return + */ + Integer upDevStaUser(@Param(value = "userId") Long userId, + @Param(value = "devId") Integer devId); + /** * 分页查询指定行数据 diff --git a/psdc-business/src/main/java/com/psdc/service/IPsdcDeviceService.java b/psdc-business/src/main/java/com/psdc/service/IPsdcDeviceService.java index c4830b7..3c26354 100644 --- a/psdc-business/src/main/java/com/psdc/service/IPsdcDeviceService.java +++ b/psdc-business/src/main/java/com/psdc/service/IPsdcDeviceService.java @@ -33,6 +33,7 @@ public interface IPsdcDeviceService { DeviceStatusVo queryDeviceStatusById(Integer deviceId); + Boolean upDevUser(Long userId, List devList); /** * 新增数据 diff --git a/psdc-business/src/main/java/com/psdc/service/impl/PsdcDeviceServiceImpl.java b/psdc-business/src/main/java/com/psdc/service/impl/PsdcDeviceServiceImpl.java index 99f1a6e..5ac56f6 100644 --- a/psdc-business/src/main/java/com/psdc/service/impl/PsdcDeviceServiceImpl.java +++ b/psdc-business/src/main/java/com/psdc/service/impl/PsdcDeviceServiceImpl.java @@ -83,6 +83,20 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { return psdcDeviceMapper.queryDeviceStatusById(deviceId); } + @Override + public Boolean upDevUser(Long userId, List devList) { + int up = 0; + for (Integer dev : devList){ + int devUser = psdcDeviceMapper.upDevStaUser(userId, dev); + up = up + devUser; + } + if (up > 0){ + return true; + } else { + return false; + } + } + /** * 新增数据 * diff --git a/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml b/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml index 1c478ad..609e06e 100644 --- a/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml +++ b/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml @@ -319,6 +319,10 @@ update psdc_device set device_runstatus = #{runStatus} where device_id = #{deviceId} + + Update psdc_device Set user_id = #{userId} Where device_id = ${devId} + +