<?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.lightinit.hsdataplatform.mapper.BusinessMonitoringMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdataplatform.entity.BusinessMonitoring">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="monitoring_type" jdbcType="VARCHAR" property="monitoringType" />
    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="monitoring_cycle" jdbcType="INTEGER" property="monitoringCycle" />
    <result column="threshold_value1" jdbcType="INTEGER" property="thresholdValue1" />
    <result column="threshold_value2" jdbcType="INTEGER" property="thresholdValue2" />
    <result column="threshold_value3" jdbcType="INTEGER" property="thresholdValue3" />
    <result column="alert_method" jdbcType="VARCHAR" property="alertMethod" />
    <result column="alert_time" jdbcType="TIMESTAMP" property="alertTime" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
    <result column="deleted_at" jdbcType="TIMESTAMP" property="deletedAt" />
    <result column="deleted_by" jdbcType="BIGINT" property="deletedBy" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <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">
    <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">
    id, monitoring_type, start_time, end_time, monitoring_cycle, threshold_value1, threshold_value2, 
    threshold_value3, alert_method, alert_time, created_at, created_by, deleted_at, deleted_by
  </sql>
  <select id="selectByExample" parameterType="com.lightinit.hsdataplatform.entity.BusinessMonitoringExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from business_monitoring
    <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.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from business_monitoring
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from business_monitoring
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdataplatform.entity.BusinessMonitoringExample">
    delete from business_monitoring
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdataplatform.entity.BusinessMonitoring">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into business_monitoring (monitoring_type, start_time, end_time, 
      monitoring_cycle, threshold_value1, threshold_value2, 
      threshold_value3, alert_method, alert_time, 
      created_at, created_by, deleted_at, 
      deleted_by)
    values (#{monitoringType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, 
      #{monitoringCycle,jdbcType=INTEGER}, #{thresholdValue1,jdbcType=INTEGER}, #{thresholdValue2,jdbcType=INTEGER}, 
      #{thresholdValue3,jdbcType=INTEGER}, #{alertMethod,jdbcType=VARCHAR}, #{alertTime,jdbcType=TIMESTAMP}, 
      #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{deletedAt,jdbcType=TIMESTAMP}, 
      #{deletedBy,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdataplatform.entity.BusinessMonitoring">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into business_monitoring
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="monitoringType != null">
        monitoring_type,
      </if>
      <if test="startTime != null">
        start_time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="monitoringCycle != null">
        monitoring_cycle,
      </if>
      <if test="thresholdValue1 != null">
        threshold_value1,
      </if>
      <if test="thresholdValue2 != null">
        threshold_value2,
      </if>
      <if test="thresholdValue3 != null">
        threshold_value3,
      </if>
      <if test="alertMethod != null">
        alert_method,
      </if>
      <if test="alertTime != null">
        alert_time,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="deletedAt != null">
        deleted_at,
      </if>
      <if test="deletedBy != null">
        deleted_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="monitoringType != null">
        #{monitoringType,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null">
        #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="monitoringCycle != null">
        #{monitoringCycle,jdbcType=INTEGER},
      </if>
      <if test="thresholdValue1 != null">
        #{thresholdValue1,jdbcType=INTEGER},
      </if>
      <if test="thresholdValue2 != null">
        #{thresholdValue2,jdbcType=INTEGER},
      </if>
      <if test="thresholdValue3 != null">
        #{thresholdValue3,jdbcType=INTEGER},
      </if>
      <if test="alertMethod != null">
        #{alertMethod,jdbcType=VARCHAR},
      </if>
      <if test="alertTime != null">
        #{alertTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        #{deletedBy,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdataplatform.entity.BusinessMonitoringExample" resultType="java.lang.Long">
    select count(*) from business_monitoring
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update business_monitoring
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.monitoringType != null">
        monitoring_type = #{record.monitoringType,jdbcType=VARCHAR},
      </if>
      <if test="record.startTime != null">
        start_time = #{record.startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.endTime != null">
        end_time = #{record.endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.monitoringCycle != null">
        monitoring_cycle = #{record.monitoringCycle,jdbcType=INTEGER},
      </if>
      <if test="record.thresholdValue1 != null">
        threshold_value1 = #{record.thresholdValue1,jdbcType=INTEGER},
      </if>
      <if test="record.thresholdValue2 != null">
        threshold_value2 = #{record.thresholdValue2,jdbcType=INTEGER},
      </if>
      <if test="record.thresholdValue3 != null">
        threshold_value3 = #{record.thresholdValue3,jdbcType=INTEGER},
      </if>
      <if test="record.alertMethod != null">
        alert_method = #{record.alertMethod,jdbcType=VARCHAR},
      </if>
      <if test="record.alertTime != null">
        alert_time = #{record.alertTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=BIGINT},
      </if>
      <if test="record.deletedAt != null">
        deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deletedBy != null">
        deleted_by = #{record.deletedBy,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update business_monitoring
    set id = #{record.id,jdbcType=BIGINT},
      monitoring_type = #{record.monitoringType,jdbcType=VARCHAR},
      start_time = #{record.startTime,jdbcType=TIMESTAMP},
      end_time = #{record.endTime,jdbcType=TIMESTAMP},
      monitoring_cycle = #{record.monitoringCycle,jdbcType=INTEGER},
      threshold_value1 = #{record.thresholdValue1,jdbcType=INTEGER},
      threshold_value2 = #{record.thresholdValue2,jdbcType=INTEGER},
      threshold_value3 = #{record.thresholdValue3,jdbcType=INTEGER},
      alert_method = #{record.alertMethod,jdbcType=VARCHAR},
      alert_time = #{record.alertTime,jdbcType=TIMESTAMP},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=BIGINT},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.lightinit.hsdataplatform.entity.BusinessMonitoring">
    update business_monitoring
    <set>
      <if test="monitoringType != null">
        monitoring_type = #{monitoringType,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null">
        start_time = #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="monitoringCycle != null">
        monitoring_cycle = #{monitoringCycle,jdbcType=INTEGER},
      </if>
      <if test="thresholdValue1 != null">
        threshold_value1 = #{thresholdValue1,jdbcType=INTEGER},
      </if>
      <if test="thresholdValue2 != null">
        threshold_value2 = #{thresholdValue2,jdbcType=INTEGER},
      </if>
      <if test="thresholdValue3 != null">
        threshold_value3 = #{thresholdValue3,jdbcType=INTEGER},
      </if>
      <if test="alertMethod != null">
        alert_method = #{alertMethod,jdbcType=VARCHAR},
      </if>
      <if test="alertTime != null">
        alert_time = #{alertTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        deleted_by = #{deletedBy,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdataplatform.entity.BusinessMonitoring">
    update business_monitoring
    set monitoring_type = #{monitoringType,jdbcType=VARCHAR},
      start_time = #{startTime,jdbcType=TIMESTAMP},
      end_time = #{endTime,jdbcType=TIMESTAMP},
      monitoring_cycle = #{monitoringCycle,jdbcType=INTEGER},
      threshold_value1 = #{thresholdValue1,jdbcType=INTEGER},
      threshold_value2 = #{thresholdValue2,jdbcType=INTEGER},
      threshold_value3 = #{thresholdValue3,jdbcType=INTEGER},
      alert_method = #{alertMethod,jdbcType=VARCHAR},
      alert_time = #{alertTime,jdbcType=TIMESTAMP},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>