<?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数据库持久层（业务层映射文件）： -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2022-03-22 17:00:55  -->
<mapper namespace="net.northking.cctp.dw.db.dao.DwManualExecJobDao">

  <insert id="insertManualExecJobByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      id,
      dir_id,
      project_id,
      case_id,
      exec_status,
      resp_owner,
      resp_owner_type,
      created_by,
      created_time,
      updated_by,
      updated_time,
      tenant_id,
      is_deleted,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
        #{item.id, jdbcType=VARCHAR},
        #{item.dirId, jdbcType=VARCHAR},
        #{item.projectId, jdbcType=VARCHAR},
        #{item.caseId, jdbcType=VARCHAR},
        #{item.execStatus, jdbcType=INTEGER},
        #{item.respOwner, jdbcType=VARCHAR},
        #{item.respOwnerType, jdbcType=CHAR},
        #{item.createdBy, jdbcType=VARCHAR},
        #{item.createdTime, jdbcType=TIMESTAMP},
        #{item.updatedBy, jdbcType=VARCHAR},
        #{item.updatedTime, jdbcType=TIMESTAMP},
        #{item.tenantId, jdbcType=VARCHAR},
        #{item.deleted, jdbcType=BIT},
      </trim>
    </foreach>
  </insert>

  <select id="findProIdList" resultType="net.northking.cctp.dw.db.entity.MidProjectInfo">
    (
    select tenant_id AS tenantId, project_id AS projectId
    from dw_manual_exec_job
    group by tenant_id,project_id
    )
    union
    (
    SELECT tenant_id AS tenantId ,project_id AS projectId
    FROM dw_case_design_info
    GROUP BY tenant_id, project_id
    )
    union
    (
    select
    tenant_id AS tenantId, project_id AS projectId
    from dw_test_point
    group by
    tenant_id, project_id
    )
  </select>
</mapper>