<?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.LpProjectYearDataMapper">

    <resultMap type="LpProjectYearData" id="LpProjectYearDataResult">
        <result property="wfPrNo" column="wf_pr_no"/>
        <result property="modelNo" column="model_no"/>
        <result property="dataTime" column="data_time"/>
        <result property="k" column="k"/>
        <result property="c" column="c"/>
        <result property="pfK" column="pf_k"/>
        <result property="kRelativeerror" column="k_relativeerror"/>
        <result property="pfC" column="pf_c"/>
        <result property="cRelativeerror" column="c_relativeerror"/>
        <result property="speed" column="speed"/>
        <result property="hourCount" column="hour_count"/>
        <result property="factors" column="factors"/>
        <result property="windEnergy" column="wind_energy"/>
        <result property="generatingCapacity" column="generating_capacity"/>
        <result property="pfGeneratingCapacity" column="pf_generating_capacity"/>
        <result property="pfHourCount" column="pf_hour_count"/>
        <result property="maxProbabilityDensity" column="max_probability_density"/>
        <result property="energyRelativeerror" column="energy_relativeerror"/>
        <result property="dataFlag" column="data_flag"/>
    </resultMap>

    <sql id="selectLpProjectYearDataVo">
        select wf_pr_no, model_no, data_time, k, c, pf_k, k_relativeerror, pf_c, c_relativeerror, speed, hour_count, factors, wind_energy, generating_capacity, pf_generating_capacity, pf_hour_count, max_probability_density, energy_relativeerror, data_flag from lp_project_year_data
    </sql>

    <select id="selectLpProjectYearDataList" parameterType="LpProjectYearData" resultMap="LpProjectYearDataResult">
        <include refid="selectLpProjectYearDataVo"/>
        <where>
            <if test="wfPrNo != null ">and wf_pr_no = #{wfPrNo}</if>
            <if test="modelNo != null ">and model_no = #{modelNo}</if>
            <if test="k != null ">and k = #{k}</if>
            <if test="c != null ">and c = #{c}</if>
            <if test="pfK != null ">and pf_k = #{pfK}</if>
            <if test="kRelativeerror != null ">and k_relativeerror = #{kRelativeerror}</if>
            <if test="pfC != null ">and pf_c = #{pfC}</if>
            <if test="cRelativeerror != null ">and c_relativeerror = #{cRelativeerror}</if>
            <if test="speed != null ">and speed = #{speed}</if>
            <if test="hourCount != null ">and hour_count = #{hourCount}</if>
            <if test="factors != null ">and factors = #{factors}</if>
            <if test="windEnergy != null ">and wind_energy = #{windEnergy}</if>
            <if test="generatingCapacity != null ">and generating_capacity = #{generatingCapacity}</if>
            <if test="pfGeneratingCapacity != null ">and pf_generating_capacity = #{pfGeneratingCapacity}</if>
            <if test="pfHourCount != null ">and pf_hour_count = #{pfHourCount}</if>
            <if test="maxProbabilityDensity != null ">and max_probability_density = #{maxProbabilityDensity}</if>
            <if test="energyRelativeerror != null ">and energy_relativeerror = #{energyRelativeerror}</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>
        order by data_time asc
    </select>

    <select id="selectLpProjectYearDataById" parameterType="Long" resultMap="LpProjectYearDataResult">
        <include refid="selectLpProjectYearDataVo"/>
        where wf_pr_no = #{wfPrNo}
    </select>

    <select id="selectLpProjectYearData" parameterType="LpProjectYearData" resultMap="LpProjectYearDataResult">
        <include refid="selectLpProjectYearDataVo"/>
        where wf_pr_no = #{wfPrNo} and data_time > #{dataTime}
    </select>

</mapper>