Bläddra i källkod

增加反显设别名称接口

hechunping 2 år sedan
förälder
incheckning
0f24095adc

+ 9 - 0
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -134,6 +134,15 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         return R.ok(deviceInfo);
     }
 
+    @ApiOperation("反显设备名称")
+    @Override
+    public R<Map<Long,String>> getDeviceNameList(DeviceInfoDto.DeviceIdDto dto){
+        LambdaQueryWrapper<DeviceInfo> lqw = new LambdaQueryWrapper<DeviceInfo>()
+                .in(DeviceInfo::getDeviceId,dto.getDeviceId())
+                .select(DeviceInfo::getDeviceId,DeviceInfo::getDeviceName);
+        List<DeviceInfo> deviceInfoList = list(lqw);
+        return  R.ok(deviceInfoList.stream().collect(Collectors.toMap(DeviceInfo::getDeviceId, DeviceInfo::getDeviceName)));
+    }
     @Override
     @ApiOperation("设备访问历史添加")
     public R history(DeviceInfoDto.Obj obj) {

+ 7 - 0
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -797,5 +797,12 @@ public class DeviceInfoDto {
 
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class DeviceIdDto{
+        @NotNull(message = "设备id不能为空")
+        @ApiModelProperty("设备id")
+        private List<Long> deviceId;
+    }
 
 }

+ 10 - 0
device-api/src/main/java/com/xy/service/DeviceInfoService.java

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -145,4 +146,13 @@ public interface DeviceInfoService {
      */
     @PostMapping("dataCount")
     R<DeviceInfoDto.DeviceDataCountVO> dataCount(@RequestBody @Validated DeviceInfoDto.DeviceDataCountDTO dto);
+
+    /**
+     * 反显设别名称
+     *
+     * @param dto dto
+     * @return {@link R}<{@link Map}<{@link Long},{@link String}>>
+     */
+    @PostMapping("getDeviceNameList")
+    R<Map<Long,String>> getDeviceNameList(@RequestBody @Validated DeviceInfoDto.DeviceIdDto dto);
 }