<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper">
    <select id="selectYearTrend" resultType="map">

        SELECT
        month_time as daytime,
        generate,
        fullhour
        from
        house_pv_data.td_hygf_inverter_year_generate
        <where>
            `year` = #{time}
            <if test="snCode != null and snCode !=''">
                and sn_code = #{snCode}
            </if>
            <if test="thirdStationId != null and thirdStationId !=''">
                and third_station_id = #{thirdStationId}
            </if>
        </where>
    </select>

    <select id="selectTotalTrend" resultType="map">

        SELECT
        year_time as dayTime,
        generate,
        fullhour
        from
        house_pv_data.td_hygf_inverter_total_generate
        <where>
            <if test="time != null and time !=''">
                and year_time = #{time}
            </if>
            <if test="snCode != null and snCode !=''">
                and sn_code = #{snCode}
            </if>
            <if test="thirdStationId != null and thirdStationId !=''">
                and third_station_id = #{thirdStationId}
            </if>
        </where>
    </select>

    <select id="selectYearTotal" resultType="map">

        SELECT
        income ,
        generate,
        fullhour
        from
        house_pv_data.td_hygf_inverter_year_generate
        <where>
                month_time = #{time}
            <if test="snCode != null and snCode !=''">
                and sn_code = #{snCode}
            </if>
            <if test="thirdStationId != null and thirdStationId !=''">
                and third_station_id = #{thirdStationId}
            </if>
        </where>
    </select>


    <select id="selectTotalSum" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterTotalGenerate">

        SELECT
        income ,
        generate,
        fullhour
        from
        house_pv_data.td_hygf_inverter_total_generate
        <where>
            <if test="time != null and time !=''">
                year_time = #{time}

            </if>
            <if test="snCode != null and snCode !=''">
                and sn_code = #{snCode}
            </if>
            <if test="thirdStationId != null and thirdStationId !=''">
                and third_station_id = #{thirdStationId}
            </if>
        </where>
    </select>
</mapper>