package cn.cslg.report.mapper;

import cn.cslg.report.common.model.dto.AvoidFeaturesDTO;
import cn.cslg.report.entity.AvoidFeatures;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;

/**
 * @Author chenyu
 * @Data 2023/2/3
 */
@Slf4j
@SpringBootTest
public class AvoidFeatureMapperTests {

    @Autowired
    private AvoidFeatureMapper avoidFeatureMapper;

    @Test
    void insertBatch() {
        AvoidFeatures avoidFeature = new AvoidFeatures()
                .setLittleDirection("回避设计方向255380")
                .setReportId(255380);
        ArrayList<AvoidFeatures> avoidFeatures = new ArrayList<>();
        avoidFeatures.add(avoidFeature);
        log.info("批量插入前数据为：{}", avoidFeatures);
        int rows = avoidFeatureMapper.insertBatch(avoidFeatures);
        log.info("批量插入回避设计特征完成，受影响的行数为：{}", rows);
        log.info("批量插入后数据为：{}", avoidFeatures);
    }

    @Test
    void deleteByReportId() {
        int rows = avoidFeatureMapper.deleteByReportId(517);
        log.info("根据报告id删除特征完成，受影响的行数为：{}", rows);
    }

}
