package com.ruoyi.web.modules.screen.mapper;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

/**
 * Mapper XML 冒烟。
 */
@DisplayName("HomeScreenStatsMapper XML")
class HomeScreenStatsMapperXmlTest
{

    @Test
    @DisplayName("HomeScreenStatsMapper.xml 包含关键表")
    void xmlContainsTables() throws Exception
    {
        String xml = IOUtils.toString(
                getClass().getClassLoader().getResourceAsStream("mapper/screen/HomeScreenStatsMapper.xml"),
                StandardCharsets.UTF_8);
        assertTrue(xml.contains("biz_yak_asset"));
        assertTrue(xml.contains("biz_service_appointment"));
        assertTrue(xml.contains("biz_subsidy_grant_record"));
        assertTrue(xml.contains("biz_yak_herd_inventory"));
        assertTrue(xml.contains("biz_yak_outbound_report"));
        assertTrue(xml.contains("sumHerdInventoryYakTotalByStatYearMonth"));
        assertTrue(xml.contains("selectLatestHerdInventoryStatPeriod"));
        assertTrue(xml.contains("selectHerdInventoryBullCowByYearMonthRange"));
        assertTrue(xml.contains("selectOutboundReportYakCountByYearMonthRange"));
        assertTrue(xml.contains("selectOutboundReportYakCountByMonth"));
        assertTrue(xml.contains("selectTownMapMarkers"));
        assertTrue(xml.contains("herdStatMonth"));
        assertTrue(xml.contains("outboundStatMonth"));
        assertTrue(xml.contains("status not in (2, 3)"));
    }
}
