<?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.sdk.mapper.EnvironmentMapper">
  <resultMap id="BaseResultMap" type="io.metersphere.sdk.domain.Environment">
    <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" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="create_time" jdbcType="BIGINT" property="createTime" />
    <result column="update_time" jdbcType="BIGINT" property="updateTime" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.sdk.domain.Environment">
    <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, create_user, create_time, 
    update_time
  </sql>
  <sql id="Blob_Column_List">
    `variables`, headers, config, `hosts`
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="io.metersphere.sdk.domain.EnvironmentExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from 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.metersphere.sdk.domain.EnvironmentExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from 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 environment
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from environment
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.metersphere.sdk.domain.EnvironmentExample">
    delete from environment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.metersphere.sdk.domain.Environment">
    insert into environment (id, `name`, project_id, 
      protocol, socket, `domain`, 
      port, create_user, create_time, 
      update_time, `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}, #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, 
      #{updateTime,jdbcType=BIGINT}, #{variables,jdbcType=LONGVARCHAR}, #{headers,jdbcType=LONGVARCHAR}, 
      #{config,jdbcType=LONGVARCHAR}, #{hosts,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="io.metersphere.sdk.domain.Environment">
    insert into 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="createUser != null">
        create_user,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </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="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=BIGINT},
      </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.metersphere.sdk.domain.EnvironmentExample" resultType="java.lang.Long">
    select count(*) from environment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update 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.createUser != null">
        create_user = #{record.createUser,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.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 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},
      create_user = #{record.createUser,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=BIGINT},
      `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 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},
      create_user = #{record.createUser,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.sdk.domain.Environment">
    update 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="createUser != null">
        create_user = #{createUser,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="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.metersphere.sdk.domain.Environment">
    update 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},
      create_user = #{createUser,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=BIGINT},
      `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.metersphere.sdk.domain.Environment">
    update 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},
      create_user = #{createUser,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=BIGINT}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>