<?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="io.dataease.base.mapper.TestPlanMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.TestPlan">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
    <result column="report_id" jdbcType="VARCHAR" property="reportId" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="status" jdbcType="VARCHAR" property="status" />
    <result column="stage" jdbcType="VARCHAR" property="stage" />
    <result column="principal" jdbcType="VARCHAR" property="principal" />
    <result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" />
    <result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" />
    <result column="create_time" jdbcType="BIGINT" property="createTime" />
    <result column="update_time" jdbcType="BIGINT" property="updateTime" />
    <result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
    <result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime" />
    <result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime" />
    <result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
    <result column="creator" jdbcType="VARCHAR" property="creator" />
    <result column="project_id" jdbcType="VARCHAR" property="projectId" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.TestPlan">
    <result column="tags" jdbcType="LONGVARCHAR" property="tags" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
    executor_match_rule, create_time, update_time, actual_end_time, planned_start_time,
    planned_end_time, actual_start_time, creator, project_id
  </sql>
  <sql id="Blob_Column_List">
    tags
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.TestPlanExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from test_plan
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="io.dataease.base.domain.TestPlanExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from test_plan
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from test_plan
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from test_plan
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.TestPlanExample">
    delete from test_plan
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.TestPlan">
    insert into test_plan (id, workspace_id, report_id,
      `name`, description, `status`,
      stage, principal, test_case_match_rule,
      executor_match_rule, create_time, update_time,
      actual_end_time, planned_start_time, planned_end_time,
      actual_start_time, creator, project_id,
      tags)
    values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
      #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
      #{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
      #{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
      #{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
      #{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
      #{tags,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.TestPlan">
    insert into test_plan
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="workspaceId != null">
        workspace_id,
      </if>
      <if test="reportId != null">
        report_id,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="stage != null">
        stage,
      </if>
      <if test="principal != null">
        principal,
      </if>
      <if test="testCaseMatchRule != null">
        test_case_match_rule,
      </if>
      <if test="executorMatchRule != null">
        executor_match_rule,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="actualEndTime != null">
        actual_end_time,
      </if>
      <if test="plannedStartTime != null">
        planned_start_time,
      </if>
      <if test="plannedEndTime != null">
        planned_end_time,
      </if>
      <if test="actualStartTime != null">
        actual_start_time,
      </if>
      <if test="creator != null">
        creator,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="tags != null">
        tags,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="workspaceId != null">
        #{workspaceId,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=VARCHAR},
      </if>
      <if test="stage != null">
        #{stage,jdbcType=VARCHAR},
      </if>
      <if test="principal != null">
        #{principal,jdbcType=VARCHAR},
      </if>
      <if test="testCaseMatchRule != null">
        #{testCaseMatchRule,jdbcType=VARCHAR},
      </if>
      <if test="executorMatchRule != null">
        #{executorMatchRule,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=BIGINT},
      </if>
      <if test="actualEndTime != null">
        #{actualEndTime,jdbcType=BIGINT},
      </if>
      <if test="plannedStartTime != null">
        #{plannedStartTime,jdbcType=BIGINT},
      </if>
      <if test="plannedEndTime != null">
        #{plannedEndTime,jdbcType=BIGINT},
      </if>
      <if test="actualStartTime != null">
        #{actualStartTime,jdbcType=BIGINT},
      </if>
      <if test="creator != null">
        #{creator,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="tags != null">
        #{tags,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.TestPlanExample" resultType="java.lang.Long">
    select count(*) from test_plan
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update test_plan
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.workspaceId != null">
        workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
      </if>
      <if test="record.reportId != null">
        report_id = #{record.reportId,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        `name` = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.description != null">
        description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null">
        `status` = #{record.status,jdbcType=VARCHAR},
      </if>
      <if test="record.stage != null">
        stage = #{record.stage,jdbcType=VARCHAR},
      </if>
      <if test="record.principal != null">
        principal = #{record.principal,jdbcType=VARCHAR},
      </if>
      <if test="record.testCaseMatchRule != null">
        test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
      </if>
      <if test="record.executorMatchRule != null">
        executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=BIGINT},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=BIGINT},
      </if>
      <if test="record.actualEndTime != null">
        actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
      </if>
      <if test="record.plannedStartTime != null">
        planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
      </if>
      <if test="record.plannedEndTime != null">
        planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
      </if>
      <if test="record.actualStartTime != null">
        actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
      </if>
      <if test="record.creator != null">
        creator = #{record.creator,jdbcType=VARCHAR},
      </if>
      <if test="record.projectId != null">
        project_id = #{record.projectId,jdbcType=VARCHAR},
      </if>
      <if test="record.tags != null">
        tags = #{record.tags,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update test_plan
    set id = #{record.id,jdbcType=VARCHAR},
      workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
      report_id = #{record.reportId,jdbcType=VARCHAR},
      `name` = #{record.name,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      `status` = #{record.status,jdbcType=VARCHAR},
      stage = #{record.stage,jdbcType=VARCHAR},
      principal = #{record.principal,jdbcType=VARCHAR},
      test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
      executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=BIGINT},
      actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
      planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
      planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
      actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
      creator = #{record.creator,jdbcType=VARCHAR},
      project_id = #{record.projectId,jdbcType=VARCHAR},
      tags = #{record.tags,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update test_plan
    set id = #{record.id,jdbcType=VARCHAR},
      workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
      report_id = #{record.reportId,jdbcType=VARCHAR},
      `name` = #{record.name,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      `status` = #{record.status,jdbcType=VARCHAR},
      stage = #{record.stage,jdbcType=VARCHAR},
      principal = #{record.principal,jdbcType=VARCHAR},
      test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
      executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=BIGINT},
      actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
      planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
      planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
      actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
      creator = #{record.creator,jdbcType=VARCHAR},
      project_id = #{record.projectId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.TestPlan">
    update test_plan
    <set>
      <if test="workspaceId != null">
        workspace_id = #{workspaceId,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        report_id = #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=VARCHAR},
      </if>
      <if test="stage != null">
        stage = #{stage,jdbcType=VARCHAR},
      </if>
      <if test="principal != null">
        principal = #{principal,jdbcType=VARCHAR},
      </if>
      <if test="testCaseMatchRule != null">
        test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
      </if>
      <if test="executorMatchRule != null">
        executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=BIGINT},
      </if>
      <if test="actualEndTime != null">
        actual_end_time = #{actualEndTime,jdbcType=BIGINT},
      </if>
      <if test="plannedStartTime != null">
        planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
      </if>
      <if test="plannedEndTime != null">
        planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
      </if>
      <if test="actualStartTime != null">
        actual_start_time = #{actualStartTime,jdbcType=BIGINT},
      </if>
      <if test="creator != null">
        creator = #{creator,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        project_id = #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="tags != null">
        tags = #{tags,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.TestPlan">
    update test_plan
    set workspace_id = #{workspaceId,jdbcType=VARCHAR},
      report_id = #{reportId,jdbcType=VARCHAR},
      `name` = #{name,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=VARCHAR},
      stage = #{stage,jdbcType=VARCHAR},
      principal = #{principal,jdbcType=VARCHAR},
      test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
      executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=BIGINT},
      actual_end_time = #{actualEndTime,jdbcType=BIGINT},
      planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
      planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
      actual_start_time = #{actualStartTime,jdbcType=BIGINT},
      creator = #{creator,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR},
      tags = #{tags,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.TestPlan">
    update test_plan
    set workspace_id = #{workspaceId,jdbcType=VARCHAR},
      report_id = #{reportId,jdbcType=VARCHAR},
      `name` = #{name,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=VARCHAR},
      stage = #{stage,jdbcType=VARCHAR},
      principal = #{principal,jdbcType=VARCHAR},
      test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
      executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=BIGINT},
      actual_end_time = #{actualEndTime,jdbcType=BIGINT},
      planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
      planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
      actual_start_time = #{actualStartTime,jdbcType=BIGINT},
      creator = #{creator,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>
