<?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.QuotaMapper">
  <resultMap id="BaseResultMap" type="io.metersphere.system.domain.Quota">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
    <result column="project_id" jdbcType="VARCHAR" property="projectId" />
    <result column="functional_case" jdbcType="INTEGER" property="functionalCase" />
    <result column="load_test_vum_total" jdbcType="DECIMAL" property="loadTestVumTotal" />
    <result column="load_test_vum_used" jdbcType="DECIMAL" property="loadTestVumUsed" />
    <result column="load_test_max_threads" jdbcType="INTEGER" property="loadTestMaxThreads" />
    <result column="load_test_duration" jdbcType="INTEGER" property="loadTestDuration" />
    <result column="resource_pool" jdbcType="VARCHAR" property="resourcePool" />
    <result column="use_default" jdbcType="BIT" property="useDefault" />
    <result column="update_time" jdbcType="BIGINT" property="updateTime" />
    <result column="member" jdbcType="INTEGER" property="member" />
    <result column="project" jdbcType="INTEGER" property="project" />
    <result column="api_test_vum_total" jdbcType="DECIMAL" property="apiTestVumTotal" />
    <result column="api_test_vum_used" jdbcType="DECIMAL" property="apiTestVumUsed" />
    <result column="ui_test_vum_total" jdbcType="DECIMAL" property="uiTestVumTotal" />
    <result column="ui_test_vum_used" jdbcType="DECIMAL" property="uiTestVumUsed" />
    <result column="file_storage" jdbcType="BIGINT" property="fileStorage" />
  </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, organization_id, project_id, functional_case, load_test_vum_total, load_test_vum_used, 
    load_test_max_threads, load_test_duration, resource_pool, use_default, update_time, 
    `member`, project, api_test_vum_total, api_test_vum_used, ui_test_vum_total, ui_test_vum_used, 
    file_storage
  </sql>
  <select id="selectByExample" parameterType="io.metersphere.system.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.metersphere.system.domain.QuotaExample">
    delete from quota
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.metersphere.system.domain.Quota">
    insert into quota (id, organization_id, project_id, 
      functional_case, load_test_vum_total, load_test_vum_used, 
      load_test_max_threads, load_test_duration, resource_pool, 
      use_default, update_time, `member`, 
      project, api_test_vum_total, api_test_vum_used, 
      ui_test_vum_total, ui_test_vum_used, file_storage
      )
    values (#{id,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, 
      #{functionalCase,jdbcType=INTEGER}, #{loadTestVumTotal,jdbcType=DECIMAL}, #{loadTestVumUsed,jdbcType=DECIMAL}, 
      #{loadTestMaxThreads,jdbcType=INTEGER}, #{loadTestDuration,jdbcType=INTEGER}, #{resourcePool,jdbcType=VARCHAR}, 
      #{useDefault,jdbcType=BIT}, #{updateTime,jdbcType=BIGINT}, #{member,jdbcType=INTEGER}, 
      #{project,jdbcType=INTEGER}, #{apiTestVumTotal,jdbcType=DECIMAL}, #{apiTestVumUsed,jdbcType=DECIMAL}, 
      #{uiTestVumTotal,jdbcType=DECIMAL}, #{uiTestVumUsed,jdbcType=DECIMAL}, #{fileStorage,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="io.metersphere.system.domain.Quota">
    insert into quota
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="organizationId != null">
        organization_id,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="functionalCase != null">
        functional_case,
      </if>
      <if test="loadTestVumTotal != null">
        load_test_vum_total,
      </if>
      <if test="loadTestVumUsed != null">
        load_test_vum_used,
      </if>
      <if test="loadTestMaxThreads != null">
        load_test_max_threads,
      </if>
      <if test="loadTestDuration != null">
        load_test_duration,
      </if>
      <if test="resourcePool != null">
        resource_pool,
      </if>
      <if test="useDefault != null">
        use_default,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="member != null">
        `member`,
      </if>
      <if test="project != null">
        project,
      </if>
      <if test="apiTestVumTotal != null">
        api_test_vum_total,
      </if>
      <if test="apiTestVumUsed != null">
        api_test_vum_used,
      </if>
      <if test="uiTestVumTotal != null">
        ui_test_vum_total,
      </if>
      <if test="uiTestVumUsed != null">
        ui_test_vum_used,
      </if>
      <if test="fileStorage != null">
        file_storage,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="organizationId != null">
        #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="functionalCase != null">
        #{functionalCase,jdbcType=INTEGER},
      </if>
      <if test="loadTestVumTotal != null">
        #{loadTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="loadTestVumUsed != null">
        #{loadTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="loadTestMaxThreads != null">
        #{loadTestMaxThreads,jdbcType=INTEGER},
      </if>
      <if test="loadTestDuration != null">
        #{loadTestDuration,jdbcType=INTEGER},
      </if>
      <if test="resourcePool != null">
        #{resourcePool,jdbcType=VARCHAR},
      </if>
      <if test="useDefault != null">
        #{useDefault,jdbcType=BIT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=BIGINT},
      </if>
      <if test="member != null">
        #{member,jdbcType=INTEGER},
      </if>
      <if test="project != null">
        #{project,jdbcType=INTEGER},
      </if>
      <if test="apiTestVumTotal != null">
        #{apiTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="apiTestVumUsed != null">
        #{apiTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="uiTestVumTotal != null">
        #{uiTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="uiTestVumUsed != null">
        #{uiTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="fileStorage != null">
        #{fileStorage,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.metersphere.system.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.organizationId != null">
        organization_id = #{record.organizationId,jdbcType=VARCHAR},
      </if>
      <if test="record.projectId != null">
        project_id = #{record.projectId,jdbcType=VARCHAR},
      </if>
      <if test="record.functionalCase != null">
        functional_case = #{record.functionalCase,jdbcType=INTEGER},
      </if>
      <if test="record.loadTestVumTotal != null">
        load_test_vum_total = #{record.loadTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="record.loadTestVumUsed != null">
        load_test_vum_used = #{record.loadTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="record.loadTestMaxThreads != null">
        load_test_max_threads = #{record.loadTestMaxThreads,jdbcType=INTEGER},
      </if>
      <if test="record.loadTestDuration != null">
        load_test_duration = #{record.loadTestDuration,jdbcType=INTEGER},
      </if>
      <if test="record.resourcePool != null">
        resource_pool = #{record.resourcePool,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>
      <if test="record.member != null">
        `member` = #{record.member,jdbcType=INTEGER},
      </if>
      <if test="record.project != null">
        project = #{record.project,jdbcType=INTEGER},
      </if>
      <if test="record.apiTestVumTotal != null">
        api_test_vum_total = #{record.apiTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="record.apiTestVumUsed != null">
        api_test_vum_used = #{record.apiTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="record.uiTestVumTotal != null">
        ui_test_vum_total = #{record.uiTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="record.uiTestVumUsed != null">
        ui_test_vum_used = #{record.uiTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="record.fileStorage != null">
        file_storage = #{record.fileStorage,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},
      organization_id = #{record.organizationId,jdbcType=VARCHAR},
      project_id = #{record.projectId,jdbcType=VARCHAR},
      functional_case = #{record.functionalCase,jdbcType=INTEGER},
      load_test_vum_total = #{record.loadTestVumTotal,jdbcType=DECIMAL},
      load_test_vum_used = #{record.loadTestVumUsed,jdbcType=DECIMAL},
      load_test_max_threads = #{record.loadTestMaxThreads,jdbcType=INTEGER},
      load_test_duration = #{record.loadTestDuration,jdbcType=INTEGER},
      resource_pool = #{record.resourcePool,jdbcType=VARCHAR},
      use_default = #{record.useDefault,jdbcType=BIT},
      update_time = #{record.updateTime,jdbcType=BIGINT},
      `member` = #{record.member,jdbcType=INTEGER},
      project = #{record.project,jdbcType=INTEGER},
      api_test_vum_total = #{record.apiTestVumTotal,jdbcType=DECIMAL},
      api_test_vum_used = #{record.apiTestVumUsed,jdbcType=DECIMAL},
      ui_test_vum_total = #{record.uiTestVumTotal,jdbcType=DECIMAL},
      ui_test_vum_used = #{record.uiTestVumUsed,jdbcType=DECIMAL},
      file_storage = #{record.fileStorage,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.Quota">
    update quota
    <set>
      <if test="organizationId != null">
        organization_id = #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        project_id = #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="functionalCase != null">
        functional_case = #{functionalCase,jdbcType=INTEGER},
      </if>
      <if test="loadTestVumTotal != null">
        load_test_vum_total = #{loadTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="loadTestVumUsed != null">
        load_test_vum_used = #{loadTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="loadTestMaxThreads != null">
        load_test_max_threads = #{loadTestMaxThreads,jdbcType=INTEGER},
      </if>
      <if test="loadTestDuration != null">
        load_test_duration = #{loadTestDuration,jdbcType=INTEGER},
      </if>
      <if test="resourcePool != null">
        resource_pool = #{resourcePool,jdbcType=VARCHAR},
      </if>
      <if test="useDefault != null">
        use_default = #{useDefault,jdbcType=BIT},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=BIGINT},
      </if>
      <if test="member != null">
        `member` = #{member,jdbcType=INTEGER},
      </if>
      <if test="project != null">
        project = #{project,jdbcType=INTEGER},
      </if>
      <if test="apiTestVumTotal != null">
        api_test_vum_total = #{apiTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="apiTestVumUsed != null">
        api_test_vum_used = #{apiTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="uiTestVumTotal != null">
        ui_test_vum_total = #{uiTestVumTotal,jdbcType=DECIMAL},
      </if>
      <if test="uiTestVumUsed != null">
        ui_test_vum_used = #{uiTestVumUsed,jdbcType=DECIMAL},
      </if>
      <if test="fileStorage != null">
        file_storage = #{fileStorage,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.Quota">
    update quota
    set organization_id = #{organizationId,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR},
      functional_case = #{functionalCase,jdbcType=INTEGER},
      load_test_vum_total = #{loadTestVumTotal,jdbcType=DECIMAL},
      load_test_vum_used = #{loadTestVumUsed,jdbcType=DECIMAL},
      load_test_max_threads = #{loadTestMaxThreads,jdbcType=INTEGER},
      load_test_duration = #{loadTestDuration,jdbcType=INTEGER},
      resource_pool = #{resourcePool,jdbcType=VARCHAR},
      use_default = #{useDefault,jdbcType=BIT},
      update_time = #{updateTime,jdbcType=BIGINT},
      `member` = #{member,jdbcType=INTEGER},
      project = #{project,jdbcType=INTEGER},
      api_test_vum_total = #{apiTestVumTotal,jdbcType=DECIMAL},
      api_test_vum_used = #{apiTestVumUsed,jdbcType=DECIMAL},
      ui_test_vum_total = #{uiTestVumTotal,jdbcType=DECIMAL},
      ui_test_vum_used = #{uiTestVumUsed,jdbcType=DECIMAL},
      file_storage = #{fileStorage,jdbcType=BIGINT}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>