<?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.IntelligentDetection.mapper.TTimingTaskMapper" >
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTask" >
    <id column="t_id" property="tId" jdbcType="VARCHAR" />
    <result column="org_id" property="orgId" jdbcType="VARCHAR" />
    <result column="t_name" property="tName" jdbcType="VARCHAR" />
    <result column="v_cf_code" property="vCfCode" jdbcType="VARCHAR" />
    <result column="t_state" property="tState" jdbcType="VARCHAR" />
    <result column="t_update_person" property="tUpdatePerson" jdbcType="VARCHAR" />
    <result column="t_update_time" property="tUpdateTime" jdbcType="TIMESTAMP" />
    <result column="t_detection_desc" property="tDetectionDesc" jdbcType="VARCHAR" />
    <result column="t_detection_cron" property="tDetectionCron" jdbcType="VARCHAR" />
    <result column="t_switch" property="tSwitch" jdbcType="VARCHAR" />
    <result column="t_category" property="tCategory" jdbcType="VARCHAR" />
  </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" >
    t_id, org_id, t_name, v_cf_code, t_state, t_update_person, t_update_time, t_detection_desc, 
    t_detection_cron, t_switch, t_category
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTaskExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_timing_task
    <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.String" >
    select 
    <include refid="Base_Column_List" />
    from t_timing_task
    where t_id = #{tId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from t_timing_task
    where t_id = #{tId,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTaskExample" >
    delete from t_timing_task
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTask" >
    insert into t_timing_task (t_id, org_id, t_name, 
      v_cf_code, t_state, t_update_person, 
      t_update_time, t_detection_desc, t_detection_cron, 
      t_switch, t_category)
    values (#{tId,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{tName,jdbcType=VARCHAR}, 
      #{vCfCode,jdbcType=VARCHAR}, #{tState,jdbcType=VARCHAR}, #{tUpdatePerson,jdbcType=VARCHAR}, 
      #{tUpdateTime,jdbcType=TIMESTAMP}, #{tDetectionDesc,jdbcType=VARCHAR}, #{tDetectionCron,jdbcType=VARCHAR}, 
      #{tSwitch,jdbcType=VARCHAR}, #{tCategory,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTask" >
    insert into t_timing_task
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="tId != null" >
        t_id,
      </if>
      <if test="orgId != null" >
        org_id,
      </if>
      <if test="tName != null" >
        t_name,
      </if>
      <if test="vCfCode != null" >
        v_cf_code,
      </if>
      <if test="tState != null" >
        t_state,
      </if>
      <if test="tUpdatePerson != null" >
        t_update_person,
      </if>
      <if test="tUpdateTime != null" >
        t_update_time,
      </if>
      <if test="tDetectionDesc != null" >
        t_detection_desc,
      </if>
      <if test="tDetectionCron != null" >
        t_detection_cron,
      </if>
      <if test="tSwitch != null" >
        t_switch,
      </if>
      <if test="tCategory != null" >
        t_category,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="tId != null" >
        #{tId,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null" >
        #{orgId,jdbcType=VARCHAR},
      </if>
      <if test="tName != null" >
        #{tName,jdbcType=VARCHAR},
      </if>
      <if test="vCfCode != null" >
        #{vCfCode,jdbcType=VARCHAR},
      </if>
      <if test="tState != null" >
        #{tState,jdbcType=VARCHAR},
      </if>
      <if test="tUpdatePerson != null" >
        #{tUpdatePerson,jdbcType=VARCHAR},
      </if>
      <if test="tUpdateTime != null" >
        #{tUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tDetectionDesc != null" >
        #{tDetectionDesc,jdbcType=VARCHAR},
      </if>
      <if test="tDetectionCron != null" >
        #{tDetectionCron,jdbcType=VARCHAR},
      </if>
      <if test="tSwitch != null" >
        #{tSwitch,jdbcType=VARCHAR},
      </if>
      <if test="tCategory != null" >
        #{tCategory,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTaskExample" resultType="java.lang.Integer" >
    select count(*) from t_timing_task
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_timing_task
    <set >
      <if test="record.tId != null" >
        t_id = #{record.tId,jdbcType=VARCHAR},
      </if>
      <if test="record.orgId != null" >
        org_id = #{record.orgId,jdbcType=VARCHAR},
      </if>
      <if test="record.tName != null" >
        t_name = #{record.tName,jdbcType=VARCHAR},
      </if>
      <if test="record.vCfCode != null" >
        v_cf_code = #{record.vCfCode,jdbcType=VARCHAR},
      </if>
      <if test="record.tState != null" >
        t_state = #{record.tState,jdbcType=VARCHAR},
      </if>
      <if test="record.tUpdatePerson != null" >
        t_update_person = #{record.tUpdatePerson,jdbcType=VARCHAR},
      </if>
      <if test="record.tUpdateTime != null" >
        t_update_time = #{record.tUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.tDetectionDesc != null" >
        t_detection_desc = #{record.tDetectionDesc,jdbcType=VARCHAR},
      </if>
      <if test="record.tDetectionCron != null" >
        t_detection_cron = #{record.tDetectionCron,jdbcType=VARCHAR},
      </if>
      <if test="record.tSwitch != null" >
        t_switch = #{record.tSwitch,jdbcType=VARCHAR},
      </if>
      <if test="record.tCategory != null" >
        t_category = #{record.tCategory,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_timing_task
    set t_id = #{record.tId,jdbcType=VARCHAR},
      org_id = #{record.orgId,jdbcType=VARCHAR},
      t_name = #{record.tName,jdbcType=VARCHAR},
      v_cf_code = #{record.vCfCode,jdbcType=VARCHAR},
      t_state = #{record.tState,jdbcType=VARCHAR},
      t_update_person = #{record.tUpdatePerson,jdbcType=VARCHAR},
      t_update_time = #{record.tUpdateTime,jdbcType=TIMESTAMP},
      t_detection_desc = #{record.tDetectionDesc,jdbcType=VARCHAR},
      t_detection_cron = #{record.tDetectionCron,jdbcType=VARCHAR},
      t_switch = #{record.tSwitch,jdbcType=VARCHAR},
      t_category = #{record.tCategory,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTask" >
    update t_timing_task
    <set >
      <if test="orgId != null" >
        org_id = #{orgId,jdbcType=VARCHAR},
      </if>
      <if test="tName != null" >
        t_name = #{tName,jdbcType=VARCHAR},
      </if>
      <if test="vCfCode != null" >
        v_cf_code = #{vCfCode,jdbcType=VARCHAR},
      </if>
      <if test="tState != null" >
        t_state = #{tState,jdbcType=VARCHAR},
      </if>
      <if test="tUpdatePerson != null" >
        t_update_person = #{tUpdatePerson,jdbcType=VARCHAR},
      </if>
      <if test="tUpdateTime != null" >
        t_update_time = #{tUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tDetectionDesc != null" >
        t_detection_desc = #{tDetectionDesc,jdbcType=VARCHAR},
      </if>
      <if test="tDetectionCron != null" >
        t_detection_cron = #{tDetectionCron,jdbcType=VARCHAR},
      </if>
      <if test="tSwitch != null" >
        t_switch = #{tSwitch,jdbcType=VARCHAR},
      </if>
      <if test="tCategory != null" >
        t_category = #{tCategory,jdbcType=VARCHAR},
      </if>
    </set>
    where t_id = #{tId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTask" >
    update t_timing_task
    set org_id = #{orgId,jdbcType=VARCHAR},
      t_name = #{tName,jdbcType=VARCHAR},
      v_cf_code = #{vCfCode,jdbcType=VARCHAR},
      t_state = #{tState,jdbcType=VARCHAR},
      t_update_person = #{tUpdatePerson,jdbcType=VARCHAR},
      t_update_time = #{tUpdateTime,jdbcType=TIMESTAMP},
      t_detection_desc = #{tDetectionDesc,jdbcType=VARCHAR},
      t_detection_cron = #{tDetectionCron,jdbcType=VARCHAR},
      t_switch = #{tSwitch,jdbcType=VARCHAR},
      t_category = #{tCategory,jdbcType=VARCHAR}
    where t_id = #{tId,jdbcType=VARCHAR}
  </update>

    <select id="selectStartData" resultMap="BaseResultMap">
        SELECT
        DISTINCT
        <include refid="Base_Column_List"/>
        FROM
        t_timing_task
        WHERE
        v_cf_code IS NOT NULL
        AND t_detection_cron IS NOT NULL
        AND t_category IS NOT NULL
        AND t_switch = '1'
    </select>
</mapper>