<?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.ApiTestEnvironmentMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.ApiTestEnvironment">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="project_id" jdbcType="VARCHAR" property="projectId" />
    <result column="protocol" jdbcType="VARCHAR" property="protocol" />
    <result column="socket" jdbcType="VARCHAR" property="socket" />
    <result column="domain" jdbcType="VARCHAR" property="domain" />
    <result column="port" jdbcType="INTEGER" property="port" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.ApiTestEnvironmentWithBLOBs">
    <result column="variables" jdbcType="LONGVARCHAR" property="variables" />
    <result column="headers" jdbcType="LONGVARCHAR" property="headers" />
    <result column="config" jdbcType="LONGVARCHAR" property="config" />
    <result column="hosts" jdbcType="LONGVARCHAR" property="hosts" />
  </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, `name`, project_id, protocol, socket, `domain`, port
  </sql>
  <sql id="Blob_Column_List">
    `variables`, headers, config, `hosts`
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.ApiTestEnvironmentExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from api_test_environment
    <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.ApiTestEnvironmentExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from api_test_environment
    <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 api_test_environment
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from api_test_environment
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.ApiTestEnvironmentExample">
    delete from api_test_environment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.ApiTestEnvironmentWithBLOBs">
    insert into api_test_environment (id, `name`, project_id,
      protocol, socket, `domain`,
      port, `variables`, headers,
      config, `hosts`)
    values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
      #{protocol,jdbcType=VARCHAR}, #{socket,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR},
      #{port,jdbcType=INTEGER}, #{variables,jdbcType=LONGVARCHAR}, #{headers,jdbcType=LONGVARCHAR},
      #{config,jdbcType=LONGVARCHAR}, #{hosts,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.ApiTestEnvironmentWithBLOBs">
    insert into api_test_environment
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="protocol != null">
        protocol,
      </if>
      <if test="socket != null">
        socket,
      </if>
      <if test="domain != null">
        `domain`,
      </if>
      <if test="port != null">
        port,
      </if>
      <if test="variables != null">
        `variables`,
      </if>
      <if test="headers != null">
        headers,
      </if>
      <if test="config != null">
        config,
      </if>
      <if test="hosts != null">
        `hosts`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="protocol != null">
        #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="socket != null">
        #{socket,jdbcType=VARCHAR},
      </if>
      <if test="domain != null">
        #{domain,jdbcType=VARCHAR},
      </if>
      <if test="port != null">
        #{port,jdbcType=INTEGER},
      </if>
      <if test="variables != null">
        #{variables,jdbcType=LONGVARCHAR},
      </if>
      <if test="headers != null">
        #{headers,jdbcType=LONGVARCHAR},
      </if>
      <if test="config != null">
        #{config,jdbcType=LONGVARCHAR},
      </if>
      <if test="hosts != null">
        #{hosts,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.ApiTestEnvironmentExample" resultType="java.lang.Long">
    select count(*) from api_test_environment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update api_test_environment
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        `name` = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.projectId != null">
        project_id = #{record.projectId,jdbcType=VARCHAR},
      </if>
      <if test="record.protocol != null">
        protocol = #{record.protocol,jdbcType=VARCHAR},
      </if>
      <if test="record.socket != null">
        socket = #{record.socket,jdbcType=VARCHAR},
      </if>
      <if test="record.domain != null">
        `domain` = #{record.domain,jdbcType=VARCHAR},
      </if>
      <if test="record.port != null">
        port = #{record.port,jdbcType=INTEGER},
      </if>
      <if test="record.variables != null">
        `variables` = #{record.variables,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.headers != null">
        headers = #{record.headers,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.config != null">
        config = #{record.config,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.hosts != null">
        `hosts` = #{record.hosts,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update api_test_environment
    set id = #{record.id,jdbcType=VARCHAR},
      `name` = #{record.name,jdbcType=VARCHAR},
      project_id = #{record.projectId,jdbcType=VARCHAR},
      protocol = #{record.protocol,jdbcType=VARCHAR},
      socket = #{record.socket,jdbcType=VARCHAR},
      `domain` = #{record.domain,jdbcType=VARCHAR},
      port = #{record.port,jdbcType=INTEGER},
      `variables` = #{record.variables,jdbcType=LONGVARCHAR},
      headers = #{record.headers,jdbcType=LONGVARCHAR},
      config = #{record.config,jdbcType=LONGVARCHAR},
      `hosts` = #{record.hosts,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update api_test_environment
    set id = #{record.id,jdbcType=VARCHAR},
      `name` = #{record.name,jdbcType=VARCHAR},
      project_id = #{record.projectId,jdbcType=VARCHAR},
      protocol = #{record.protocol,jdbcType=VARCHAR},
      socket = #{record.socket,jdbcType=VARCHAR},
      `domain` = #{record.domain,jdbcType=VARCHAR},
      port = #{record.port,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.ApiTestEnvironmentWithBLOBs">
    update api_test_environment
    <set>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        project_id = #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="protocol != null">
        protocol = #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="socket != null">
        socket = #{socket,jdbcType=VARCHAR},
      </if>
      <if test="domain != null">
        `domain` = #{domain,jdbcType=VARCHAR},
      </if>
      <if test="port != null">
        port = #{port,jdbcType=INTEGER},
      </if>
      <if test="variables != null">
        `variables` = #{variables,jdbcType=LONGVARCHAR},
      </if>
      <if test="headers != null">
        headers = #{headers,jdbcType=LONGVARCHAR},
      </if>
      <if test="config != null">
        config = #{config,jdbcType=LONGVARCHAR},
      </if>
      <if test="hosts != null">
        `hosts` = #{hosts,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.ApiTestEnvironmentWithBLOBs">
    update api_test_environment
    set `name` = #{name,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR},
      protocol = #{protocol,jdbcType=VARCHAR},
      socket = #{socket,jdbcType=VARCHAR},
      `domain` = #{domain,jdbcType=VARCHAR},
      port = #{port,jdbcType=INTEGER},
      `variables` = #{variables,jdbcType=LONGVARCHAR},
      headers = #{headers,jdbcType=LONGVARCHAR},
      config = #{config,jdbcType=LONGVARCHAR},
      `hosts` = #{hosts,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.ApiTestEnvironment">
    update api_test_environment
    set `name` = #{name,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR},
      protocol = #{protocol,jdbcType=VARCHAR},
      socket = #{socket,jdbcType=VARCHAR},
      `domain` = #{domain,jdbcType=VARCHAR},
      port = #{port,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>
