<?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.energy.manage.service.mappers.analysisdatarelationrecords.AnalysisDataRelationRecordsMapper">
  <resultMap id="BaseResultMap" type="com.energy.manage.common.po.analysisdatarelationrecords.AnalysisDataRelationRecordsPo">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="data_batch_num" jdbcType="VARCHAR" property="dataBatchNum" />
    <result column="power_farm_id" jdbcType="VARCHAR" property="powerFarmID" />
    <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="excluding_months" jdbcType="VARCHAR" property="excludingMonths" />
    <result column="cretate_time" jdbcType="TIMESTAMP" property="cretateTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="config_analysis" jdbcType="VARCHAR" property="configAnalysis" />
    <result column="turbines" jdbcType="VARCHAR" property="turbines" />
    <result column="value_wind_speed" jdbcType="VARCHAR" property="valueWindSpeed" />
    <result column="value_pitch_angle" jdbcType="VARCHAR" property="valuePitchAngle" />
    <result column="value_active_power" jdbcType="VARCHAR" property="valueActivePower" />
    <result column="value_generator_speed" jdbcType="VARCHAR" property="valueGeneratorSpeed" />
    <result column="task_id" jdbcType="VARCHAR" property="taskId" />
    <result column="auto_or_manual" jdbcType="VARCHAR" property="autoOrManual" />
  </resultMap>
  <sql id="Base_Column_List">
    id, data_batch_num, power_farm_id, begin_time, end_time, excluding_months, is_delete,
    cretate_time, update_time, config_analysis, turbines, value_wind_speed, value_pitch_angle,
    value_active_power, value_generator_speed, task_id, auto_or_manual
  </sql>

  <select id="selectByTaskId" parameterType="java.lang.String" resultMap="BaseResultMap">
        select * from analysis_data_relation_records where task_id = #{taskId,jdbcType=VARCHAR}
  </select>

  <insert id="insertSelective" parameterType="com.energy.manage.common.po.analysisdatarelationrecords.AnalysisDataRelationRecordsPo">
      INSERT INTO analysis_data_relation_records
      <trim prefix="(" suffix=")" suffixOverrides=",">
        <if test="dataBatchNum != null">data_batch_num,</if>
        <if test="powerFarmID != null">power_farm_id,</if>
        <if test="beginTime != null">begin_time,</if>
        <if test="endTime != null">end_time,</if>
        <if test="excludingMonths != null">excluding_months,</if>
        <if test="configAnalysis != null">config_analysis,</if>
        <if test="turbines != null">turbines,</if>
        <if test="valueWindSpeed != null">value_wind_speed,</if>
        <if test="valuePitchAngle != null">value_pitch_angle,</if>
        <if test="valueActivePower != null">value_active_power,</if>
        <if test="valueGeneratorSpeed != null">value_generator_speed,</if>
        <if test="taskId != null">task_id,</if>
        <if test="autoOrManual != null">auto_or_manual,</if>
      </trim>
      <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
        <if test="dataBatchNum != null">#{dataBatchNum,jdbcType=VARCHAR},</if>
        <if test="powerFarmID != null">#{powerFarmID,jdbcType=VARCHAR},</if>
        <if test="beginTime != null">#{beginTime,jdbcType=TIMESTAMP},</if>
        <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
        <if test="excludingMonths != null">#{excludingMonths,jdbcType=VARCHAR},</if>
        <if test="configAnalysis != null">#{configAnalysis,jdbcType=VARCHAR},</if>
        <if test="turbines != null">#{turbines,jdbcType=VARCHAR},</if>
        <if test="valueWindSpeed != null">#{valueWindSpeed,jdbcType=VARCHAR},</if>
        <if test="valuePitchAngle != null">#{valuePitchAngle,jdbcType=VARCHAR},</if>
        <if test="valueActivePower != null">#{valueActivePower,jdbcType=VARCHAR},</if>
        <if test="valueGeneratorSpeed != null">#{valueGeneratorSpeed,jdbcType=VARCHAR},</if>
        <if test="taskId != null">#{taskId,jdbcType=VARCHAR},</if>
        <if test="autoOrManual != null">#{autoOrManual,jdbcType=VARCHAR},</if>
      </trim>
  </insert>

</mapper>
