diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java new file mode 100644 index 0000000..663fa4f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/ExistsSqlConst.java @@ -0,0 +1,22 @@ +package com.hz.pm.api.common.model.constant; + +/** + *
+ * ExistsSqlConst + *
+ * + * @author WendyYang + * @since 15:38 2024/8/8 + */ +public class ExistsSqlConst { + + private ExistsSqlConst() { + } + + public static final String PURCHASE_EXISTS_PROJECT = " select 1 from nd_project np where np.id = nd_purchase.project_id "; + + public static final String PROJECT_EXISTS_PURCHASE = " select 1 from nd_purchase np where nd_project.id = np.project_id "; + + public static final String PURCHASE_EXISTS_OPERATION = " select 1 from nd_project_operation npo where npo.bid_id = nd_purchase.id "; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index ec434ca..b57a42a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -485,12 +485,11 @@ public class PurchaseManage { .ge(req.getCreateOnMin() != null, Purchase::getCreateOn, req.getCreateOnMin()) .eq(req.getStatus() != null, function, req.getStatus()) .notExists(ExistsSqlConst.PURCHASE_EXISTS_PROJECT - + "and np.stage != {0}", ProjectStatus.STOPPED) + + "and np.stage != {0}", ProjectStatus.STOPPED.getCode()) .isNotNull(function) .orderByDesc(Purchase::getCreateOn); boolean display = !Boolean.FALSE.equals(req.getDisplay()); - String existsSql = String.format("select 1 from nd_project_operation no" + - " where no.bid_id = nd_purchase.id and no.%s is not null", actualTimeColumn); + String existsSql = String.format(ExistsSqlConst.PURCHASE_EXISTS_OPERATION + " and npo.%s is not null", actualTimeColumn); if (display) { query.and(q1 -> q1.eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) .or(q2 -> q2.exists(existsSql)));