<?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.ruoyi.predict.mapper.PvDaPfPeriodDataMapper">
    
    <resultMap type="PvDaPfPeriodData" id="PvDaPfPeriodDataResult">
        <result property="pvNo"    column="pv_no"    />
        <result property="modelNo"    column="model_no"    />
        <result property="timeScale"    column="time_scale"    />
        <result property="dataTime"    column="data_time"    />
        <result property="radiation"    column="radiation"    />
        <result property="power"    column="power"    />
        <result property="dataFlag"    column="data_flag"    />
    </resultMap>

    <sql id="selectPvDaPfPeriodDataVo">
        select pv_no, model_no, time_scale, data_time, radiation, power, data_flag from pv_da_pf_period_data
    </sql>

    <select id="selectPvDaPfPeriodDataList" parameterType="PvDaPfPeriodData" resultMap="PvDaPfPeriodDataResult">
        <include refid="selectPvDaPfPeriodDataVo"/>
        <where>
            <if test="pvNo != null ">and pv_no = #{pvNo}</if>
            <if test="modelNo != null ">and model_no = #{modelNo}</if>
            <if test="timeScale != null ">and time_scale = #{timeScale}</if>
            <if test="radiation != null "> and radiation = #{radiation}</if>
            <if test="power != null "> and power = #{power}</if>
            <if test="dataFlag != null "> and data_flag = #{dataFlag}</if>
            <if test="params.beginDataTime != null and params.beginDataTime != '' and params.endDataTime != null and params.endDataTime != ''">
                and data_time between to_date(#{params.beginDataTime},'yyyy-MM-dd HH24:MI:SS') and
                to_date(#{params.endDataTime},'yyyy-MM-dd HH24:MI:SS')
            </if>
            <if test="dataTime != null ">and data_time = #{dataTime}</if>
        </where>
    </select>
    
    <select id="selectPvDaPfPeriodDataById" parameterType="Long" resultMap="PvDaPfPeriodDataResult">
        <include refid="selectPvDaPfPeriodDataVo"/>
        where pv_no = #{pvNo}
    </select>

    <select id="selectPvDaPfPeriodData" parameterType="PvDaPfPeriodData" resultMap="PvDaPfPeriodDataResult">
        <include refid="selectPvDaPfPeriodDataVo"/>
        where pv_no = #{pvNo} and model_no = #{modelNo} and data_time = #{dataTime}
    </select>

</mapper>