<?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.system.mapper.PluginMapper">
  <resultMap id="BaseResultMap" type="io.metersphere.system.domain.Plugin">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="plugin_id" jdbcType="VARCHAR" property="pluginId" />
    <result column="script_id" jdbcType="VARCHAR" property="scriptId" />
    <result column="clazz_name" jdbcType="VARCHAR" property="clazzName" />
    <result column="jmeter_clazz" jdbcType="VARCHAR" property="jmeterClazz" />
    <result column="source_path" jdbcType="VARCHAR" property="sourcePath" />
    <result column="source_name" jdbcType="VARCHAR" property="sourceName" />
    <result column="exec_entry" jdbcType="VARCHAR" property="execEntry" />
    <result column="create_time" jdbcType="BIGINT" property="createTime" />
    <result column="update_time" jdbcType="BIGINT" property="updateTime" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="xpack" jdbcType="BIT" property="xpack" />
    <result column="scenario" jdbcType="VARCHAR" property="scenario" />
  </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`, plugin_id, script_id, clazz_name, jmeter_clazz, source_path, source_name, 
    exec_entry, create_time, update_time, create_user, xpack, scenario
  </sql>
  <select id="selectByExample" parameterType="io.metersphere.system.domain.PluginExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from plugin
    <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="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from plugin
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from plugin
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.metersphere.system.domain.PluginExample">
    delete from plugin
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.metersphere.system.domain.Plugin">
    insert into plugin (id, `name`, plugin_id, 
      script_id, clazz_name, jmeter_clazz, 
      source_path, source_name, exec_entry, 
      create_time, update_time, create_user, 
      xpack, scenario)
    values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pluginId,jdbcType=VARCHAR}, 
      #{scriptId,jdbcType=VARCHAR}, #{clazzName,jdbcType=VARCHAR}, #{jmeterClazz,jdbcType=VARCHAR}, 
      #{sourcePath,jdbcType=VARCHAR}, #{sourceName,jdbcType=VARCHAR}, #{execEntry,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, 
      #{xpack,jdbcType=BIT}, #{scenario,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="io.metersphere.system.domain.Plugin">
    insert into plugin
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="pluginId != null">
        plugin_id,
      </if>
      <if test="scriptId != null">
        script_id,
      </if>
      <if test="clazzName != null">
        clazz_name,
      </if>
      <if test="jmeterClazz != null">
        jmeter_clazz,
      </if>
      <if test="sourcePath != null">
        source_path,
      </if>
      <if test="sourceName != null">
        source_name,
      </if>
      <if test="execEntry != null">
        exec_entry,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="xpack != null">
        xpack,
      </if>
      <if test="scenario != null">
        scenario,
      </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="pluginId != null">
        #{pluginId,jdbcType=VARCHAR},
      </if>
      <if test="scriptId != null">
        #{scriptId,jdbcType=VARCHAR},
      </if>
      <if test="clazzName != null">
        #{clazzName,jdbcType=VARCHAR},
      </if>
      <if test="jmeterClazz != null">
        #{jmeterClazz,jdbcType=VARCHAR},
      </if>
      <if test="sourcePath != null">
        #{sourcePath,jdbcType=VARCHAR},
      </if>
      <if test="sourceName != null">
        #{sourceName,jdbcType=VARCHAR},
      </if>
      <if test="execEntry != null">
        #{execEntry,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=BIGINT},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="xpack != null">
        #{xpack,jdbcType=BIT},
      </if>
      <if test="scenario != null">
        #{scenario,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.metersphere.system.domain.PluginExample" resultType="java.lang.Long">
    select count(*) from plugin
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update plugin
    <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.pluginId != null">
        plugin_id = #{record.pluginId,jdbcType=VARCHAR},
      </if>
      <if test="record.scriptId != null">
        script_id = #{record.scriptId,jdbcType=VARCHAR},
      </if>
      <if test="record.clazzName != null">
        clazz_name = #{record.clazzName,jdbcType=VARCHAR},
      </if>
      <if test="record.jmeterClazz != null">
        jmeter_clazz = #{record.jmeterClazz,jdbcType=VARCHAR},
      </if>
      <if test="record.sourcePath != null">
        source_path = #{record.sourcePath,jdbcType=VARCHAR},
      </if>
      <if test="record.sourceName != null">
        source_name = #{record.sourceName,jdbcType=VARCHAR},
      </if>
      <if test="record.execEntry != null">
        exec_entry = #{record.execEntry,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.createUser != null">
        create_user = #{record.createUser,jdbcType=VARCHAR},
      </if>
      <if test="record.xpack != null">
        xpack = #{record.xpack,jdbcType=BIT},
      </if>
      <if test="record.scenario != null">
        scenario = #{record.scenario,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update plugin
    set id = #{record.id,jdbcType=VARCHAR},
      `name` = #{record.name,jdbcType=VARCHAR},
      plugin_id = #{record.pluginId,jdbcType=VARCHAR},
      script_id = #{record.scriptId,jdbcType=VARCHAR},
      clazz_name = #{record.clazzName,jdbcType=VARCHAR},
      jmeter_clazz = #{record.jmeterClazz,jdbcType=VARCHAR},
      source_path = #{record.sourcePath,jdbcType=VARCHAR},
      source_name = #{record.sourceName,jdbcType=VARCHAR},
      exec_entry = #{record.execEntry,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=BIGINT},
      create_user = #{record.createUser,jdbcType=VARCHAR},
      xpack = #{record.xpack,jdbcType=BIT},
      scenario = #{record.scenario,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.Plugin">
    update plugin
    <set>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="pluginId != null">
        plugin_id = #{pluginId,jdbcType=VARCHAR},
      </if>
      <if test="scriptId != null">
        script_id = #{scriptId,jdbcType=VARCHAR},
      </if>
      <if test="clazzName != null">
        clazz_name = #{clazzName,jdbcType=VARCHAR},
      </if>
      <if test="jmeterClazz != null">
        jmeter_clazz = #{jmeterClazz,jdbcType=VARCHAR},
      </if>
      <if test="sourcePath != null">
        source_path = #{sourcePath,jdbcType=VARCHAR},
      </if>
      <if test="sourceName != null">
        source_name = #{sourceName,jdbcType=VARCHAR},
      </if>
      <if test="execEntry != null">
        exec_entry = #{execEntry,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="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="xpack != null">
        xpack = #{xpack,jdbcType=BIT},
      </if>
      <if test="scenario != null">
        scenario = #{scenario,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.Plugin">
    update plugin
    set `name` = #{name,jdbcType=VARCHAR},
      plugin_id = #{pluginId,jdbcType=VARCHAR},
      script_id = #{scriptId,jdbcType=VARCHAR},
      clazz_name = #{clazzName,jdbcType=VARCHAR},
      jmeter_clazz = #{jmeterClazz,jdbcType=VARCHAR},
      source_path = #{sourcePath,jdbcType=VARCHAR},
      source_name = #{sourceName,jdbcType=VARCHAR},
      exec_entry = #{execEntry,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=BIGINT},
      create_user = #{createUser,jdbcType=VARCHAR},
      xpack = #{xpack,jdbcType=BIT},
      scenario = #{scenario,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>