<?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.gyee.frame.mapper.auto.StandbyTimeMapper">
  <resultMap id="BaseResultMap" type="com.gyee.frame.model.auto.StandbyTime">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" jdbcType="DECIMAL" property="id" />
    <result column="COUNTDAY" jdbcType="TIMESTAMP" property="countday" />
    <result column="STANDBYHOURS" jdbcType="DECIMAL" property="standbyhours" />
    <result column="STATIONID" jdbcType="VARCHAR" property="stationid" />
    <result column="WINDTURBINEID" jdbcType="VARCHAR" property="windturbineid" />
    <result column="MODELID" jdbcType="VARCHAR" property="modelid" />
    <result column="STATETYPE" jdbcType="VARCHAR" property="statetype" />
    <result column="MESSAGE" jdbcType="VARCHAR" property="message" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    ID, COUNTDAY, STANDBYHOURS, STATIONID, WINDTURBINEID, MODELID, STATETYPE, MESSAGE
  </sql>
  <select id="selectByExample" parameterType="com.gyee.frame.model.auto.StandbyTimeExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from STANDBYTIME
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from STANDBYTIME
    where ID = #{id,jdbcType=DECIMAL}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from STANDBYTIME
    where ID = #{id,jdbcType=DECIMAL}
  </delete>
  <delete id="deleteByExample" parameterType="com.gyee.frame.model.auto.StandbyTimeExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from STANDBYTIME
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.gyee.frame.model.auto.StandbyTime">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into STANDBYTIME (ID, COUNTDAY, STANDBYHOURS, 
      STATIONID, WINDTURBINEID, MODELID, 
      STATETYPE, MESSAGE)
    values (#{id,jdbcType=DECIMAL}, #{countday,jdbcType=TIMESTAMP}, #{standbyhours,jdbcType=DECIMAL}, 
      #{stationid,jdbcType=VARCHAR}, #{windturbineid,jdbcType=VARCHAR}, #{modelid,jdbcType=VARCHAR}, 
      #{statetype,jdbcType=VARCHAR}, #{message,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.gyee.frame.model.auto.StandbyTime">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into STANDBYTIME
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="countday != null">
        COUNTDAY,
      </if>
      <if test="standbyhours != null">
        STANDBYHOURS,
      </if>
      <if test="stationid != null">
        STATIONID,
      </if>
      <if test="windturbineid != null">
        WINDTURBINEID,
      </if>
      <if test="modelid != null">
        MODELID,
      </if>
      <if test="statetype != null">
        STATETYPE,
      </if>
      <if test="message != null">
        MESSAGE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=DECIMAL},
      </if>
      <if test="countday != null">
        #{countday,jdbcType=TIMESTAMP},
      </if>
      <if test="standbyhours != null">
        #{standbyhours,jdbcType=DECIMAL},
      </if>
      <if test="stationid != null">
        #{stationid,jdbcType=VARCHAR},
      </if>
      <if test="windturbineid != null">
        #{windturbineid,jdbcType=VARCHAR},
      </if>
      <if test="modelid != null">
        #{modelid,jdbcType=VARCHAR},
      </if>
      <if test="statetype != null">
        #{statetype,jdbcType=VARCHAR},
      </if>
      <if test="message != null">
        #{message,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.gyee.frame.model.auto.StandbyTimeExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from STANDBYTIME
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update STANDBYTIME
    <set>
      <if test="record.id != null">
        ID = #{record.id,jdbcType=DECIMAL},
      </if>
      <if test="record.countday != null">
        COUNTDAY = #{record.countday,jdbcType=TIMESTAMP},
      </if>
      <if test="record.standbyhours != null">
        STANDBYHOURS = #{record.standbyhours,jdbcType=DECIMAL},
      </if>
      <if test="record.stationid != null">
        STATIONID = #{record.stationid,jdbcType=VARCHAR},
      </if>
      <if test="record.windturbineid != null">
        WINDTURBINEID = #{record.windturbineid,jdbcType=VARCHAR},
      </if>
      <if test="record.modelid != null">
        MODELID = #{record.modelid,jdbcType=VARCHAR},
      </if>
      <if test="record.statetype != null">
        STATETYPE = #{record.statetype,jdbcType=VARCHAR},
      </if>
      <if test="record.message != null">
        MESSAGE = #{record.message,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update STANDBYTIME
    set ID = #{record.id,jdbcType=DECIMAL},
      COUNTDAY = #{record.countday,jdbcType=TIMESTAMP},
      STANDBYHOURS = #{record.standbyhours,jdbcType=DECIMAL},
      STATIONID = #{record.stationid,jdbcType=VARCHAR},
      WINDTURBINEID = #{record.windturbineid,jdbcType=VARCHAR},
      MODELID = #{record.modelid,jdbcType=VARCHAR},
      STATETYPE = #{record.statetype,jdbcType=VARCHAR},
      MESSAGE = #{record.message,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.gyee.frame.model.auto.StandbyTime">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update STANDBYTIME
    <set>
      <if test="countday != null">
        COUNTDAY = #{countday,jdbcType=TIMESTAMP},
      </if>
      <if test="standbyhours != null">
        STANDBYHOURS = #{standbyhours,jdbcType=DECIMAL},
      </if>
      <if test="stationid != null">
        STATIONID = #{stationid,jdbcType=VARCHAR},
      </if>
      <if test="windturbineid != null">
        WINDTURBINEID = #{windturbineid,jdbcType=VARCHAR},
      </if>
      <if test="modelid != null">
        MODELID = #{modelid,jdbcType=VARCHAR},
      </if>
      <if test="statetype != null">
        STATETYPE = #{statetype,jdbcType=VARCHAR},
      </if>
      <if test="message != null">
        MESSAGE = #{message,jdbcType=VARCHAR},
      </if>
    </set>
    where ID = #{id,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gyee.frame.model.auto.StandbyTime">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update STANDBYTIME
    set COUNTDAY = #{countday,jdbcType=TIMESTAMP},
      STANDBYHOURS = #{standbyhours,jdbcType=DECIMAL},
      STATIONID = #{stationid,jdbcType=VARCHAR},
      WINDTURBINEID = #{windturbineid,jdbcType=VARCHAR},
      MODELID = #{modelid,jdbcType=VARCHAR},
      STATETYPE = #{statetype,jdbcType=VARCHAR},
      MESSAGE = #{message,jdbcType=VARCHAR}
    where ID = #{id,jdbcType=DECIMAL}
  </update>

  <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
    insert into STANDBYTIME (ID, COUNTDAY, STANDBYHOURS, STATIONID, WINDTURBINEID, MODELID, STATETYPE, MESSAGE)
    <foreach collection="list" item="item" index="index" separator="union all" >
      ( select
      #{item.id}, #{item.countday}, #{item.standbyhours}, #{item.stationid},#{item.windturbineid},#{item.modelid},#{item.statetype},#{item.message}
      from dual )
    </foreach>
  </insert>
</mapper>