<?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">
<!--  Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved. -->
<!--  Mybatis数据库持久层（底层映射文件）：dw同步表 -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2022-11-24 12:13:20  -->
<mapper namespace="net.northking.cctp.executePlan.db.dao.MqSynchronizeTaskDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.executePlan.db.entity.MqSynchronizeTask">
      <!--  -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                  <!--  -->
    <result column="task_info" jdbcType="LONGVARCHAR" property="taskInfo"/>
        <!-- 0-自动化用例，1-脚本，2-业务组件，3-脚本版本 -->
    <result column="task_type" jdbcType="INTEGER" property="taskType"/>
        <!--  -->
    <result column="created_time" jdbcType="DATE" property="createdTime"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,task_info
    ,task_type
    ,created_time
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.mq_synchronize_task
  </sql>

  <select id="findByPrimaryKey" parameterType="String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=VARCHAR}
  </select>

  <select id="findByPrimaryKeys" parameterType="java.util.List">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
  </select>

  <delete id="deleteByPrimaryKey" parameterType="String">
    delete from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=VARCHAR}
  </delete>

  <delete id="deleteByPrimaryKeys" parameterType="String">
    delete from
    <include refid="Table_Name"/>
    where id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <delete id="deleteByExample" parameterType="net.northking.cctp.executePlan.db.entity.MqSynchronizeTask">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <choose>
        <when test="id != null">
          id = #{id,jdbcType=VARCHAR}
        </when>
      </choose>
              <if test="id != null">
          AND id=#{id,jdbcType=VARCHAR}
        </if>
              <if test="taskInfo != null">
          AND task_info=#{taskInfo,jdbcType=LONGVARCHAR}
        </if>
              <if test="taskType != null">
          AND task_type=#{taskType,jdbcType=INTEGER}
        </if>
              <if test="createdTime != null">
          AND created_time=#{createdTime,jdbcType=DATE}
        </if>
          </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.executePlan.db.entity.MqSynchronizeTask">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="taskInfo != null">
        task_info,
      </if>
      <if test="taskType != null">
        task_type,
      </if>
      <if test="createdTime != null">
        created_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="taskInfo != null">
          #{taskInfo, jdbcType=LONGVARCHAR},
      </if>
      <if test="type != null">
          #{taskType, jdbcType=INTEGER},
      </if>
      <if test="createdTime != null">
          #{createdTime, jdbcType=DATE},
      </if>
    </trim>
  </insert>

  <insert id="insertByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
    id,
    task_info,
    task_type,
    created_time,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.taskInfo, jdbcType=LONGVARCHAR},
    #{item.taskType, jdbcType=INTEGER},
    #{item.createdTime, jdbcType=DATE},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.executePlan.db.entity.MqSynchronizeTask">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="taskInfo != null">
        task_info = #{taskInfo, jdbcType=LONGVARCHAR},
      </if>
      <if test="taskType != null">
        task_type = #{taskType, jdbcType=INTEGER},
      </if>
      <if test="createdTime != null">
        created_time = #{createdTime, jdbcType=DATE},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.executePlan.db.entity.MqSynchronizeTask">
    select
    <include refid="Base_Column_List" />
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id = #{id,jdbcType=VARCHAR}
      </if>
      <if test="taskInfo != null">
        AND task_info = #{taskInfo,jdbcType=LONGVARCHAR}
      </if>
      <if test="taskType != null">
        AND task_type = #{taskType,jdbcType=INTEGER}
      </if>
      <if test="createdTime != null">
        AND created_time = #{createdTime,jdbcType=DATE}
      </if>
    </trim>
  </select>

  <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.executePlan.db.entity.MqSynchronizeTask">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="taskInfo != null">
        AND task_info=#{taskInfo,jdbcType=LONGVARCHAR}
      </if>
      <if test="taskType != null">
        AND task_type=#{taskType,jdbcType=INTEGER}
      </if>
      <if test="createdTime != null">
        AND created_time=#{createdTime,jdbcType=DATE}
      </if>
    </trim>
  </select>

</mapper>