<?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">


  <!-- 请在本文件内添加自定义SQL语句 -->

  <resultMap id="DetailMap" 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>

  <select id="pagingQuery" resultMap="DetailMap" parameterType="net.northking.cctp.executePlan.db.entity.MqSynchronizeTask">
    select
    id
    ,task_info
    ,task_type
    ,created_time
    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="findByTypes" resultMap="DetailMap">
    select
    id
    ,task_info
    ,task_type
    ,created_time
    from
    <include refid="Table_Name"/>
    where
    task_type in
    <foreach collection="types" close=")" separator="," open="(" item="type" >
      #{type}
    </foreach>
  </select>
</mapper>