<?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.SystemParameterMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.SystemParameter">
    <id column="param_key" jdbcType="VARCHAR" property="paramKey" />
    <result column="param_value" jdbcType="VARCHAR" property="paramValue" />
    <result column="type" jdbcType="VARCHAR" property="type" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
  </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">
    param_key, param_value, type, sort
  </sql>
  <select id="selectByExample" parameterType="io.dataease.base.domain.SystemParameterExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from system_parameter
    <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 system_parameter
    where param_key = #{paramKey,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from system_parameter
    where param_key = #{paramKey,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.SystemParameterExample">
    delete from system_parameter
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.SystemParameter">
    insert into system_parameter (param_key, param_value, type,
      sort)
    values (#{paramKey,jdbcType=VARCHAR}, #{paramValue,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
      #{sort,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.SystemParameter">
    insert into system_parameter
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="paramKey != null">
        param_key,
      </if>
      <if test="paramValue != null">
        param_value,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="sort != null">
        sort,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="paramKey != null">
        #{paramKey,jdbcType=VARCHAR},
      </if>
      <if test="paramValue != null">
        #{paramValue,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        #{type,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.SystemParameterExample" resultType="java.lang.Long">
    select count(*) from system_parameter
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update system_parameter
    <set>
      <if test="record.paramKey != null">
        param_key = #{record.paramKey,jdbcType=VARCHAR},
      </if>
      <if test="record.paramValue != null">
        param_value = #{record.paramValue,jdbcType=VARCHAR},
      </if>
      <if test="record.type != null">
        type = #{record.type,jdbcType=VARCHAR},
      </if>
      <if test="record.sort != null">
        sort = #{record.sort,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update system_parameter
    set param_key = #{record.paramKey,jdbcType=VARCHAR},
      param_value = #{record.paramValue,jdbcType=VARCHAR},
      type = #{record.type,jdbcType=VARCHAR},
      sort = #{record.sort,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.SystemParameter">
    update system_parameter
    <set>
      <if test="paramValue != null">
        param_value = #{paramValue,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
    </set>
    where param_key = #{paramKey,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SystemParameter">
    update system_parameter
    set param_value = #{paramValue,jdbcType=VARCHAR},
      type = #{type,jdbcType=VARCHAR},
      sort = #{sort,jdbcType=INTEGER}
    where param_key = #{paramKey,jdbcType=VARCHAR}
  </update>
</mapper>
