Skip to content

Commit

Permalink
【PAC】feat:新增代码库详情页 #8118
Browse files Browse the repository at this point in the history
  • Loading branch information
mingshewhe committed Nov 9, 2023
1 parent 07ab2a9 commit 45ed18f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ interface UserRepositoryResource {
@ApiParam("仓库别名", required = false)
@QueryParam("aliasName")
aliasName: String?,
@ApiParam("仓库关键字[可取代码库别名/HashId/gitProjectId],此值存在时[aliasName]参数无效", required = false)
@QueryParam("repoKeyWordRef")
repoKeyWordRef: String?,
@ApiParam("第几页", required = false, defaultValue = "1")
@QueryParam("page")
page: Int?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ class RepositoryDao {
projectIds: Collection<String>,
repositoryTypes: List<ScmType>?,
aliasName: String?,
repoKeyWordRef: String? = null,
repositoryIds: Set<Long>?
): Long {
with(TRepository.T_REPOSITORY) {
Expand All @@ -130,14 +129,8 @@ class RepositoryDao {
if (repositoryIds != null) {
step.and(REPOSITORY_ID.`in`(repositoryIds))
}
// 关键字搜索
if (!repoKeyWordRef.isNullOrBlank()) {
step.and(
ALIAS_NAME.like("%$repoKeyWordRef%")
.or(REPOSITORY_HASH_ID.eq(repoKeyWordRef))
)
}
if (!aliasName.isNullOrBlank() && repoKeyWordRef.isNullOrBlank()) {

if (!aliasName.isNullOrBlank()) {
step.and(ALIAS_NAME.like("%$aliasName%"))
}
return when (repositoryTypes) {
Expand Down Expand Up @@ -249,7 +242,6 @@ class RepositoryDao {
projectId: String,
repositoryTypes: List<ScmType>?,
aliasName: String?,
repoKeyWordRef: String? = null,
repositoryIds: Set<Long>?,
offset: Int,
limit: Int,
Expand All @@ -263,14 +255,7 @@ class RepositoryDao {
if (repositoryIds != null) {
step.and(REPOSITORY_ID.`in`(repositoryIds))
}
// 关键字搜索
if (!repoKeyWordRef.isNullOrBlank()) {
step.and(
ALIAS_NAME.like("%$repoKeyWordRef%")
.or(REPOSITORY_HASH_ID.eq(repoKeyWordRef))
)
}
if (!aliasName.isNullOrBlank() && repoKeyWordRef.isNullOrBlank()) {
if (!aliasName.isNullOrBlank()) {
step.and(ALIAS_NAME.like("%$aliasName%"))
}
when (repositoryTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ class UserRepositoryResourceImpl @Autowired constructor(
projectId: String,
repositoryType: ScmType?,
aliasName: String?,
repoKeyWordRef: String?,
page: Int?,
pageSize: Int?,
sortBy: String?,
Expand All @@ -255,7 +254,6 @@ class UserRepositoryResourceImpl @Autowired constructor(
projectId = projectId,
repositoryType = repositoryType,
aliasName = aliasName,
repoKeyWordRef = repoKeyWordRef,
offset = limit.offset,
limit = limit.limit,
sortBy = sortBy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ import com.tencent.devops.scm.pojo.GitCommit
import com.tencent.devops.scm.pojo.GitProjectInfo
import com.tencent.devops.scm.pojo.GitRepositoryDirItem
import com.tencent.devops.scm.pojo.GitRepositoryResp
import java.time.LocalDateTime
import java.util.Base64
import javax.ws.rs.NotFoundException
import org.jooq.DSLContext
import org.jooq.impl.DSL
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
import java.time.LocalDateTime
import java.util.Base64
import javax.ws.rs.NotFoundException

@Service
@Suppress("ALL")
Expand Down Expand Up @@ -653,7 +653,6 @@ class RepositoryService @Autowired constructor(
projectId: String,
repositoryType: ScmType?,
aliasName: String?,
repoKeyWordRef: String? = null,
offset: Int,
limit: Int,
sortBy: String? = null,
Expand All @@ -676,15 +675,13 @@ class RepositoryService @Autowired constructor(
projectIds = setOf(projectId),
repositoryTypes = repositoryType?.let { listOf(it) },
aliasName = aliasName,
repoKeyWordRef = repoKeyWordRef,
repositoryIds = hasListPermissionRepoList.toSet()
)
val repositoryRecordList = repositoryDao.listByProject(
dslContext = dslContext,
projectId = projectId,
repositoryTypes = repositoryType?.let { listOf(it) },
aliasName = aliasName,
repoKeyWordRef = repoKeyWordRef,
repositoryIds = hasListPermissionRepoList.toSet(),
offset = offset,
limit = limit,
Expand Down

0 comments on commit 45ed18f

Please sign in to comment.