package cn.cslg.report.mapper;

import cn.cslg.report.entity.AvoidDesignWholeDirection;
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;

/**
 * 回避设计总体方向表的Mapper层接口测试类
 *
 * @Author chenyu
 * @Data 2023/2/2
 */
@Slf4j
@SpringBootTest
public class AvoidDesignWholeDirectionMapperTests {

    @Autowired
    private AvoidDesignWholeDirectionMapper avoidDesignWholeDirectionMapper;

    @Test
    void insert() {
        AvoidDesignWholeDirection avoidDesignWholeDirection = new AvoidDesignWholeDirection()
                .setReportId(410)
                .setWholeDirection("回避设计总体方向内容3");
        log.info("插入前数据为：{}", avoidDesignWholeDirection);
        int rows = avoidDesignWholeDirectionMapper.insert(avoidDesignWholeDirection);
        log.info("插入数据完成，受影响的行数为：{}", rows);
        log.info("插入后数据为：{}", avoidDesignWholeDirection);
    }

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

    @Test
    void selectWholeDirectionByReportId() {
        Integer reportId = 569;
        String wholeDirection = avoidDesignWholeDirectionMapper.selectWholeDirectionByReportId(reportId);
        log.info("根据报告id查询回避设计总体方向数据完成，数据为：{}", wholeDirection);
    }

}
