return executeLargeInputs(keys, mapper(session)::selectByKeys);
}
+ public Set<String> selectIssueKeysByComponentUuid(DbSession session, String componentUuid) {
+ return mapper(session).selectIssueKeysByComponentUuid(componentUuid);
+ }
+
public List<IssueDto> selectByComponentUuidPaginated(DbSession session, String componentUuid, int page) {
return mapper(session).selectByComponentUuidPaginated(componentUuid, Pagination.forPage(page).andSize(DEFAULT_PAGE_SIZE));
}
List<IssueDto> selectByKeys(List<String> keys);
+ Set<String> selectIssueKeysByComponentUuid(@Param("componentUuid") String componentUuid);
+
List<IssueDto> selectByComponentUuidPaginated(@Param("componentUuid") String componentUuid,
@Param("pagination") Pagination pagination);
group by i2.issue_type, i2.severity, i2.resolution, i2.status, i2.inLeak
</select>
+ <select id="selectIssueKeysByComponentUuid" parameterType="string" resultType="string">
+ select
+ i.kee
+ from issues i
+ where
+ i.project_uuid=#{componentUuid,jdbcType=VARCHAR}
+ </select>
+
<select id="selectByComponentUuidPaginated" parameterType="map" resultType="Issue">
select
<include refid="issueColumns"/>
inner join components p on p.uuid=i.component_uuid
inner join components root on root.uuid=i.project_uuid
where i.project_uuid=#{componentUuid,jdbcType=VARCHAR}
- order by i.kee
+ order by i.issue_creation_date ASC
limit #{pagination.pageSize,jdbcType=INTEGER} offset #{pagination.offset,jdbcType=INTEGER}
</select>
<include refid="issueColumns"/>
from
(select
- row_number() over(order by i.kee) as row_number,
+ row_number() over(order by i.issue_creation_date ASC) as row_number,
<include refid="issueColumnsInInnerQuery" />
from issues i
where i.project_uuid=#{componentUuid,jdbcType=VARCHAR}
<include refid="issueColumnsInInnerQuery"/>
from issues i
where i.project_uuid=#{componentUuid,jdbcType=VARCHAR}
- order by i.kee
+ order by i.issue_creation_date ASC
) t
) i
where
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
import java.util.stream.Stream;
import org.junit.Rule;
import org.junit.Test;
assertThat(issues).extracting("key").containsOnly("I1", "I2");
}
+ @Test
+ public void selectIssueKeysByComponentUuid() {
+ // contains I1 and I2
+ prepareTables();
+
+ Set<String> issues = underTest.selectIssueKeysByComponentUuid(db.getSession(), PROJECT_UUID);
+
+ // results are not ordered, so do not use "containsExactly"
+ assertThat(issues).containsOnly("I1", "I2");
+ }
+
@Test
public void selectByComponentUuidPaginated() {
// contains I1 and I2