package com.yzt.airconditionersystem;

import com.yzt.airconditionersystem.bean.Gateway;
import com.yzt.airconditionersystem.bean.Project;
import com.yzt.airconditionersystem.mapper.GatewayMapper;
import com.yzt.airconditionersystem.mapper.ProjectMapper;
import com.yzt.airconditionersystem.util.MyUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @author TzZach
 * @since 2022-04-17 16:28
 */
@SpringBootTest
public class GatewayTest {

    @Autowired
    private GatewayMapper gatewayMapper;
    @Autowired
    private ProjectMapper  projectMapper;

    @Test
    public void testInsert() {

        List<Project> projects = projectMapper.selectList(null);

        for (int i = 0; i < 300; i++) {
            int size = projects.size();
            Project project = projects.get((int) (Math.random() * size));
            String location = (int)(Math.random() * 9 + 1) + "楼" + (int)(Math.random() * 9 + 1) + "层" + (int)(Math.random() * 9 + 1) + "室";
//            Gateway gateway = new Gateway(null, project.getId(), "KT-" + i, "192.168.0." + (1 + i), location);
//            gatewayMapper.insert(gateway);

        }
    }

}
