<?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.QuotaMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.Quota">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="api" jdbcType="INTEGER" property="api" />
    <result column="performance" jdbcType="INTEGER" property="performance" />
    <result column="max_threads" jdbcType="INTEGER" property="maxThreads" />
    <result column="duration" jdbcType="INTEGER" property="duration" />
    <result column="resource_pool" jdbcType="VARCHAR" property="resourcePool" />
    <result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
    <result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
    <result column="use_default" jdbcType="BIT" property="useDefault" />
    <result column="update_time" jdbcType="BIGINT" property="updateTime" />
  </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, api, performance, max_threads, duration, resource_pool, organization_id, workspace_id,
    use_default, update_time
  </sql>
  <select id="selectByExample" parameterType="io.dataease.base.domain.QuotaExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from quota
    <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 quota
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from quota
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.QuotaExample">
    delete from quota
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.Quota">
    insert into quota (id, api, performance,
      max_threads, duration, resource_pool,
      organization_id, workspace_id, use_default,
      update_time)
    values (#{id,jdbcType=VARCHAR}, #{api,jdbcType=INTEGER}, #{performance,jdbcType=INTEGER},
      #{maxThreads,jdbcType=INTEGER}, #{duration,jdbcType=INTEGER}, #{resourcePool,jdbcType=VARCHAR},
      #{organizationId,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{useDefault,jdbcType=BIT},
      #{updateTime,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.Quota">
    insert into quota
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="api != null">
        api,
      </if>
      <if test="performance != null">
        performance,
      </if>
      <if test="maxThreads != null">
        max_threads,
      </if>
      <if test="duration != null">
        duration,
      </if>
      <if test="resourcePool != null">
        resource_pool,
      </if>
      <if test="organizationId != null">
        organization_id,
      </if>
      <if test="workspaceId != null">
        workspace_id,
      </if>
      <if test="useDefault != null">
        use_default,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="api != null">
        #{api,jdbcType=INTEGER},
      </if>
      <if test="performance != null">
        #{performance,jdbcType=INTEGER},
      </if>
      <if test="maxThreads != null">
        #{maxThreads,jdbcType=INTEGER},
      </if>
      <if test="duration != null">
        #{duration,jdbcType=INTEGER},
      </if>
      <if test="resourcePool != null">
        #{resourcePool,jdbcType=VARCHAR},
      </if>
      <if test="organizationId != null">
        #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="workspaceId != null">
        #{workspaceId,jdbcType=VARCHAR},
      </if>
      <if test="useDefault != null">
        #{useDefault,jdbcType=BIT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.QuotaExample" resultType="java.lang.Long">
    select count(*) from quota
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update quota
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.api != null">
        api = #{record.api,jdbcType=INTEGER},
      </if>
      <if test="record.performance != null">
        performance = #{record.performance,jdbcType=INTEGER},
      </if>
      <if test="record.maxThreads != null">
        max_threads = #{record.maxThreads,jdbcType=INTEGER},
      </if>
      <if test="record.duration != null">
        duration = #{record.duration,jdbcType=INTEGER},
      </if>
      <if test="record.resourcePool != null">
        resource_pool = #{record.resourcePool,jdbcType=VARCHAR},
      </if>
      <if test="record.organizationId != null">
        organization_id = #{record.organizationId,jdbcType=VARCHAR},
      </if>
      <if test="record.workspaceId != null">
        workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
      </if>
      <if test="record.useDefault != null">
        use_default = #{record.useDefault,jdbcType=BIT},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update quota
    set id = #{record.id,jdbcType=VARCHAR},
      api = #{record.api,jdbcType=INTEGER},
      performance = #{record.performance,jdbcType=INTEGER},
      max_threads = #{record.maxThreads,jdbcType=INTEGER},
      duration = #{record.duration,jdbcType=INTEGER},
      resource_pool = #{record.resourcePool,jdbcType=VARCHAR},
      organization_id = #{record.organizationId,jdbcType=VARCHAR},
      workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
      use_default = #{record.useDefault,jdbcType=BIT},
      update_time = #{record.updateTime,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.Quota">
    update quota
    <set>
      <if test="api != null">
        api = #{api,jdbcType=INTEGER},
      </if>
      <if test="performance != null">
        performance = #{performance,jdbcType=INTEGER},
      </if>
      <if test="maxThreads != null">
        max_threads = #{maxThreads,jdbcType=INTEGER},
      </if>
      <if test="duration != null">
        duration = #{duration,jdbcType=INTEGER},
      </if>
      <if test="resourcePool != null">
        resource_pool = #{resourcePool,jdbcType=VARCHAR},
      </if>
      <if test="organizationId != null">
        organization_id = #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="workspaceId != null">
        workspace_id = #{workspaceId,jdbcType=VARCHAR},
      </if>
      <if test="useDefault != null">
        use_default = #{useDefault,jdbcType=BIT},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.Quota">
    update quota
    set api = #{api,jdbcType=INTEGER},
      performance = #{performance,jdbcType=INTEGER},
      max_threads = #{maxThreads,jdbcType=INTEGER},
      duration = #{duration,jdbcType=INTEGER},
      resource_pool = #{resourcePool,jdbcType=VARCHAR},
      organization_id = #{organizationId,jdbcType=VARCHAR},
      workspace_id = #{workspaceId,jdbcType=VARCHAR},
      use_default = #{useDefault,jdbcType=BIT},
      update_time = #{updateTime,jdbcType=BIGINT}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>
