From fa18de84d1e59f2aedbdab29d4e6a747fe28c10e Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 19 Oct 2023 20:59:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/dao/atom/AtomDao.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 9eaf7be535b..14b8bec65a9 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -36,6 +36,7 @@ import com.tencent.devops.common.api.constant.KEY_SUMMARY import com.tencent.devops.common.api.constant.KEY_VERSION import com.tencent.devops.common.api.constant.KEY_WEIGHT import com.tencent.devops.common.api.constant.NAME +import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.constant.VERSION import com.tencent.devops.common.api.util.JsonUtil import com.tencent.devops.common.db.utils.JooqUtils @@ -99,6 +100,7 @@ import org.jooq.SelectOnConditionStep import org.jooq.impl.DSL import org.springframework.stereotype.Repository + @Suppress("ALL") @Repository class AtomDao : AtomBaseDao() { @@ -523,14 +525,22 @@ class AtomDao : AtomBaseDao() { delim = ".", count = -1 ) + val field = DSL.`when`((t.field(KEY_VERSION) as Field).startsWith(TEST), 1) + .otherwise(0) as Field val queryStep = dslContext.select( t.field(KEY_VERSION), t.field(KEY_ATOM_STATUS), firstVersion, secondVersion, - thirdVersion + thirdVersion, + field ).from(t) - .orderBy(firstVersion.plus(0).desc(), secondVersion.plus(0).desc(), thirdVersion.plus(0).desc()) + .orderBy( + field, + firstVersion.plus(0).desc(), + secondVersion.plus(0).desc(), + thirdVersion.plus(0).desc() + ) limitNum?.let { queryStep.limit(it) } return queryStep.skipCheck().fetch() }