aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml')
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml35
1 files changed, 35 insertions, 0 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml b/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml
new file mode 100644
index 00000000000..bbcf7b52121
--- /dev/null
+++ b/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml
@@ -0,0 +1,35 @@
+<?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="org.sonar.db.qualitygate.ProjectQgateAssociationMapper">
+
+ <select id="selectProjects" parameterType="map" resultType="ProjectQgateAssociation">
+ SELECT proj.id as id, proj.name as name, prop.text_value as gateId
+ FROM projects proj
+ <if test="query.projectSearch() != null">
+ JOIN resource_index ind ON ind.root_project_id=proj.id
+ </if>
+ LEFT JOIN properties prop ON prop.resource_id=proj.id AND prop.prop_key='sonar.qualitygate' AND prop.text_value LIKE
+ #{gateId}
+ <where>
+ <choose>
+ <when test="query.membership() == 'selected'">
+ AND prop.text_value IS NOT NULL
+ </when>
+ <when test="query.membership() == 'deselected'">
+ AND prop.text_value IS NULL
+ </when>
+ </choose>
+ <if test="query.projectSearch() != null">
+ AND ind.kee LIKE #{query.projectSearchSql}
+ </if>
+ AND proj.qualifier='TRK'
+ AND proj.scope='PRJ'
+ <if test="query.projectSearch() != null">
+ AND ind.qualifier='TRK'
+ </if>
+ </where>
+ ORDER BY proj.name
+ </select>
+
+</mapper>