<?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.chinaitop.depot.intelligent.basicdata.mapper.AlarmPhoneMapper">
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhone">
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="org_id" property="orgId" jdbcType="INTEGER" />
        <result column="alarm_man" property="alarmMan" jdbcType="VARCHAR" />
        <result column="alarm_role" property="alarmRole" jdbcType="VARCHAR" />
        <result column="alarm_phone" property="alarmPhone" jdbcType="VARCHAR" />
        <result column="detection_type" property="detectionType" jdbcType="VARCHAR" />
        <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
      </resultMap>
      <sql id="Example_Where_Clause" >
        <where >
          <foreach collection="oredCriteria" item="criteria" separator="or" >
            <if test="criteria.valid" >
              <trim prefix="(" suffix=")" prefixOverrides="and" >
                <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
                <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                        #{listItem}
                      </foreach>
                    </when>
                  </choose>
                </foreach>
              </trim>
            </if>
          </foreach>
        </where>
      </sql>
      <sql id="Base_Column_List" >
        id, org_id, alarm_man, alarm_role, alarm_phone, detection_type, updatetime
      </sql>
      <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhoneExample" >
        select
        <if test="distinct" >
          distinct
        </if>
        <include refid="Base_Column_List" />
        from monitor_alarm_phone
        <if test="_parameter != null" >
          <include refid="Example_Where_Clause" />
        </if>
        <if test="orderByClause != null" >
          order by ${orderByClause}
        </if>
      </select>
      <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
        select
        <include refid="Base_Column_List" />
        from monitor_alarm_phone
        where id = #{id,jdbcType=INTEGER}
      </select>
      <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
        delete from monitor_alarm_phone
        where id = #{id,jdbcType=INTEGER}
      </delete>
      <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhoneExample" >
        delete from monitor_alarm_phone
        <if test="_parameter != null" >
          <include refid="Example_Where_Clause" />
        </if>
      </delete>
      <insert id="insert" parameterType="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhone" >
        insert into monitor_alarm_phone (id, org_id, alarm_man,
        alarm_role, alarm_phone, detection_type,
        updatetime)
        values (SEQ_MONITOR_ALARM_PHONE.nextVal, #{orgId,jdbcType=INTEGER}, #{alarmMan,jdbcType=VARCHAR},
        #{alarmRole,jdbcType=VARCHAR}, #{alarmPhone,jdbcType=VARCHAR}, #{detectionType,jdbcType=VARCHAR},
        #{updatetime,jdbcType=TIMESTAMP})
      </insert>
      <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhone" >
        insert into monitor_alarm_phone
        <trim prefix="(" suffix=")" suffixOverrides="," >
          <if test="id != null" >
            id,
          </if>
          <if test="orgId != null" >
            org_id,
          </if>
          <if test="alarmMan != null" >
            alarm_man,
          </if>
          <if test="alarmRole != null" >
            alarm_role,
          </if>
          <if test="alarmPhone != null" >
            alarm_phone,
          </if>
          <if test="detectionType != null" >
            detection_type,
          </if>
          <if test="updatetime != null" >
            updatetime,
          </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
          SEQ_MONITOR_ALARM_PHONE.nextVal,
          <if test="orgId != null" >
            #{orgId,jdbcType=INTEGER},
          </if>
          <if test="alarmMan != null" >
            #{alarmMan,jdbcType=VARCHAR},
          </if>
          <if test="alarmRole != null" >
            #{alarmRole,jdbcType=VARCHAR},
          </if>
          <if test="alarmPhone != null" >
            #{alarmPhone,jdbcType=VARCHAR},
          </if>
          <if test="detectionType != null" >
            #{detectionType,jdbcType=VARCHAR},
          </if>
          <if test="updatetime != null" >
            #{updatetime,jdbcType=TIMESTAMP},
          </if>
        </trim>
      </insert>
      <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhoneExample" resultType="java.lang.Integer" >
        select count(*) from monitor_alarm_phone
        <if test="_parameter != null" >
          <include refid="Example_Where_Clause" />
        </if>
      </select>
      <update id="updateByExampleSelective" parameterType="map" >
        update monitor_alarm_phone
        <set >
          <if test="record.id != null" >
            id = #{record.id,jdbcType=INTEGER},
          </if>
          <if test="record.orgId != null" >
            org_id = #{record.orgId,jdbcType=INTEGER},
          </if>
          <if test="record.alarmMan != null" >
            alarm_man = #{record.alarmMan,jdbcType=VARCHAR},
          </if>
          <if test="record.alarmRole != null" >
            alarm_role = #{record.alarmRole,jdbcType=VARCHAR},
          </if>
          <if test="record.alarmPhone != null" >
            alarm_phone = #{record.alarmPhone,jdbcType=VARCHAR},
          </if>
          <if test="record.detectionType != null" >
            detection_type = #{record.detectionType,jdbcType=VARCHAR},
          </if>
          <if test="record.updatetime != null" >
            updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
          </if>
        </set>
        <if test="_parameter != null" >
          <include refid="Update_By_Example_Where_Clause" />
        </if>
      </update>
      <update id="updateByExample" parameterType="map" >
        update monitor_alarm_phone
        set id = #{record.id,jdbcType=INTEGER},
        org_id = #{record.orgId,jdbcType=INTEGER},
        alarm_man = #{record.alarmMan,jdbcType=VARCHAR},
        alarm_role = #{record.alarmRole,jdbcType=VARCHAR},
        alarm_phone = #{record.alarmPhone,jdbcType=VARCHAR},
        detection_type = #{record.detectionType,jdbcType=VARCHAR},
        updatetime = #{record.updatetime,jdbcType=TIMESTAMP}
        <if test="_parameter != null" >
          <include refid="Update_By_Example_Where_Clause" />
        </if>
      </update>
      <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhone" >
        update monitor_alarm_phone
        <set >
          <if test="orgId != null" >
            org_id = #{orgId,jdbcType=INTEGER},
          </if>
          <if test="alarmMan != null" >
            alarm_man = #{alarmMan,jdbcType=VARCHAR},
          </if>
          <if test="alarmRole != null" >
            alarm_role = #{alarmRole,jdbcType=VARCHAR},
          </if>
          <if test="alarmPhone != null" >
            alarm_phone = #{alarmPhone,jdbcType=VARCHAR},
          </if>
          <if test="detectionType != null" >
            detection_type = #{detectionType,jdbcType=VARCHAR},
          </if>
          <if test="updatetime != null" >
            updatetime = #{updatetime,jdbcType=TIMESTAMP},
          </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
      </update>
      <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.intelligent.basicdata.model.MonitorAlarmPhone" >
        update monitor_alarm_phone
        set org_id = #{orgId,jdbcType=INTEGER},
        alarm_man = #{alarmMan,jdbcType=VARCHAR},
        alarm_role = #{alarmRole,jdbcType=VARCHAR},
        alarm_phone = #{alarmPhone,jdbcType=VARCHAR},
        detection_type = #{detectionType,jdbcType=VARCHAR},
        updatetime = #{updatetime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=INTEGER}
      </update>
    </mapper>