All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.db.qualitygate.QualityGateConditionMapper.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">

<mapper namespace="org.sonar.db.qualitygate.QualityGateConditionMapper">

  <insert id="insert" parameterType="QualityGateCondition" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
    insert into quality_gate_conditions (qgate_id, metric_id, operator, value_error, value_warning, period, created_at,
    updated_at)
    values (#{qualityGateId}, #{metricId}, #{operator}, #{errorThreshold}, #{warningThreshold}, #{period}, #{createdAt},
    #{updatedAt})
  </insert>

  <sql id="conditionColumns">
    id, qgate_id as qualityGateId, metric_id as metricId, operator, value_warning as warningThreshold, value_error as
    errorThreshold, period,
    created_at as createdAt, updated_at as updatedAt
  </sql>

  <select id="selectForQualityGate" resultType="QualityGateCondition" parameterType="long">
    select
    <include refid="conditionColumns"/>
    from quality_gate_conditions where qgate_id=#{qGateId}
    order by id asc
  </select>

  <select id="selectById" parameterType="long" resultType="QualityGateCondition">
    select
    <include refid="conditionColumns"/>
    from quality_gate_conditions where id=#{id}
  </select>

  <update id="delete" parameterType="long">
    delete from quality_gate_conditions where id=#{id}
  </update>

  <update id="update" parameterType="QualityGateCondition">
    update quality_gate_conditions set
    metric_id=#{metricId},
    operator=#{operator},
    value_warning=#{warningThreshold},
    value_error=#{errorThreshold},
    period=#{period},
    updated_at=#{updatedAt}
    where id=#{id}
  </update>

  <delete id="deleteConditionsWithInvalidMetrics">
    delete from quality_gate_conditions
    where not exists (select 1 from metrics m where m.enabled=${_true} and m.id = metric_id)
  </delete>

</mapper>





© 2015 - 2024 Weber Informatics LLC | Privacy Policy