-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10910 from fcfang123/issue-10892
feat:项目成员支持按照过期时间/用户组名称搜索 #10892
- Loading branch information
Showing
15 changed files
with
467 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...-auth/src/main/kotlin/com/tencent/devops/auth/pojo/dto/ProjectMembersQueryConditionDTO.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.tencent.devops.auth.pojo.dto | ||
|
||
import com.tencent.devops.auth.pojo.request.ProjectMembersQueryConditionReq | ||
import com.tencent.devops.common.api.util.DateTimeUtil | ||
import com.tencent.devops.common.api.util.PageUtil | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
import java.time.LocalDateTime | ||
|
||
@Schema(title = "项目成员查询业务处理实体") | ||
data class ProjectMembersQueryConditionDTO( | ||
@get:Schema(title = "项目ID") | ||
val projectCode: String, | ||
@get:Schema(title = "成员类型") | ||
val memberType: String? = null, | ||
@get:Schema(title = "用户名称") | ||
val userName: String? = null, | ||
@get:Schema(title = "部门名称") | ||
val deptName: String? = null, | ||
@get:Schema(title = "用户组名称") | ||
val groupName: String? = null, | ||
@get:Schema(title = "用户组Id") | ||
val iamGroupIds: List<Int>? = null, | ||
@get:Schema(title = "最小过期时间") | ||
val minExpiredTime: LocalDateTime? = null, | ||
@get:Schema(title = "最大过期时间") | ||
val maxExpiredTime: LocalDateTime? = null, | ||
@get:Schema(title = "离职标识") | ||
val departedFlag: Boolean? = false, | ||
@get:Schema(title = "是否查询模板") | ||
val queryTemplate: Boolean? = false, | ||
@get:Schema(title = "限制") | ||
val limit: Int? = null, | ||
@get:Schema(title = "起始值") | ||
val offset: Int? = null | ||
) { | ||
companion object { | ||
fun build( | ||
projectMembersQueryConditionReq: ProjectMembersQueryConditionReq, | ||
iamGroupIds: List<Int>? | ||
): ProjectMembersQueryConditionDTO { | ||
return with(projectMembersQueryConditionReq) { | ||
val minExpiredTime = minExpiredAt?.let { DateTimeUtil.convertTimestampToLocalDateTime(it / 1000) } | ||
val maxExpiredTime = maxExpiredAt?.let { DateTimeUtil.convertTimestampToLocalDateTime(it / 1000) } | ||
val limit = PageUtil.convertPageSizeToSQLLimit(page, pageSize) | ||
ProjectMembersQueryConditionDTO( | ||
projectCode = projectCode, | ||
memberType = memberType, | ||
userName = userName, | ||
deptName = deptName, | ||
groupName = groupName, | ||
iamGroupIds = iamGroupIds, | ||
minExpiredTime = minExpiredTime, | ||
maxExpiredTime = maxExpiredTime, | ||
departedFlag = departedFlag, | ||
limit = limit.limit, | ||
offset = limit.offset | ||
) | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...h/src/main/kotlin/com/tencent/devops/auth/pojo/request/ProjectMembersQueryConditionReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.tencent.devops.auth.pojo.request | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(title = "项目成员查询业务处理请求体") | ||
data class ProjectMembersQueryConditionReq( | ||
@get:Schema(title = "项目ID") | ||
val projectCode: String, | ||
@get:Schema(title = "成员类型") | ||
val memberType: String?, | ||
@get:Schema(title = "用户名称") | ||
val userName: String?, | ||
@get:Schema(title = "部门名称") | ||
val deptName: String?, | ||
@get:Schema(title = "用户组名称") | ||
val groupName: String?, | ||
@get:Schema(title = "最小过期时间") | ||
val minExpiredAt: Long?, | ||
@get:Schema(title = "最大过期时间") | ||
val maxExpiredAt: Long?, | ||
@get:Schema(title = "离职标识") | ||
val departedFlag: Boolean? = false, | ||
@get:Schema(title = "第几页") | ||
val page: Int, | ||
@get:Schema(title = "页数") | ||
val pageSize: Int | ||
) { | ||
// 当查询到权限相关信息时,如组名称,过期时间,操作,资源类型时,走复杂查询逻辑 | ||
fun isComplexQuery(): Boolean { | ||
return groupName != null || minExpiredAt != null || maxExpiredAt != null | ||
} | ||
|
||
fun isNeedToQueryIamGroupIds(): Boolean { | ||
return groupName != null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.