package com.gyjiot.web.controller.tool;

import com.gyjiot.common.annotation.Anonymous;
import com.gyjiot.iot.mapper.DeviceMapper;
import com.gyjiot.iot.model.DeviceRelateAlertLogVO;
import com.gyjiot.iot.service.IDeviceService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * 测试类
 * @author gyj.iot
 * @date 2023-09-13 11:42
 */
@Anonymous
@Api("测试方法")
@RestController
@RequestMapping("/test2")
public class TestController2 {

    @Resource
    private IDeviceService deviceService;
    @Resource
    private DeviceMapper deviceMapper;

    @GetMapping("/add")
    public void add()
    {
        Set<String> deviceNumbers = new HashSet<>();
        deviceNumbers.add("D1PGLPG58K88");
        deviceNumbers.add("D1F0L7P84D8Z");
        deviceNumbers.add("D1F0L7P84D8Z_2");
        List<DeviceRelateAlertLogVO> deviceRelateAlertLogVOList = deviceMapper.selectDeviceBySerialNumbers(deviceNumbers);
        Map<String, DeviceRelateAlertLogVO> deviceRelateAlertLogVOMap = deviceRelateAlertLogVOList.stream().collect(Collectors.toMap(DeviceRelateAlertLogVO::getSerialNumber, Function.identity()));
    }
}
