<?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 2023 . All rights reserved. -->
<!--  Mybatis数据库持久层（底层映射文件）：计划场景用例节点任务表 -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2023-11-13 14:35:52  -->
<mapper namespace="net.northking.cctp.executePlan.db.dao.AtuPlanSceneCaseTaskDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.executePlan.db.entity.AtuPlanSceneCaseTask">
      <!-- 主键 -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                                            <!-- 任务主键 -->
    <result column="task_id" jdbcType="VARCHAR" property="taskId"/>
        <!-- 脚本主键 -->
    <result column="script_id" jdbcType="VARCHAR" property="scriptId"/>
        <!-- 脚本版本id -->
    <result column="version_id" jdbcType="INTEGER" property="versionId"/>
        <!-- 脚本版本名称 -->
    <result column="version_name" jdbcType="VARCHAR" property="versionName"/>
        <!-- 脚本名称 -->
    <result column="script_name" jdbcType="VARCHAR" property="scriptName"/>
        <!-- 脚本存放地址 -->
    <result column="script_json" jdbcType="VARCHAR" property="scriptJson"/>
        <!-- 节点编号 -->
    <result column="node_id" jdbcType="VARCHAR" property="nodeId"/>
        <!-- 节点类型;1-接口，2-PC/BS，3-PC/CS，4-安卓，5-ios -->
    <result column="node_type" jdbcType="CHAR" property="nodeType"/>
        <!-- 节点参数 -->
    <result column="node_params" jdbcType="LONGVARCHAR" property="nodeParams"/>
        <!-- 上一节点编号 -->
    <result column="prev_node_id" jdbcType="VARCHAR" property="prevNodeId"/>
        <!-- 下一节点编号 -->
    <result column="next_node_id" jdbcType="VARCHAR" property="nextNodeId"/>
        <!-- 下一节点线编号 -->
    <result column="line_id" jdbcType="VARCHAR" property="lineId"/>
        <!-- 引擎主键 -->
    <result column="engine_id" jdbcType="VARCHAR" property="engineId"/>
        <!-- 设备主键 -->
    <result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
        <!-- 应用主键 -->
    <result column="app_id" jdbcType="VARCHAR" property="appId"/>
        <!-- 状态;0-等待中，1-执行中，2-执行成功，3-执行失败，4-断言失败，5-取消，6-超时 -->
    <result column="status" jdbcType="CHAR" property="status"/>
        <!-- 开始时间 -->
    <result column="start_time" jdbcType="BIGINT" property="startTime"/>
        <!-- 结束时间 -->
    <result column="end_time" jdbcType="BIGINT" property="endTime"/>
        <!-- 错误信息 -->
    <result column="error_msg" jdbcType="LONGVARCHAR" property="errorMsg"/>
        <!-- 视频地址 -->
    <result column="video_url" jdbcType="VARCHAR" property="videoUrl"/>
        <!-- 执行结果文件 -->
    <result column="exec_result_file" jdbcType="VARCHAR" property="execResultFile"/>
        <!-- 任务性能数据文件存放地址 -->
    <result column="per_data_path" jdbcType="VARCHAR" property="perDataPath"/>
        <!-- 创建时间 -->
    <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <!-- 执行心跳时间 -->
    <result column="last_heartbeat_time" jdbcType="TIMESTAMP" property="lastHeartbeatTime"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,task_id
    ,script_id
    ,version_id
    ,version_name
    ,script_name
    ,script_json
    ,node_id
    ,node_type
    ,node_params
    ,prev_node_id
    ,next_node_id
    ,line_id
    ,engine_id
    ,device_id
    ,app_id
    ,status
    ,start_time
    ,end_time
    ,error_msg
    ,video_url
    ,exec_result_file
    ,per_data_path
    ,created_time
    ,last_heartbeat_time
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.atu_plan_scene_case_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.AtuPlanSceneCaseTask">
    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="taskId != null">
          AND task_id=#{taskId,jdbcType=VARCHAR}
        </if>
              <if test="scriptId != null">
          AND script_id=#{scriptId,jdbcType=VARCHAR}
        </if>
              <if test="versionId != null">
          AND version_id=#{versionId,jdbcType=INTEGER}
        </if>
              <if test="versionName != null">
          AND version_name=#{versionName,jdbcType=VARCHAR}
        </if>
              <if test="scriptName != null">
          AND script_name=#{scriptName,jdbcType=VARCHAR}
        </if>
              <if test="scriptJson != null">
          AND script_json=#{scriptJson,jdbcType=VARCHAR}
        </if>
              <if test="nodeId != null">
          AND node_id=#{nodeId,jdbcType=VARCHAR}
        </if>
              <if test="nodeType != null">
          AND node_type=#{nodeType,jdbcType=CHAR}
        </if>
              <if test="nodeParams != null">
          AND node_params=#{nodeParams,jdbcType=LONGVARCHAR}
        </if>
              <if test="prevNodeId != null">
          AND prev_node_id=#{prevNodeId,jdbcType=VARCHAR}
        </if>
              <if test="nextNodeId != null">
          AND next_node_id=#{nextNodeId,jdbcType=VARCHAR}
        </if>
              <if test="lineId != null">
          AND line_id=#{lineId,jdbcType=VARCHAR}
        </if>
              <if test="engineId != null">
          AND engine_id=#{engineId,jdbcType=VARCHAR}
        </if>
              <if test="deviceId != null">
          AND device_id=#{deviceId,jdbcType=VARCHAR}
        </if>
              <if test="appId != null">
          AND app_id=#{appId,jdbcType=VARCHAR}
        </if>
              <if test="status != null">
          AND status=#{status,jdbcType=CHAR}
        </if>
              <if test="startTime != null">
          AND start_time=#{startTime,jdbcType=BIGINT}
        </if>
              <if test="endTime != null">
          AND end_time=#{endTime,jdbcType=BIGINT}
        </if>
              <if test="errorMsg != null">
          AND error_msg=#{errorMsg,jdbcType=LONGVARCHAR}
        </if>
              <if test="videoUrl != null">
          AND video_url=#{videoUrl,jdbcType=VARCHAR}
        </if>
              <if test="execResultFile != null">
          AND exec_result_file=#{execResultFile,jdbcType=VARCHAR}
        </if>
              <if test="perDataPath != null">
          AND per_data_path=#{perDataPath,jdbcType=VARCHAR}
        </if>
              <if test="createdTime != null">
          AND created_time=#{createdTime,jdbcType=TIMESTAMP}
        </if>
              <if test="lastHeartbeatTime != null">
          AND last_heartbeat_time=#{lastHeartbeatTime,jdbcType=TIMESTAMP}
        </if>
          </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.executePlan.db.entity.AtuPlanSceneCaseTask">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="taskId != null">
        task_id,
      </if>
      <if test="scriptId != null">
        script_id,
      </if>
      <if test="versionId != null">
        version_id,
      </if>
      <if test="versionName != null">
        version_name,
      </if>
      <if test="scriptName != null">
        script_name,
      </if>
      <if test="scriptJson != null">
        script_json,
      </if>
      <if test="nodeId != null">
        node_id,
      </if>
      <if test="nodeType != null">
        node_type,
      </if>
      <if test="nodeParams != null">
        node_params,
      </if>
      <if test="prevNodeId != null">
        prev_node_id,
      </if>
      <if test="nextNodeId != null">
        next_node_id,
      </if>
      <if test="lineId != null">
        line_id,
      </if>
      <if test="engineId != null">
        engine_id,
      </if>
      <if test="deviceId != null">
        device_id,
      </if>
      <if test="appId != null">
        app_id,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="startTime != null">
        start_time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="errorMsg != null">
        error_msg,
      </if>
      <if test="videoUrl != null">
        video_url,
      </if>
      <if test="execResultFile != null">
        exec_result_file,
      </if>
      <if test="perDataPath != null">
        per_data_path,
      </if>
      <if test="createdTime != null">
        created_time,
      </if>
      <if test="lastHeartbeatTime != null">
        last_heartbeat_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="taskId != null">
          #{taskId, jdbcType=VARCHAR},
      </if>
      <if test="scriptId != null">
          #{scriptId, jdbcType=VARCHAR},
      </if>
      <if test="versionId != null">
          #{versionId, jdbcType=INTEGER},
      </if>
      <if test="versionName != null">
          #{versionName, jdbcType=VARCHAR},
      </if>
      <if test="scriptName != null">
          #{scriptName, jdbcType=VARCHAR},
      </if>
      <if test="scriptJson != null">
          #{scriptJson, jdbcType=VARCHAR},
      </if>
      <if test="nodeId != null">
          #{nodeId, jdbcType=VARCHAR},
      </if>
      <if test="nodeType != null">
          #{nodeType, jdbcType=CHAR},
      </if>
      <if test="nodeParams != null">
          #{nodeParams, jdbcType=LONGVARCHAR},
      </if>
      <if test="prevNodeId != null">
          #{prevNodeId, jdbcType=VARCHAR},
      </if>
      <if test="nextNodeId != null">
          #{nextNodeId, jdbcType=VARCHAR},
      </if>
      <if test="lineId != null">
          #{lineId, jdbcType=VARCHAR},
      </if>
      <if test="engineId != null">
          #{engineId, jdbcType=VARCHAR},
      </if>
      <if test="deviceId != null">
          #{deviceId, jdbcType=VARCHAR},
      </if>
      <if test="appId != null">
          #{appId, jdbcType=VARCHAR},
      </if>
      <if test="status != null">
          #{status, jdbcType=CHAR},
      </if>
      <if test="startTime != null">
          #{startTime, jdbcType=BIGINT},
      </if>
      <if test="endTime != null">
          #{endTime, jdbcType=BIGINT},
      </if>
      <if test="errorMsg != null">
          #{errorMsg, jdbcType=LONGVARCHAR},
      </if>
      <if test="videoUrl != null">
          #{videoUrl, jdbcType=VARCHAR},
      </if>
      <if test="execResultFile != null">
          #{execResultFile, jdbcType=VARCHAR},
      </if>
      <if test="perDataPath != null">
          #{perDataPath, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
          #{createdTime, jdbcType=TIMESTAMP},
      </if>
      <if test="lastHeartbeatTime != null">
          #{lastHeartbeatTime, jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>

  <insert id="insertByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
    id,
    task_id,
    script_id,
    version_id,
    version_name,
    script_name,
    script_json,
    node_id,
    node_type,
    node_params,
    prev_node_id,
    next_node_id,
    line_id,
    engine_id,
    device_id,
    app_id,
    status,
    start_time,
    end_time,
    error_msg,
    video_url,
    exec_result_file,
    per_data_path,
    created_time,
    last_heartbeat_time,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.taskId, jdbcType=VARCHAR},
    #{item.scriptId, jdbcType=VARCHAR},
    #{item.versionId, jdbcType=INTEGER},
    #{item.versionName, jdbcType=VARCHAR},
    #{item.scriptName, jdbcType=VARCHAR},
    #{item.scriptJson, jdbcType=VARCHAR},
    #{item.nodeId, jdbcType=VARCHAR},
    #{item.nodeType, jdbcType=CHAR},
    #{item.nodeParams, jdbcType=LONGVARCHAR},
    #{item.prevNodeId, jdbcType=VARCHAR},
    #{item.nextNodeId, jdbcType=VARCHAR},
    #{item.lineId, jdbcType=VARCHAR},
    #{item.engineId, jdbcType=VARCHAR},
    #{item.deviceId, jdbcType=VARCHAR},
    #{item.appId, jdbcType=VARCHAR},
    #{item.status, jdbcType=CHAR},
    #{item.startTime, jdbcType=BIGINT},
    #{item.endTime, jdbcType=BIGINT},
    #{item.errorMsg, jdbcType=LONGVARCHAR},
    #{item.videoUrl, jdbcType=VARCHAR},
    #{item.execResultFile, jdbcType=VARCHAR},
    #{item.perDataPath, jdbcType=VARCHAR},
    #{item.createdTime, jdbcType=TIMESTAMP},
    #{item.lastHeartbeatTime, jdbcType=TIMESTAMP},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.executePlan.db.entity.AtuPlanSceneCaseTask">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="taskId != null">
        task_id = #{taskId, jdbcType=VARCHAR},
      </if>
      <if test="scriptId != null">
        script_id = #{scriptId, jdbcType=VARCHAR},
      </if>
      <if test="versionId != null">
        version_id = #{versionId, jdbcType=INTEGER},
      </if>
      <if test="versionName != null">
        version_name = #{versionName, jdbcType=VARCHAR},
      </if>
      <if test="scriptName != null">
        script_name = #{scriptName, jdbcType=VARCHAR},
      </if>
      <if test="scriptJson != null">
        script_json = #{scriptJson, jdbcType=VARCHAR},
      </if>
      <if test="nodeId != null">
        node_id = #{nodeId, jdbcType=VARCHAR},
      </if>
      <if test="nodeType != null">
        node_type = #{nodeType, jdbcType=CHAR},
      </if>
      <if test="nodeParams != null">
        node_params = #{nodeParams, jdbcType=LONGVARCHAR},
      </if>
      <if test="prevNodeId != null">
        prev_node_id = #{prevNodeId, jdbcType=VARCHAR},
      </if>
      <if test="nextNodeId != null">
        next_node_id = #{nextNodeId, jdbcType=VARCHAR},
      </if>
      <if test="lineId != null">
        line_id = #{lineId, jdbcType=VARCHAR},
      </if>
      <if test="engineId != null">
        engine_id = #{engineId, jdbcType=VARCHAR},
      </if>
      <if test="deviceId != null">
        device_id = #{deviceId, jdbcType=VARCHAR},
      </if>
      <if test="appId != null">
        app_id = #{appId, jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status, jdbcType=CHAR},
      </if>
      <if test="startTime != null">
        start_time = #{startTime, jdbcType=BIGINT},
      </if>
      <if test="endTime != null">
        end_time = #{endTime, jdbcType=BIGINT},
      </if>
      <if test="errorMsg != null">
        error_msg = #{errorMsg, jdbcType=LONGVARCHAR},
      </if>
      <if test="videoUrl != null">
        video_url = #{videoUrl, jdbcType=VARCHAR},
      </if>
      <if test="execResultFile != null">
        exec_result_file = #{execResultFile, jdbcType=VARCHAR},
      </if>
      <if test="perDataPath != null">
        per_data_path = #{perDataPath, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
        created_time = #{createdTime, jdbcType=TIMESTAMP},
      </if>
      <if test="lastHeartbeatTime != null">
        last_heartbeat_time = #{lastHeartbeatTime, jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.executePlan.db.entity.AtuPlanSceneCaseTask">
    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="taskId != null">
        AND task_id = #{taskId,jdbcType=VARCHAR}
      </if>
      <if test="scriptId != null">
        AND script_id = #{scriptId,jdbcType=VARCHAR}
      </if>
      <if test="versionId != null">
        AND version_id = #{versionId,jdbcType=INTEGER}
      </if>
      <if test="versionName != null">
        AND version_name = #{versionName,jdbcType=VARCHAR}
      </if>
      <if test="scriptName != null">
        AND script_name = #{scriptName,jdbcType=VARCHAR}
      </if>
      <if test="scriptJson != null">
        AND script_json = #{scriptJson,jdbcType=VARCHAR}
      </if>
      <if test="nodeId != null">
        AND node_id = #{nodeId,jdbcType=VARCHAR}
      </if>
      <if test="nodeType != null">
        AND node_type = #{nodeType,jdbcType=CHAR}
      </if>
      <if test="nodeParams != null">
        AND node_params = #{nodeParams,jdbcType=LONGVARCHAR}
      </if>
      <if test="prevNodeId != null">
        AND prev_node_id = #{prevNodeId,jdbcType=VARCHAR}
      </if>
      <if test="nextNodeId != null">
        AND next_node_id = #{nextNodeId,jdbcType=VARCHAR}
      </if>
      <if test="lineId != null">
        AND line_id = #{lineId,jdbcType=VARCHAR}
      </if>
      <if test="engineId != null">
        AND engine_id = #{engineId,jdbcType=VARCHAR}
      </if>
      <if test="deviceId != null">
        AND device_id = #{deviceId,jdbcType=VARCHAR}
      </if>
      <if test="appId != null">
        AND app_id = #{appId,jdbcType=VARCHAR}
      </if>
      <if test="status != null">
        AND status = #{status,jdbcType=CHAR}
      </if>
      <if test="startTime != null">
        AND start_time = #{startTime,jdbcType=BIGINT}
      </if>
      <if test="endTime != null">
        AND end_time = #{endTime,jdbcType=BIGINT}
      </if>
      <if test="errorMsg != null">
        AND error_msg = #{errorMsg,jdbcType=LONGVARCHAR}
      </if>
      <if test="videoUrl != null">
        AND video_url = #{videoUrl,jdbcType=VARCHAR}
      </if>
      <if test="execResultFile != null">
        AND exec_result_file = #{execResultFile,jdbcType=VARCHAR}
      </if>
      <if test="perDataPath != null">
        AND per_data_path = #{perDataPath,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time = #{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="lastHeartbeatTime != null">
        AND last_heartbeat_time = #{lastHeartbeatTime,jdbcType=TIMESTAMP}
      </if>
    </trim>
  </select>

  <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.executePlan.db.entity.AtuPlanSceneCaseTask">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="taskId != null">
        AND task_id=#{taskId,jdbcType=VARCHAR}
      </if>
      <if test="scriptId != null">
        AND script_id=#{scriptId,jdbcType=VARCHAR}
      </if>
      <if test="versionId != null">
        AND version_id=#{versionId,jdbcType=INTEGER}
      </if>
      <if test="versionName != null">
        AND version_name=#{versionName,jdbcType=VARCHAR}
      </if>
      <if test="scriptName != null">
        AND script_name=#{scriptName,jdbcType=VARCHAR}
      </if>
      <if test="scriptJson != null">
        AND script_json=#{scriptJson,jdbcType=VARCHAR}
      </if>
      <if test="nodeId != null">
        AND node_id=#{nodeId,jdbcType=VARCHAR}
      </if>
      <if test="nodeType != null">
        AND node_type=#{nodeType,jdbcType=CHAR}
      </if>
      <if test="nodeParams != null">
        AND node_params=#{nodeParams,jdbcType=LONGVARCHAR}
      </if>
      <if test="prevNodeId != null">
        AND prev_node_id=#{prevNodeId,jdbcType=VARCHAR}
      </if>
      <if test="nextNodeId != null">
        AND next_node_id=#{nextNodeId,jdbcType=VARCHAR}
      </if>
      <if test="lineId != null">
        AND line_id=#{lineId,jdbcType=VARCHAR}
      </if>
      <if test="engineId != null">
        AND engine_id=#{engineId,jdbcType=VARCHAR}
      </if>
      <if test="deviceId != null">
        AND device_id=#{deviceId,jdbcType=VARCHAR}
      </if>
      <if test="appId != null">
        AND app_id=#{appId,jdbcType=VARCHAR}
      </if>
      <if test="status != null">
        AND status=#{status,jdbcType=CHAR}
      </if>
      <if test="startTime != null">
        AND start_time=#{startTime,jdbcType=BIGINT}
      </if>
      <if test="endTime != null">
        AND end_time=#{endTime,jdbcType=BIGINT}
      </if>
      <if test="errorMsg != null">
        AND error_msg=#{errorMsg,jdbcType=LONGVARCHAR}
      </if>
      <if test="videoUrl != null">
        AND video_url=#{videoUrl,jdbcType=VARCHAR}
      </if>
      <if test="execResultFile != null">
        AND exec_result_file=#{execResultFile,jdbcType=VARCHAR}
      </if>
      <if test="perDataPath != null">
        AND per_data_path=#{perDataPath,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time=#{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="lastHeartbeatTime != null">
        AND last_heartbeat_time=#{lastHeartbeatTime,jdbcType=TIMESTAMP}
      </if>
    </trim>
  </select>

</mapper>