<?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.metersphere.project.mapper.FunctionalCaseTemplateExtendMapper">
  <resultMap id="BaseResultMap" type="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="case_name" jdbcType="VARCHAR" property="caseName" />
    <result column="step_model" jdbcType="VARCHAR" property="stepModel" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
    <result column="prerequisite" jdbcType="LONGVARCHAR" property="prerequisite" />
    <result column="step_description" jdbcType="LONGVARCHAR" property="stepDescription" />
    <result column="expected_result" jdbcType="LONGVARCHAR" property="expectedResult" />
    <result column="actual_result" jdbcType="LONGVARCHAR" property="actualResult" />
    <result column="steps" jdbcType="LONGVARCHAR" property="steps" />
  </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, case_name, step_model
  </sql>
  <sql id="Blob_Column_List">
    prerequisite, step_description, expected_result, actual_result, steps
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from functional_case_template_extend
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from functional_case_template_extend
    <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 functional_case_template_extend
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from functional_case_template_extend
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample">
    delete from functional_case_template_extend
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
    insert into functional_case_template_extend (id, case_name, step_model, 
      prerequisite, step_description, 
      expected_result, actual_result, steps
      )
    values (#{id,jdbcType=VARCHAR}, #{caseName,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR}, 
      #{prerequisite,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR}, 
      #{expectedResult,jdbcType=LONGVARCHAR}, #{actualResult,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
    insert into functional_case_template_extend
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="caseName != null">
        case_name,
      </if>
      <if test="stepModel != null">
        step_model,
      </if>
      <if test="prerequisite != null">
        prerequisite,
      </if>
      <if test="stepDescription != null">
        step_description,
      </if>
      <if test="expectedResult != null">
        expected_result,
      </if>
      <if test="actualResult != null">
        actual_result,
      </if>
      <if test="steps != null">
        steps,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="caseName != null">
        #{caseName,jdbcType=VARCHAR},
      </if>
      <if test="stepModel != null">
        #{stepModel,jdbcType=VARCHAR},
      </if>
      <if test="prerequisite != null">
        #{prerequisite,jdbcType=LONGVARCHAR},
      </if>
      <if test="stepDescription != null">
        #{stepDescription,jdbcType=LONGVARCHAR},
      </if>
      <if test="expectedResult != null">
        #{expectedResult,jdbcType=LONGVARCHAR},
      </if>
      <if test="actualResult != null">
        #{actualResult,jdbcType=LONGVARCHAR},
      </if>
      <if test="steps != null">
        #{steps,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtendExample" resultType="java.lang.Long">
    select count(*) from functional_case_template_extend
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update functional_case_template_extend
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.caseName != null">
        case_name = #{record.caseName,jdbcType=VARCHAR},
      </if>
      <if test="record.stepModel != null">
        step_model = #{record.stepModel,jdbcType=VARCHAR},
      </if>
      <if test="record.prerequisite != null">
        prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.stepDescription != null">
        step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.expectedResult != null">
        expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.actualResult != null">
        actual_result = #{record.actualResult,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.steps != null">
        steps = #{record.steps,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update functional_case_template_extend
    set id = #{record.id,jdbcType=VARCHAR},
      case_name = #{record.caseName,jdbcType=VARCHAR},
      step_model = #{record.stepModel,jdbcType=VARCHAR},
      prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
      step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
      expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
      actual_result = #{record.actualResult,jdbcType=LONGVARCHAR},
      steps = #{record.steps,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update functional_case_template_extend
    set id = #{record.id,jdbcType=VARCHAR},
      case_name = #{record.caseName,jdbcType=VARCHAR},
      step_model = #{record.stepModel,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
    update functional_case_template_extend
    <set>
      <if test="caseName != null">
        case_name = #{caseName,jdbcType=VARCHAR},
      </if>
      <if test="stepModel != null">
        step_model = #{stepModel,jdbcType=VARCHAR},
      </if>
      <if test="prerequisite != null">
        prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
      </if>
      <if test="stepDescription != null">
        step_description = #{stepDescription,jdbcType=LONGVARCHAR},
      </if>
      <if test="expectedResult != null">
        expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
      </if>
      <if test="actualResult != null">
        actual_result = #{actualResult,jdbcType=LONGVARCHAR},
      </if>
      <if test="steps != null">
        steps = #{steps,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
    update functional_case_template_extend
    set case_name = #{caseName,jdbcType=VARCHAR},
      step_model = #{stepModel,jdbcType=VARCHAR},
      prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
      step_description = #{stepDescription,jdbcType=LONGVARCHAR},
      expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
      actual_result = #{actualResult,jdbcType=LONGVARCHAR},
      steps = #{steps,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.FunctionalCaseTemplateExtend">
    update functional_case_template_extend
    set case_name = #{caseName,jdbcType=VARCHAR},
      step_model = #{stepModel,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>