<select id="selectByQuery" resultType="Component">
select
- <include refid="componentColumns"/>
+ <include refid="componentColumns"/>,
+ o.kee as organizationKey
<include refid="sqlSelectByQuery"/>
ORDER BY LOWER(p.name), p.name, p.id
</select>
<sql id="sqlSelectByQuery">
from projects p
- <where>
- AND p.enabled=${_true}
+ inner join organizations o on
+ o.uuid = p.organization_uuid
+ where
+ p.enabled=${_true}
AND p.copy_component_uuid is null
<if test="query.qualifiers!=null">
AND p.qualifier in
)
)
</if>
- </where>
</sql>
<!-- "p" is ancestors -->
assertThat(result).hasSize(3);
assertThat(count).isEqualTo(9);
- assertThat(result).extracting("name").containsExactly("project-2", "project-3", "project-4");
+ assertThat(result).extracting(ComponentDto::name).containsExactly("project-2", "project-3", "project-4");
+ assertThat(result).extracting(ComponentDto::getOrganizationUuid).containsOnly(organizationDto.getUuid());
+ assertThat(result).extracting(ComponentDto::getOrganizationKey).containsOnly(organizationDto.getKey());
}
@Test