|
@@ -75,7 +75,7 @@ public class PmProjectServiceImpl extends AbstractCrudService<PmProjectMapper, P
|
|
|
String projectName = project.getProjectName();
|
|
|
if (StringUtils.isBlank(projectName)) {
|
|
|
throw new BusinessException("项目名称不能为空!");
|
|
|
- }else if (projectName.length() > 50) {
|
|
|
+ } else if (projectName.length() > 50) {
|
|
|
throw new BusinessException("项目名称长度不能超过50个字符!");
|
|
|
}
|
|
|
|
|
@@ -88,7 +88,7 @@ public class PmProjectServiceImpl extends AbstractCrudService<PmProjectMapper, P
|
|
|
Integer projectType = project.getProjectType();
|
|
|
if (projectType == null) {
|
|
|
throw new BusinessException("项目类型不能为空且");
|
|
|
- }else if (projectType < 1 || projectType > 6) {
|
|
|
+ } else if (projectType < 1 || projectType > 6) {
|
|
|
throw new BusinessException("项目类型传参有误!");
|
|
|
}
|
|
|
|
|
@@ -96,7 +96,7 @@ public class PmProjectServiceImpl extends AbstractCrudService<PmProjectMapper, P
|
|
|
Integer projectStatus = project.getProjectStatus();
|
|
|
if (projectStatus == null) {
|
|
|
throw new BusinessException("项目状态不能为空且!");
|
|
|
- }else if (projectStatus < 1 || projectStatus > 5) {
|
|
|
+ } else if (projectStatus < 1 || projectStatus > 5) {
|
|
|
throw new BusinessException("项目状态传参有误!");
|
|
|
}
|
|
|
|
|
@@ -249,43 +249,26 @@ public class PmProjectServiceImpl extends AbstractCrudService<PmProjectMapper, P
|
|
|
|
|
|
LambdaQueryWrapper<PmProject> lambdaQuery = Wrappers.lambdaQuery();
|
|
|
lambdaQuery.eq(PmProject::getTenantId, tenantId)
|
|
|
- .eq(PmProject::getDelFlag, 0)
|
|
|
- .eq(visibleRange != null, PmProject::getVisibleRange, visibleRange);
|
|
|
+ .eq(PmProject::getDelFlag, 0);
|
|
|
|
|
|
if (projectId != null && projectId != 0) {
|
|
|
lambdaQuery.eq(PmProject::getId, projectId);
|
|
|
- page = this.page(page, lambdaQuery);
|
|
|
- return new CommonPage<>(page.getRecords(), page.getTotal(), pageSize, pageNum);
|
|
|
}
|
|
|
|
|
|
switch (projectAscription) {
|
|
|
case 0:
|
|
|
- if (StringUtils.isNotBlank(projectName) || projectType != null || projectStatus != null) {
|
|
|
- lambdaQuery.eq(PmProject::getDelFlag, 0)
|
|
|
- .like(StringUtils.isNotBlank(projectName), PmProject::getProjectName, projectName)
|
|
|
- .eq(projectType != null, PmProject::getProjectType, projectType)
|
|
|
- .eq(projectStatus != null, PmProject::getProjectStatus, projectStatus)
|
|
|
+ if (visibleRange == null) {
|
|
|
+ lambdaQuery.and(wrapper -> wrapper
|
|
|
.and(qw -> qw
|
|
|
.eq(PmProject::getProjectHead, userId)
|
|
|
.or()
|
|
|
.apply("FIND_IN_SET('" + userId + "', project_member) > 0")
|
|
|
.or()
|
|
|
- .eq(PmProject::getCreateBy, username));
|
|
|
- }
|
|
|
- if (visibleRange == null) {
|
|
|
- lambdaQuery.eq(PmProject::getDelFlag, 0)
|
|
|
- .and(wrapper -> wrapper
|
|
|
- .eq(PmProject::getVisibleRange, 2)
|
|
|
- .and(qw -> qw
|
|
|
- .eq(PmProject::getProjectHead, userId)
|
|
|
- .or()
|
|
|
- .apply("FIND_IN_SET('" + userId + "', project_member) > 0")
|
|
|
- .or()
|
|
|
- .eq(PmProject::getCreateBy, username))
|
|
|
+ .eq(PmProject::getCreateBy, username)
|
|
|
)
|
|
|
.or()
|
|
|
.eq(PmProject::getVisibleRange, 1)
|
|
|
- .eq(PmProject::getDelFlag, 0);
|
|
|
+ );
|
|
|
} else if (visibleRange == 2) {
|
|
|
lambdaQuery.and(wrapper -> wrapper
|
|
|
.eq(PmProject::getProjectHead, userId)
|
|
@@ -314,7 +297,9 @@ public class PmProjectServiceImpl extends AbstractCrudService<PmProjectMapper, P
|
|
|
default:
|
|
|
throw new BusinessException("查询项目列表参数错误");
|
|
|
}
|
|
|
- lambdaQuery.orderByDesc(PmProject::getCreateTime);
|
|
|
+
|
|
|
+ lambdaQuery.eq(visibleRange != null, PmProject::getVisibleRange, visibleRange)
|
|
|
+ .orderByDesc(PmProject::getCreateTime);
|
|
|
List<PmProject> pmProjects = pmProjectMapper.selectList(lambdaQuery);
|
|
|
if (pmProjects.isEmpty()) {
|
|
|
return new CommonPage<>(pmProjects, 0, pageSize, pageNum);
|