<?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="cn.cecep.talroad.mapper.MonElecOperationLogMapper">
  <resultMap id="BaseResultMap" type="cn.cecep.talroad.domain.MonElecOperationLog">
    <!--@mbg.generated-->
    <!--@Table mon_elec_operation_log-->
    <id column="log_id" jdbcType="VARCHAR" property="logId" />
    <result column="operation_time" jdbcType="TIMESTAMP" property="operationTime" />
    <result column="elec_station_name" jdbcType="VARCHAR" property="elecStationName" />
    <result column="device_name" jdbcType="VARCHAR" property="deviceName" />
    <result column="before_modify_normal" jdbcType="VARCHAR" property="beforeModifyNormal" />
    <result column="after_modify_normal" jdbcType="VARCHAR" property="afterModifyNormal" />
    <result column="operator" jdbcType="VARCHAR" property="operator" />
    <result column="operator_id" jdbcType="VARCHAR" property="operatorId" />
    <result column="factory_id" jdbcType="VARCHAR" property="factoryId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    log_id, operation_time, elec_station_name, device_name, before_modify_normal, after_modify_normal, 
    "operator", operator_id, factory_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from mon_elec_operation_log
    where log_id = #{logId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--@mbg.generated-->
    delete from mon_elec_operation_log
    where log_id = #{logId,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="cn.cecep.talroad.domain.MonElecOperationLog">
    <!--@mbg.generated-->
    insert into mon_elec_operation_log (log_id, operation_time, elec_station_name, 
      device_name, before_modify_normal, after_modify_normal, 
      "operator", operator_id, factory_id
      )
    values (#{logId,jdbcType=VARCHAR}, #{operationTime,jdbcType=TIMESTAMP}, #{elecStationName,jdbcType=VARCHAR}, 
      #{deviceName,jdbcType=VARCHAR}, #{beforeModifyNormal,jdbcType=VARCHAR}, #{afterModifyNormal,jdbcType=VARCHAR}, 
      #{operator,jdbcType=VARCHAR}, #{operatorId,jdbcType=VARCHAR}, #{factoryId,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.cecep.talroad.domain.MonElecOperationLog">
    <!--@mbg.generated-->
    insert into mon_elec_operation_log
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="logId != null and logId != ''">
        log_id,
      </if>
      <if test="operationTime != null">
        operation_time,
      </if>
      <if test="elecStationName != null and elecStationName != ''">
        elec_station_name,
      </if>
      <if test="deviceName != null and deviceName != ''">
        device_name,
      </if>
      <if test="beforeModifyNormal != null and beforeModifyNormal != ''">
        before_modify_normal,
      </if>
      <if test="afterModifyNormal != null and afterModifyNormal != ''">
        after_modify_normal,
      </if>
      <if test="operator != null and operator != ''">
        "operator",
      </if>
      <if test="operatorId != null and operatorId != ''">
        operator_id,
      </if>
      <if test="factoryId != null and factoryId != ''">
        factory_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="logId != null and logId != ''">
        #{logId,jdbcType=VARCHAR},
      </if>
      <if test="operationTime != null">
        #{operationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="elecStationName != null and elecStationName != ''">
        #{elecStationName,jdbcType=VARCHAR},
      </if>
      <if test="deviceName != null and deviceName != ''">
        #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="beforeModifyNormal != null and beforeModifyNormal != ''">
        #{beforeModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="afterModifyNormal != null and afterModifyNormal != ''">
        #{afterModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="operator != null and operator != ''">
        #{operator,jdbcType=VARCHAR},
      </if>
      <if test="operatorId != null and operatorId != ''">
        #{operatorId,jdbcType=VARCHAR},
      </if>
      <if test="factoryId != null and factoryId != ''">
        #{factoryId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.cecep.talroad.domain.MonElecOperationLog">
    <!--@mbg.generated-->
    update mon_elec_operation_log
    <set>
      <if test="operationTime != null">
        operation_time = #{operationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="elecStationName != null and elecStationName != ''">
        elec_station_name = #{elecStationName,jdbcType=VARCHAR},
      </if>
      <if test="deviceName != null and deviceName != ''">
        device_name = #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="beforeModifyNormal != null and beforeModifyNormal != ''">
        before_modify_normal = #{beforeModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="afterModifyNormal != null and afterModifyNormal != ''">
        after_modify_normal = #{afterModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="operator != null and operator != ''">
        "operator" = #{operator,jdbcType=VARCHAR},
      </if>
      <if test="operatorId != null and operatorId != ''">
        operator_id = #{operatorId,jdbcType=VARCHAR},
      </if>
      <if test="factoryId != null and factoryId != ''">
        factory_id = #{factoryId,jdbcType=VARCHAR},
      </if>
    </set>
    where log_id = #{logId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.cecep.talroad.domain.MonElecOperationLog">
    <!--@mbg.generated-->
    update mon_elec_operation_log
    set operation_time = #{operationTime,jdbcType=TIMESTAMP},
      elec_station_name = #{elecStationName,jdbcType=VARCHAR},
      device_name = #{deviceName,jdbcType=VARCHAR},
      before_modify_normal = #{beforeModifyNormal,jdbcType=VARCHAR},
      after_modify_normal = #{afterModifyNormal,jdbcType=VARCHAR},
      "operator" = #{operator,jdbcType=VARCHAR},
      operator_id = #{operatorId,jdbcType=VARCHAR},
      factory_id = #{factoryId,jdbcType=VARCHAR}
    where log_id = #{logId,jdbcType=VARCHAR}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update mon_elec_operation_log
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="operation_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.operationTime,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="elec_station_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.elecStationName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="device_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.deviceName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="before_modify_normal = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.beforeModifyNormal,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="after_modify_normal = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.afterModifyNormal,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="&quot;operator&quot; = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.operator,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="operator_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.operatorId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="factory_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.factoryId,jdbcType=VARCHAR}
        </foreach>
      </trim>
    </trim>
    where log_id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.logId,jdbcType=VARCHAR}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update mon_elec_operation_log
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="operation_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.operationTime != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.operationTime,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="elec_station_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.elecStationName != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.elecStationName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="device_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.deviceName != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.deviceName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="before_modify_normal = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.beforeModifyNormal != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.beforeModifyNormal,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="after_modify_normal = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.afterModifyNormal != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.afterModifyNormal,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="&quot;operator&quot; = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.operator != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.operator,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="operator_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.operatorId != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.operatorId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="factory_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.factoryId != null">
            when log_id = #{item.logId,jdbcType=VARCHAR} then #{item.factoryId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
    </trim>
    where log_id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.logId,jdbcType=VARCHAR}
    </foreach>
  </update>
  <insert id="batchInsert" parameterType="map">
    <!--@mbg.generated-->
    insert into mon_elec_operation_log
    (log_id, operation_time, elec_station_name, device_name, before_modify_normal, after_modify_normal, 
      "operator", operator_id, factory_id)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.logId,jdbcType=VARCHAR}, #{item.operationTime,jdbcType=TIMESTAMP}, #{item.elecStationName,jdbcType=VARCHAR}, 
        #{item.deviceName,jdbcType=VARCHAR}, #{item.beforeModifyNormal,jdbcType=VARCHAR}, 
        #{item.afterModifyNormal,jdbcType=VARCHAR}, #{item.operator,jdbcType=VARCHAR}, 
        #{item.operatorId,jdbcType=VARCHAR}, #{item.factoryId,jdbcType=VARCHAR})
    </foreach>
  </insert>
  <insert id="insertOrUpdate" parameterType="cn.cecep.talroad.domain.MonElecOperationLog">
    <!--@mbg.generated-->
    insert into mon_elec_operation_log
    (log_id, operation_time, elec_station_name, device_name, before_modify_normal, after_modify_normal, 
      "operator", operator_id, factory_id)
    values
    (#{logId,jdbcType=VARCHAR}, #{operationTime,jdbcType=TIMESTAMP}, #{elecStationName,jdbcType=VARCHAR}, 
      #{deviceName,jdbcType=VARCHAR}, #{beforeModifyNormal,jdbcType=VARCHAR}, #{afterModifyNormal,jdbcType=VARCHAR}, 
      #{operator,jdbcType=VARCHAR}, #{operatorId,jdbcType=VARCHAR}, #{factoryId,jdbcType=VARCHAR}
      )
    on duplicate key update 
    log_id = #{logId,jdbcType=VARCHAR}, 
    operation_time = #{operationTime,jdbcType=TIMESTAMP}, 
    elec_station_name = #{elecStationName,jdbcType=VARCHAR}, 
    device_name = #{deviceName,jdbcType=VARCHAR}, 
    before_modify_normal = #{beforeModifyNormal,jdbcType=VARCHAR}, 
    after_modify_normal = #{afterModifyNormal,jdbcType=VARCHAR}, 
    "operator" = #{operator,jdbcType=VARCHAR}, 
    operator_id = #{operatorId,jdbcType=VARCHAR}, 
    factory_id = #{factoryId,jdbcType=VARCHAR}
  </insert>
  <insert id="insertOrUpdateSelective" parameterType="cn.cecep.talroad.domain.MonElecOperationLog">
    <!--@mbg.generated-->
    insert into mon_elec_operation_log
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="logId != null and logId != ''">
        log_id,
      </if>
      <if test="operationTime != null">
        operation_time,
      </if>
      <if test="elecStationName != null and elecStationName != ''">
        elec_station_name,
      </if>
      <if test="deviceName != null and deviceName != ''">
        device_name,
      </if>
      <if test="beforeModifyNormal != null and beforeModifyNormal != ''">
        before_modify_normal,
      </if>
      <if test="afterModifyNormal != null and afterModifyNormal != ''">
        after_modify_normal,
      </if>
      <if test="operator != null and operator != ''">
        "operator",
      </if>
      <if test="operatorId != null and operatorId != ''">
        operator_id,
      </if>
      <if test="factoryId != null and factoryId != ''">
        factory_id,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="logId != null and logId != ''">
        #{logId,jdbcType=VARCHAR},
      </if>
      <if test="operationTime != null">
        #{operationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="elecStationName != null and elecStationName != ''">
        #{elecStationName,jdbcType=VARCHAR},
      </if>
      <if test="deviceName != null and deviceName != ''">
        #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="beforeModifyNormal != null and beforeModifyNormal != ''">
        #{beforeModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="afterModifyNormal != null and afterModifyNormal != ''">
        #{afterModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="operator != null and operator != ''">
        #{operator,jdbcType=VARCHAR},
      </if>
      <if test="operatorId != null and operatorId != ''">
        #{operatorId,jdbcType=VARCHAR},
      </if>
      <if test="factoryId != null and factoryId != ''">
        #{factoryId,jdbcType=VARCHAR},
      </if>
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="logId != null and logId != ''">
        log_id = #{logId,jdbcType=VARCHAR},
      </if>
      <if test="operationTime != null">
        operation_time = #{operationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="elecStationName != null and elecStationName != ''">
        elec_station_name = #{elecStationName,jdbcType=VARCHAR},
      </if>
      <if test="deviceName != null and deviceName != ''">
        device_name = #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="beforeModifyNormal != null and beforeModifyNormal != ''">
        before_modify_normal = #{beforeModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="afterModifyNormal != null and afterModifyNormal != ''">
        after_modify_normal = #{afterModifyNormal,jdbcType=VARCHAR},
      </if>
      <if test="operator != null and operator != ''">
        "operator" = #{operator,jdbcType=VARCHAR},
      </if>
      <if test="operatorId != null and operatorId != ''">
        operator_id = #{operatorId,jdbcType=VARCHAR},
      </if>
      <if test="factoryId != null and factoryId != ''">
        factory_id = #{factoryId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
</mapper>