@Select("select * from projects where name = #{name}")
@Select("select uuid,kee,qualifier,name from projects where name = #{name}")
ProjectfindByName(@Param("name")Stringname);
ProjectfindByName(@Param("name")Stringname);
@Select("select COALESCE(value,0) from project_measures where component_uuid = #{uuid} and metric_id = 19 order by id desc limit 1")
/**
*复杂度
*@paramuuid
*@return
*/
@Select("select COALESCE(value,0) from project_measures where component_uuid = #{uuid} and metric_uuid = select uuid from metrics m where name='file_complexity' limit 1")
FloatgetComplexity(@Param("uuid")Stringuuid);
FloatgetComplexity(@Param("uuid")Stringuuid);
@Select("select COALESCE(value,0) from project_measures where component_uuid = #{uuid} and metric_id = 1 order by id desc limit 1")
/**
*代码行数
*@paramuuid
*@return
*/
@Select("select COALESCE(value,0) from project_measures where component_uuid = #{uuid} and metric_uuid=(select uuid from metrics m where name='lines') limit 1")
IntegergetLines(@Param("uuid")Stringuuid);
IntegergetLines(@Param("uuid")Stringuuid);
@Select("select text_value from project_measures where component_uuid = #{uuid} and metric_id = #{metric_id} order by id desc limit 1")
@Select("select text_value from project_measures where component_uuid = #{uuid} and metric_uuid=(select uuid from metrics m where name=#{metricName}}) limit 1")
"(select COALESCE(value,0) complexity from project_measures where component_uuid = #{projectUuid} and metric_id = 19 order by id desc limit 1),"+
"(select COALESCE(value,0) complexity from project_measures where component_uuid = #{projectUuid} and metric_uuid = (select uuid from metrics m where name='file_complexity') limit 1)," +
"(select COALESCE(value,0) lines from project_measures where component_uuid = #{projectUuid} and metric_id = 1 order by id desc limit 1),"+
"(select COALESCE(value,0) lines from project_measures where component_uuid = #{projectUuid} and metric_uuid = (select uuid from metrics m where name='lines') limit 1)," +
"(SELECT COALESCE(count(*),0) block_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='BLOCKER'), "+
"(SELECT COALESCE(count(*),0) block_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='BLOCKER'), "+
"(SELECT COALESCE(count(*),0) critical_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='CRITICAL'),"+
"(SELECT COALESCE(count(*),0) critical_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='CRITICAL'),"+
"(SELECT COALESCE(count(*),0) major_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='MAJOR'),"+
"(SELECT COALESCE(count(*),0) major_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='MAJOR'),"+
"(SELECT COALESCE(count(*),0) minor_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='MINOR'),"+
"(SELECT COALESCE(count(*),0) minor_code_smells FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=1 and severity='MINOR'),"+
"(select text_value code_smells from project_measures where component_uuid = #{projectUuid} and metric_id = 80 order by id desc limit 1),"+
"(select text_value code_smells from project_measures where component_uuid = #{projectUuid} and metric_uuid = (select uuid from metrics m where name='sqale_rating') limit 1)," +
"(SELECT COALESCE(count(*),0) block_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='BLOCKER'), "+
"(SELECT COALESCE(count(*),0) block_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='BLOCKER'), "+
"(SELECT COALESCE(count(*),0) critical_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='CRITICAL'),"+
"(SELECT COALESCE(count(*),0) critical_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='CRITICAL'),"+
"(SELECT COALESCE(count(*),0) major_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='MAJOR'),"+
"(SELECT COALESCE(count(*),0) major_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='MAJOR'),"+
"(SELECT COALESCE(count(*),0) minor_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='MINOR'),"+
"(SELECT COALESCE(count(*),0) minor_bugs FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=2 and severity='MINOR'),"+
"(select text_value bugs from project_measures where component_uuid = #{projectUuid} and metric_id = 89 order by id desc limit 1)," +
"(select text_value bugs from project_measures where component_uuid = #{projectUuid} and metric_uuid = (select uuid from metrics m where name='security_review_rating') limit 1)," +
"(SELECT COALESCE(count(*),0) block_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='BLOCKER'), "+
"(SELECT COALESCE(count(*),0) block_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='BLOCKER'), "+
"(SELECT COALESCE(count(*),0) critical_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='CRITICAL'),"+
"(SELECT COALESCE(count(*),0) critical_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='CRITICAL'),"+
"(SELECT COALESCE(count(*),0) major_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='MAJOR'),"+
"(SELECT COALESCE(count(*),0) major_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='MAJOR'),"+
"(SELECT COALESCE(count(*),0) minor_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='MINOR'),"+
"(SELECT COALESCE(count(*),0) minor_violations FROM issues where project_uuid=#{projectUuid} and status='OPEN' and issue_type=3 and severity='MINOR'),"+
"(select text_value violations from project_measures where component_uuid = #{projectUuid} and metric_id = 93 order by id desc limit 1)")
"(select text_value violations from project_measures where component_uuid = #{projectUuid} and metric_uuid = (select uuid from metrics m where name='security_rating') limit 1)")
@Select("select (select count(1) from issues where project_uuid=#{projectUuid} and issue_type=1) codeSmell,"+
@Select("select (select count(1) from issues where project_uuid=#{projectUuid} and issue_type=1) codeSmell,"+
"(select count(1) from issues where project_uuid=#{projectUuid} and issue_type=2) bugs,"+
"(select count(1) from issues where project_uuid=#{projectUuid} and issue_type=2) bugs,"+
"(select count(1) from issues where project_uuid=#{projectUuid} and issue_type=3) vulnerability,"+
"(select count(1) from issues where project_uuid=#{projectUuid} and issue_type=3) vulnerability,"+
"(select value from project_measures pm where component_uuid=#{projectUuid} and metric_id=3) codeLines")
"(select value from project_measures pm where component_uuid=#{projectUuid} and metric_uuid=(select uuid from metrics m where name='ncloc')) codeLines")
inner join components c on c.uuid =i.component_uuid
where i.project_uuid = #{projectUuid,jdbcType=VARCHAR}
where i.project_uuid = #{projectUuid,jdbcType=VARCHAR}
and i.status='OPEN'
and i.status='OPEN'
and p.root_uuid =#{projectUuid,jdbcType=VARCHAR} and p.uuid !=#{projectUuid,jdbcType=VARCHAR} and p."scope" ='FIL'
and p.uuid =#{projectUuid,jdbcType=VARCHAR}
and c.uuid !=#{projectUuid,jdbcType=VARCHAR} and c.branch_uuid =#{projectUuid,jdbcType=VARCHAR} and c."scope" ='FIL'
<iftest="issueType != null">
<iftest="issueType != null">
and i.issue_type=#{issueType,jdbcType=INTEGER}
and i.issue_type=#{issueType,jdbcType=INTEGER}
</if>
</if>
@ -47,12 +50,13 @@
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'MINOR' and status='OPEN') minor,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'MINOR' and status='OPEN') minor,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'BLOCKER' and status='OPEN') blocker,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'BLOCKER' and status='OPEN') blocker,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'CRITICAL' and status='OPEN') critical,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'CRITICAL' and status='OPEN') critical,
(select text_value from project_measures i where component_uuid =#{projectUuid} and metric_id = #{metricId} order by id desc limit 1) levelStr
(select text_value from project_measures i where component_uuid =#{projectUuid} and metric_uuid = (select uuid from metrics where name=#{metricName}) limit 1) levelStr
select i.id,i.kee,i.rule_id ruleId,i.severity,i.status,i.project_uuid projectUuid,i.issue_type issueType,i.locations,i.line lines,i.message from issues i where id=#{issueId}