1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
4 <mapper namespace="org.sonar.db.qualitygate.QualityGateGroupPermissionsMapper">
8 qggp.group_uuid as "groupUuid",
9 qggp.quality_gate_uuid as "qualityGateUuid"
12 <select id="selectByQualityGateAndGroup" parameterType="String" resultType="org.sonar.db.qualitygate.QualityGateGroupPermissionsDto">
14 <include refid="sqlColumns"/>
15 from qgate_group_permissions qggp
17 qggp.group_uuid = #{groupUuid}
18 and qggp.quality_gate_uuid = #{qualityGateUuid}
21 <select id="selectByQualityGateAndGroups" parameterType="map" resultType="org.sonar.db.qualitygate.QualityGateGroupPermissionsDto">
23 <include refid="sqlColumns"/>
24 from qgate_group_permissions qggp
26 <foreach collection="groupUuids" open="(" close=")" item="groupUuid" separator=" or ">
27 qggp.group_uuid = #{groupUuid, jdbcType=VARCHAR}
29 and qggp.quality_gate_uuid = #{qualityGateUuid, jdbcType=VARCHAR}
32 <select id="selectByQuery" parameterType="map" resultType="org.sonar.db.user.SearchGroupMembershipDto">
33 SELECT g.uuid as groupUuid, g.name as name, qggp.uuid as uuid
34 <include refid="sqlSelectByQuery"/>
36 offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
39 <select id="countByQuery" resultType="int">
41 <include refid="sqlSelectByQuery" />
44 <sql id="sqlSelectByQuery">
46 LEFT JOIN qgate_group_permissions qggp ON qggp.group_uuid=g.uuid AND qggp.quality_gate_uuid=#{query.qualityGateUuid, jdbcType=VARCHAR}
49 <when test="query.getMembership() == 'IN'">
50 AND qggp.uuid IS NOT NULL
52 <when test="query.getMembership() == 'OUT'">
56 <if test="query.getQuery() != null">
57 AND (LOWER(g.name) LIKE #{query.querySqlLowercase} ESCAPE '/')
62 <insert id="insert" useGeneratedKeys="false" parameterType="map">
63 insert into qgate_group_permissions(
69 #{dto.uuid, jdbcType=VARCHAR},
70 #{dto.groupUuid, jdbcType=VARCHAR},
71 #{dto.qualityGateUuid, jdbcType=VARCHAR},
72 #{now, jdbcType=BIGINT}
77 delete from qgate_group_permissions
78 where quality_gate_uuid = #{qualityGateUuid, jdbcType=VARCHAR}
79 and group_uuid = #{groupUuid, jdbcType=VARCHAR}
82 <delete id="deleteByGroup">
83 delete from qgate_group_permissions
84 where group_uuid = #{groupUuid, jdbcType=VARCHAR}
87 <delete id="deleteByQualityGate">
88 delete from qgate_group_permissions
89 where quality_gate_uuid = #{qualityGateUuid, jdbcType=VARCHAR}