<?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.autoanalysisconfigdetailoptionrecords.AutoAnalysisConfigDetailOptionRecordsMapper">
  <resultMap id="BaseResultMap" type="com.energy.manage.common.po.autoanalysisconfigdetailoptionrecords.AutoAnalysisConfigDetailOptionRecordsPo">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="field_code" jdbcType="VARCHAR" property="fieldCode" />
    <result column="source_inteval_days" jdbcType="INTEGER" property="sourceIntevalDays" />
    <result column="source_start_time" jdbcType="TIMESTAMP" property="sourceStartTime" />
    <result column="source_startup_state" jdbcType="INTEGER" property="sourceStartupState" />
    <result column="option_flag" jdbcType="INTEGER" property="optionFlag" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="config_unique_id" jdbcType="VARCHAR" property="configUniqueId" />
  </resultMap>
  <sql id="Base_Column_List">
    id, field_code, source_inteval_days, source_start_time, source_startup_state, option_flag,config_unique_id,
    create_time
  </sql>

  <select id="selectEditByCreateTime" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from auto_analysis_config_detail_option_records
    where option_flag = 1
    and config_unique_id = #{configUniqueId,jdbcType=VARCHAR}
    order by create_time desc
    limit 1
  </select>

</mapper>
