ComponentDto selectByKey(String key);
- ComponentDto selectById(Long id);
+ ComponentDto selectById(long id);
- long countById(Long id);
+ long countById(long id);
}
package org.sonar.core.dashboard;
+import javax.annotation.CheckForNull;
+
public interface ActiveDashboardMapper {
void insert(ActiveDashboardDto activeDashboardDto);
+ @CheckForNull
Integer selectMaxOrderIndexForNullUser();
}
}
@CheckForNull
- public ResourceDto getRootProjectByComponentId(Long componentId) {
+ public ResourceDto getRootProjectByComponentId(long componentId) {
SqlSession session = mybatis.openSession(false);
try {
return session.getMapper(ResourceMapper.class).selectRootProjectByComponentId(componentId);
/**
* @since 3.6
*/
- ResourceDto selectRootProjectByComponentId(@Param("componentId") Long componentId);
+ ResourceDto selectRootProjectByComponentId(@Param("componentId") long componentId);
/**
* @since 3.6
SELECT <include refid="componentColumns"/>
FROM projects p
INNER JOIN snapshots s on s.project_id=p.id and s.islast=${_true}
- <where>
- AND p.enabled=${_true}
- AND p.kee=#{key}
- </where>
+ WHERE p.enabled=${_true} AND p.kee=#{key}
</select>
- <select id="selectById" parameterType="Long" resultType="Component">
+ <select id="selectById" parameterType="long" resultType="Component">
SELECT <include refid="componentColumns"/>
FROM projects p
INNER JOIN snapshots s on s.project_id=p.id and s.islast=${_true}
- <where>
- AND p.enabled=${_true}
- AND p.id=#{id}
- </where>
+ WHERE p.enabled=${_true} AND p.id=#{id}
</select>
- <select id="countById" parameterType="Long" resultType="long">
+ <select id="countById" parameterType="long" resultType="long">
SELECT count(p.id)
FROM projects p
- <where>
- AND p.enabled=${_true}
- AND p.id=#{id}
- </where>
+ WHERE p.enabled=${_true} AND p.id=#{id}
</select>
</mapper>
<mapper namespace="org.sonar.core.dashboard.ActiveDashboardMapper">
- <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
+ <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id" lang="raw">
INSERT INTO active_dashboards (dashboard_id, user_id, order_index)
VALUES (#{dashboardId}, #{userId}, #{orderIndex})
</insert>
- <select id="selectMaxOrderIndexForNullUser" resultType="Integer">
+ <select id="selectMaxOrderIndexForNullUser" resultType="Integer" lang="raw">
SELECT MAX(order_index)
FROM active_dashboards
WHERE user_id IS NULL
<mapper namespace="org.sonar.core.dashboard.DashboardMapper">
- <select id="selectGlobalDashboard" parameterType="string" resultType="Dashboard">
+ <select id="selectGlobalDashboard" parameterType="string" resultType="Dashboard" lang="raw">
select id, user_id as "userId", name, description, column_layout as "columnLayout", shared, is_global, created_at as "createdAt", updated_at as "updatedAt"
from dashboards WHERE name=#{id} and user_id is null
</select>
- <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
INSERT INTO dashboards (user_id, name, description, column_layout, shared, is_global, created_at, updated_at)
VALUES (#{userId}, #{name}, #{description},
#{columnLayout}, #{shared}, #{global}, #{createdAt}, #{updatedAt})
<mapper namespace="org.sonar.core.dashboard.WidgetMapper">
- <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
+ <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
INSERT INTO widgets (dashboard_id, widget_key, name, description, column_index, row_index, configured, created_at, updated_at, resource_id)
VALUES (#{dashboardId}, #{key}, #{name}, #{description}, #{columnIndex},
#{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId})
<mapper namespace="org.sonar.core.dashboard.WidgetPropertyMapper">
- <insert id="insert" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <insert id="insert" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
INSERT INTO widget_properties (widget_id, kee, text_value)
VALUES (#{widgetId}, #{key}, #{value})
</insert>
<mapper namespace="org.sonar.core.dependency.DependencyMapper">
- <select id="selectAll" resultType="dependency">
+ <select id="selectAll" resultType="dependency" lang="raw">
SELECT id, from_snapshot_id as fromSnapshotId, to_snapshot_id as toSnapshotId, dep_usage as "usage" FROM dependencies
</select>
<mapper namespace="org.sonar.core.dependency.ResourceSnapshotMapper">
- <select id="selectAll" resultType="ResourceSnapshot">
+ <select id="selectAll" resultType="ResourceSnapshot" lang="raw">
SELECT id, project_id as projectId, version FROM snapshots
</select>
</if>
</select>
- <insert id="batchInsert" parameterType="DuplicationUnit" useGeneratedKeys="false">
+ <insert id="batchInsert" parameterType="DuplicationUnit" useGeneratedKeys="false" lang="raw">
INSERT INTO duplications_index (snapshot_id, project_snapshot_id, hash, index_in_file, start_line, end_line)
VALUES (#{snapshotId}, #{projectSnapshotId}, #{hash}, #{indexInFile}, #{startLine}, #{endLine})
</insert>
<mapper namespace="org.sonar.core.graph.jdbc.GraphDtoMapper">
- <select id="selectBySnapshot" parameterType="map" resultType="Graph">
+ <select id="selectBySnapshot" parameterType="map" resultType="Graph" lang="raw">
SELECT id, resource_id as resourceId, snapshot_id as snapshotId, format, version, perspective, root_vertex_id as rootVertexId, data
FROM graphs
WHERE snapshot_id = #{sid} AND perspective = #{perspective}
</select>
- <select id="selectByComponent" parameterType="map" resultType="Graph">
+ <select id="selectByComponent" parameterType="map" resultType="Graph" lang="raw">
SELECT g.id, g.resource_id as resourceId, g.snapshot_id as snapshotId, g.format, g.version, g.perspective, g.root_vertex_id as rootVertexId, g.data
FROM graphs g, snapshots s
WHERE g.perspective = #{perspective} AND g.snapshot_id=s.id AND s.islast=${_true} and s.project_id=(
)
</select>
- <insert id="insert" parameterType="Graph" useGeneratedKeys="false">
+ <insert id="insert" parameterType="Graph" useGeneratedKeys="false" lang="raw">
insert into graphs
(resource_id, snapshot_id, format, version, perspective, root_vertex_id, data, created_at, updated_at)
values (
)
</select>
- <select id="selectGlobalProperties" resultType="Property">
+ <select id="selectGlobalProperties" resultType="Property" lang="raw">
select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId
from properties p
where p.resource_id is null and p.user_id is null
</select>
- <select id="selectProjectProperties" parameterType="String" resultType="Property">
+ <select id="selectProjectProperties" parameterType="String" resultType="Property" lang="raw">
select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId
from properties p, projects r
where p.resource_id=r.id and p.user_id is null and r.kee=#{id}
</where>
</select>
- <update id="update" parameterType="Property">
+ <update id="update" parameterType="Property" lang="raw">
update properties set text_value = #{value} where id = #{id}
</update>
- <insert id="insert" parameterType="Property" useGeneratedKeys="false">
+ <insert id="insert" parameterType="Property" useGeneratedKeys="false" lang="raw">
INSERT INTO properties (prop_key, resource_id, user_id, text_value)
VALUES (#{key}, #{resourceId}, #{userId}, #{value})
</insert>
- <delete id="deleteProjectProperty" parameterType="map">
+ <delete id="deleteProjectProperty" parameterType="map" lang="raw">
delete from properties where prop_key=#{key} and resource_id=#{rId} and user_id is null
</delete>
- <delete id="deleteProjectProperties" parameterType="map">
+ <delete id="deleteProjectProperties" parameterType="map" lang="raw">
DELETE FROM properties
- <where>
- AND prop_key=#{key}
+ WHERE
+ prop_key=#{key}
AND text_value LIKE #{value}
AND resource_id IS NOT NULL
AND user_id IS NULL
- </where>
</delete>
- <delete id="deleteGlobalProperty" parameterType="string">
+ <delete id="deleteGlobalProperty" parameterType="string" lang="raw">
delete from properties where prop_key=#{id} and resource_id is null and user_id is null
</delete>
- <delete id="deleteGlobalProperties">
+ <delete id="deleteGlobalProperties" lang="raw">
delete from properties where resource_id is null and user_id is null
</delete>
- <delete id="deleteAllProperties" parameterType="string">
+ <delete id="deleteAllProperties" parameterType="string" lang="raw">
delete from properties where prop_key=#{id}
</delete>
- <update id="renamePropertyKey" parameterType="map">
+ <update id="renamePropertyKey" parameterType="map" lang="raw">
update properties set prop_key=#{newKey} where prop_key=#{oldKey}
</update>
- <update id="updateProperties" parameterType="map">
+ <update id="updateProperties" parameterType="map" lang="raw">
update properties set text_value=#{newValue} where text_value LIKE #{oldValue} and prop_key=#{key}
</update>
<mapper namespace="org.sonar.core.qualitygate.db.QualityGateConditionMapper">
- <insert id="insert" parameterType="QualityGateCondition" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <insert id="insert" parameterType="QualityGateCondition" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
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>
select <include refid="conditionColumns"/> from quality_gate_conditions where id=#{id}
</select>
- <update id="delete" parameterType="long">
+ <update id="delete" parameterType="long" lang="raw">
delete from quality_gate_conditions where id=#{id}
</update>
- <update id="update" parameterType="QualityGateCondition">
+ <update id="update" parameterType="QualityGateCondition" lang="raw">
update quality_gate_conditions set
metric_id=#{metricId},
operator=#{operator},
where id=#{id}
</update>
- <delete id="deleteConditionsWithInvalidMetrics">
+ <delete id="deleteConditionsWithInvalidMetrics" lang="raw">
delete from quality_gate_conditions
where metric_id not in (select id from metrics where enabled=${_true})
</delete>
<mapper namespace="org.sonar.core.qualitygate.db.QualityGateMapper">
- <insert id="insert" parameterType="QualityGate" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <insert id="insert" parameterType="QualityGate" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
insert into quality_gates (name, created_at, updated_at)
values (#{name}, #{createdAt}, #{updatedAt})
</insert>
where id=#{id}
</select>
- <update id="delete" parameterType="long">
+ <update id="delete" parameterType="long" lang="raw">
delete from quality_gates where id=#{id}
</update>
- <update id="update" parameterType="QualityGate">
+ <update id="update" parameterType="QualityGate" lang="raw">
update quality_gates set
name=#{name},
updated_at=#{updatedAt}
</where>
</select>
- <select id="selectRootProjectByComponentId" parameterType="long" resultMap="resourceResultMap">
+ <select id="selectRootProjectByComponentId" parameterType="long" resultMap="resourceResultMap" lang="raw">
select rootProject.*
from snapshots s
inner join projects rootProject on rootProject.id=s.root_project_id
- <where>
- and s.project_id=#{componentId}
+ where
+ s.project_id=#{componentId}
and s.islast=${_true}
- </where>
</select>
<select id="selectComponentsByIds" parameterType="long" resultType="Component">
</where>
</select>
- <select id="selectProvisionedProject" parameterType="string" resultMap="resourceResultMap">
+ <select id="selectProvisionedProject" parameterType="string" resultMap="resourceResultMap" lang="raw">
select p.* from projects p
left join snapshots s on s.project_id=p.id
- <where>
- and s.id is null
+ where s.id is null
and p.kee = #{key}
and p.copy_resource_id is null
- </where>
</select>
<select id="selectAuthorizedChildrenComponentIds" parameterType="map" resultType="int">
</where>
</sql>
- <insert id="insert" parameterType="Resource" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <insert id="insert" parameterType="Resource" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
insert into projects
(name, long_name, description, scope, qualifier, kee, deprecated_kee, path, language, root_id, copy_resource_id, person_id, enabled, created_at)
values (
)
</insert>
- <update id="update" parameterType="Resource">
+ <update id="update" parameterType="Resource" lang="raw">
update projects set name=#{name}, long_name=#{longName}, description=#{description},
scope=#{scope}, qualifier=#{qualifier}, kee=#{key}, deprecated_kee=#{deprecatedKey}, path=#{path},
language=#{language}, root_id=#{rootId}, copy_resource_id=#{copyResourceId},