|
|
@@ -16,6 +16,7 @@ import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoVO; |
|
|
|
import com.hz.pm.api.projectlib.model.dto.MhSystemStoppedRecordDTO; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.Project; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.MhSystemReplaceType; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; |
|
|
|
import com.hz.pm.api.projectlib.model.req.MhSystemReplaceReq; |
|
|
|
import com.hz.pm.api.projectlib.service.*; |
|
|
|
import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper; |
|
|
@@ -181,13 +182,20 @@ public class MhSystemReplaceManage { |
|
|
|
BizUtils.notEmpty(state.getUnitIds(), w -> query.in(MhSystemReplaceInfo::getBuildOrgCode, w)); |
|
|
|
query.notExists("select 1 from qx_project_system_replace_infos_relation qpr " + |
|
|
|
"where qpr.source_system_id = mh_system_replace_info.id"); |
|
|
|
String includeProjectCodeSql = ""; |
|
|
|
String includeProjectCodeSql; |
|
|
|
if (StrUtil.isNotBlank(req.getIncludeProjectCode())) { |
|
|
|
includeProjectCodeSql += " and t.project_code != '" + req.getIncludeProjectCode() + "'"; |
|
|
|
includeProjectCodeSql = " and t.project_code != '" + req.getIncludeProjectCode() + "'"; |
|
|
|
} else { |
|
|
|
includeProjectCodeSql = ""; |
|
|
|
} |
|
|
|
query.notExists("select 1 from (SELECT ROW_NUMBER() OVER (PARTITION BY SOURCE_SYSTEM_ID ORDER BY CREATE_ON DESC) row_no," |
|
|
|
+ "* FROM ND_PROJECT_GOV_SYSTEM_REPLACE_INFOS npr where npr.source_system_id = mh_system_replace_info.id) t" |
|
|
|
+ " where row_no = 1 and t.replace_type != 6" + includeProjectCodeSql); |
|
|
|
query.and(q1 -> q1.notExists("select 1 from (SELECT ROW_NUMBER() OVER (PARTITION BY SOURCE_SYSTEM_ID ORDER BY CREATE_ON DESC) row_no," |
|
|
|
+ "PROJECT_CODE,REPLACE_TYPE FROM ND_PROJECT_GOV_SYSTEM_REPLACE_INFOS npr where npr.source_system_id = mh_system_replace_info.id) t" |
|
|
|
+ " where row_no = 1 and t.replace_type != 6" + includeProjectCodeSql) |
|
|
|
.or(q2 -> q2.exists("select 1 from (SELECT ROW_NUMBER() OVER (PARTITION BY SOURCE_SYSTEM_ID ORDER BY CREATE_ON DESC) row_no," + |
|
|
|
"PROJECT_CODE FROM ND_PROJECT_GOV_SYSTEM_REPLACE_INFOS npr where npr.source_system_id = mh_system_replace_info.id) t inner join nd_project np" + |
|
|
|
" on t.project_code = np.project_code where row_no = 1 and np.newest = 1" + |
|
|
|
" and np.status in ({0})", ProjectStatus.STOPPED_PASSED.getCode()))); |
|
|
|
// 终止和变更通过的项目关联的系统可以再次被选中 |
|
|
|
List<MhSystemReplaceInfo> page = mhSystemReplaceInfoService.list(query); |
|
|
|
return BeanUtil.copyToList(page, MhSystemReplaceInfoVO.class); |
|
|
|
} |
|
|
|