<?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.ui.mapper.UiElementCommandReferenceMapper">
  <resultMap id="BaseResultMap" type="io.metersphere.ui.domain.UiElementCommandReference">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="element_id" jdbcType="VARCHAR" property="elementId" />
    <result column="element_module_id" jdbcType="VARCHAR" property="elementModuleId" />
    <result column="command_id" jdbcType="VARCHAR" property="commandId" />
    <result column="project_id" jdbcType="VARCHAR" property="projectId" />
  </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, element_id, element_module_id, command_id, project_id
  </sql>
  <select id="selectByExample" parameterType="io.metersphere.ui.domain.UiElementCommandReferenceExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from ui_element_command_reference
    <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 ui_element_command_reference
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from ui_element_command_reference
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.metersphere.ui.domain.UiElementCommandReferenceExample">
    delete from ui_element_command_reference
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.metersphere.ui.domain.UiElementCommandReference">
    insert into ui_element_command_reference (id, element_id, element_module_id, 
      command_id, project_id)
    values (#{id,jdbcType=VARCHAR}, #{elementId,jdbcType=VARCHAR}, #{elementModuleId,jdbcType=VARCHAR}, 
      #{commandId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="io.metersphere.ui.domain.UiElementCommandReference">
    insert into ui_element_command_reference
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="elementId != null">
        element_id,
      </if>
      <if test="elementModuleId != null">
        element_module_id,
      </if>
      <if test="commandId != null">
        command_id,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="elementId != null">
        #{elementId,jdbcType=VARCHAR},
      </if>
      <if test="elementModuleId != null">
        #{elementModuleId,jdbcType=VARCHAR},
      </if>
      <if test="commandId != null">
        #{commandId,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        #{projectId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.metersphere.ui.domain.UiElementCommandReferenceExample" resultType="java.lang.Long">
    select count(*) from ui_element_command_reference
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update ui_element_command_reference
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.elementId != null">
        element_id = #{record.elementId,jdbcType=VARCHAR},
      </if>
      <if test="record.elementModuleId != null">
        element_module_id = #{record.elementModuleId,jdbcType=VARCHAR},
      </if>
      <if test="record.commandId != null">
        command_id = #{record.commandId,jdbcType=VARCHAR},
      </if>
      <if test="record.projectId != null">
        project_id = #{record.projectId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update ui_element_command_reference
    set id = #{record.id,jdbcType=VARCHAR},
      element_id = #{record.elementId,jdbcType=VARCHAR},
      element_module_id = #{record.elementModuleId,jdbcType=VARCHAR},
      command_id = #{record.commandId,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.metersphere.ui.domain.UiElementCommandReference">
    update ui_element_command_reference
    <set>
      <if test="elementId != null">
        element_id = #{elementId,jdbcType=VARCHAR},
      </if>
      <if test="elementModuleId != null">
        element_module_id = #{elementModuleId,jdbcType=VARCHAR},
      </if>
      <if test="commandId != null">
        command_id = #{commandId,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        project_id = #{projectId,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.metersphere.ui.domain.UiElementCommandReference">
    update ui_element_command_reference
    set element_id = #{elementId,jdbcType=VARCHAR},
      element_module_id = #{elementModuleId,jdbcType=VARCHAR},
      command_id = #{commandId,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>