return selectIssueAndProjectIds(query, authorizedRootProjectIds, query.maxResults(), session);
}
- private List<IssueDto> selectIssueAndProjectIds(IssueQuery query, Collection<Integer> authorizedRootProjectIds, Integer maxResult, SqlSession session){
+ private List<IssueDto> selectIssueAndProjectIds(IssueQuery query, Collection<Integer> authorizedRootProjectIds, Integer maxResults, SqlSession session){
if (authorizedRootProjectIds.isEmpty()) {
return Collections.emptyList();
}
IssueMapper mapper = session.getMapper(IssueMapper.class);
List<List<Integer>> idsPartition = Lists.partition(newArrayList(authorizedRootProjectIds), 1000);
- return mapper.selectIssueAndProjectIds(query, idsPartition, maxResult);
+ return mapper.selectIssueAndProjectIds(query, idsPartition, maxResults);
}
@VisibleForTesting
</select>
<select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue" fetchSize="2147483647">
- select i.id, i.project_id as projectId
+ select
+ <if test="_databaseId == 'mssql' ">
+ top #{maxResults}
+ </if>
+ i.id, i.project_id as projectId
<include refid="sortColumn"/>
<include refid="selectQueryConditions"/>
</select>
<if test="query.createdBefore() != null">
and i.issue_creation_date < #{query.createdBefore}
</if>
+ <if test="_databaseId == 'oracle' ">
+ and rownum <= #{maxResults}
+ </if>
</where>
order by i.id
- limit #{maxResults}
+ <if test="_databaseId != 'oracle' and _databaseId != 'mssql'">
+ limit #{maxResults}
+ </if>
</sql>
</mapper>