fix(系统设置): 修复项目根据组织名称排序失败的缺陷
This commit is contained in:
parent
d9f11ca900
commit
912f8b24a0
|
@ -37,7 +37,7 @@
|
|||
p.update_user,
|
||||
p.enable,
|
||||
count(distinct temp.id) as memberCount,
|
||||
o.name as organizationName,
|
||||
o.name as organization_name,
|
||||
p.module_setting
|
||||
FROM project p
|
||||
LEFT JOIN (SELECT ur.source_id, u.id from user_role_relation ur left join user u on u.id = ur.user_id where u.deleted = 0) temp on p.id = temp.source_id
|
||||
|
|
|
@ -353,6 +353,32 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
List<String> createUsers = projectDTOS.stream().map(ProjectDTO::getCreateUser).toList();
|
||||
User user = userMapper.selectByPrimaryKey("test");
|
||||
Assertions.assertTrue(List.of(user.getName()).containsAll(createUsers));
|
||||
//排序
|
||||
projectRequest.setSort(new HashMap<>() {{
|
||||
put("organizationName", "asc");
|
||||
}});
|
||||
mvcResult = this.responsePost(getProjectList, projectRequest);
|
||||
returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||
//第一个数据的organizationName是最小的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
String firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0);
|
||||
}
|
||||
|
||||
projectRequest.setSort(new HashMap<>() {{
|
||||
put("organizationName", "desc");
|
||||
}});
|
||||
mvcResult = this.responsePost(getProjectList, projectRequest);
|
||||
returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||
//第一个数据的organizationName是最大的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0);
|
||||
}
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_READ, getProjectList, projectRequest);
|
||||
}
|
||||
|
|
|
@ -342,6 +342,35 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
List<String> createUsers = projectDTOS.stream().map(ProjectDTO::getCreateUser).toList();
|
||||
User user = userMapper.selectByPrimaryKey("test");
|
||||
Assertions.assertTrue(List.of(user.getName()).containsAll(createUsers));
|
||||
|
||||
//排序
|
||||
projectRequest.setSort(new HashMap<>() {{
|
||||
put("organizationName", "asc");
|
||||
}});
|
||||
mvcResult = this.responsePost(getProjectList, projectRequest);
|
||||
returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||
//第一个数据的organizationName是最小的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
String firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0);
|
||||
}
|
||||
|
||||
projectRequest.setSort(new HashMap<>() {{
|
||||
put("organizationName", "desc");
|
||||
}});
|
||||
mvcResult = this.responsePost(getProjectList, projectRequest);
|
||||
returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||
//第一个数据的organizationName是最大的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0);
|
||||
}
|
||||
|
||||
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, getProjectList, projectRequest);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue