[Improvement][API] Improvement query all project list (#5169) (#5192)

This commit is contained in:
wenjun 2021-04-01 20:34:49 +08:00 committed by GitHub
parent 817328ee8f
commit f20bb54896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -447,19 +447,14 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic
}
/**
* query all project list that have one or more process definitions.
* query all project list
*
* @return project list
*/
@Override
public Map<String, Object> queryAllProjectList() {
Map<String, Object> result = new HashMap<>();
List<Project> projects = new ArrayList<>();
List<Integer> projectIds = processDefinitionMapper.listProjectIds();
if (CollectionUtils.isNotEmpty(projectIds)) {
projects = projectMapper.selectBatchIds(projectIds);
}
List<Project> projects = projectMapper.queryAllProject();
result.put(Constants.DATA_LIST, projects);
putMsg(result, Status.SUCCESS);

View File

@ -322,8 +322,7 @@ public class ProjectServiceTest {
@Test
public void testQueryAllProjectList() {
Mockito.when(processDefinitionMapper.listProjectIds()).thenReturn(getProjectIds());
Mockito.when(projectMapper.selectBatchIds(getProjectIds())).thenReturn(getList());
Mockito.when(projectMapper.queryAllProject()).thenReturn(getList());
Map<String, Object> result = projectService.queryAllProjectList();
logger.info(result.toString());

View File

@ -92,4 +92,10 @@ public interface ProjectMapper extends BaseMapper<Project> {
*/
ProjectUser queryProjectWithUserByProcessInstanceId(@Param("processInstanceId") int processInstanceId);
/**
* query all project
* @return projectList
*/
List<Project> queryAllProject();
}

View File

@ -109,4 +109,8 @@
join t_ds_user u on dp.user_id = u.id
where di.id = #{processInstanceId};
</select>
<select id="queryAllProject" resultType="org.apache.dolphinscheduler.dao.entity.Project">
select * from t_ds_project
</select>
</mapper>