refactor(用例评审): 获取某个项目下的固定权限的用户列表增加头像

This commit is contained in:
guoyuqi 2024-01-09 12:04:56 +08:00 committed by 刘瑞斌
parent 581de62928
commit 98ce08f1fb
5 changed files with 11 additions and 9 deletions

View File

@ -9,8 +9,8 @@ import io.metersphere.functional.service.CaseReviewLogService;
import io.metersphere.functional.service.CaseReviewNoticeService;
import io.metersphere.functional.service.CaseReviewService;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.system.domain.User;
import io.metersphere.system.dto.sdk.request.PosRequest;
import io.metersphere.system.dto.user.UserDTO;
import io.metersphere.system.log.annotation.Log;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.notice.annotation.SendNotice;
@ -51,7 +51,7 @@ public class CaseReviewController {
}
@PostMapping("/module/count")
@Operation(summary = "用例管理-用例评审-获取模块树统计数量")
@Operation(summary = "用例管理-用例评审-统计模块数量")
@RequiresPermissions(PermissionConstants.CASE_REVIEW_READ)
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public Map<String, Long> moduleCount(@Validated @RequestBody CaseReviewPageRequest request) {
@ -92,7 +92,7 @@ public class CaseReviewController {
@Operation(summary = "用例管理-用例评审-获取具有评审权限的用户")
@RequiresPermissions(value = {PermissionConstants.CASE_REVIEW_READ_ADD,PermissionConstants.CASE_REVIEW_READ_UPDATE}, logical = Logical.OR)
@CheckOwner(resourceId = "#projectId", resourceType = "project")
public List<User> getReviewUserList(@PathVariable String projectId, @Schema(description = "查询关键字,根据邮箱和用户名查询")
public List<UserDTO> getReviewUserList(@PathVariable String projectId, @Schema(description = "查询关键字,根据邮箱和用户名查询")
@RequestParam(value = "keyword", required = false) String keyword) {
return caseReviewService.getReviewUserList(projectId, keyword);
}

View File

@ -139,7 +139,7 @@ public class FunctionalCaseController {
}
@PostMapping("/module/count")
@Operation(summary = "用例管理-功能用例-表格分页查询文件")
@Operation(summary = "用例管理-功能用例-统计模块数量")
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ)
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public Map<String, Long> moduleCount(@Validated @RequestBody FunctionalCasePageRequest request) {

View File

@ -17,8 +17,8 @@ import io.metersphere.sdk.constants.ApplicationNumScope;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.system.domain.User;
import io.metersphere.system.dto.sdk.request.PosRequest;
import io.metersphere.system.dto.user.UserDTO;
import io.metersphere.system.mapper.ExtUserMapper;
import io.metersphere.system.uid.IDGenerator;
import io.metersphere.system.uid.NumGenerator;
@ -317,7 +317,7 @@ public class CaseReviewService {
* @param keyword 查询关键字根据邮箱和用户名查询
* @return List<User>
*/
public List<User> getReviewUserList(String projectId, String keyword) {
public List<UserDTO> getReviewUserList(String projectId, String keyword) {
return extUserMapper.getUserByPermission(projectId, keyword, PermissionConstants.CASE_REVIEW_REVIEW);
}

View File

@ -1,6 +1,7 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.User;
import io.metersphere.system.dto.user.UserDTO;
import io.metersphere.system.dto.user.UserExtendDTO;
import org.apache.ibatis.annotations.Param;
@ -30,7 +31,7 @@ public interface ExtUserMapper {
* @param permission 权限
* @return 用户列表
*/
List<User>getUserByPermission(@Param("projectId") String projectId, @Param("keyword") String keyword, @Param("permission") String permission);
List<UserDTO>getUserByPermission(@Param("projectId") String projectId, @Param("keyword") String keyword, @Param("permission") String permission);
long countByIdAndPassword(@Param("userId") String id, @Param("password") String password);

View File

@ -58,9 +58,10 @@
</select>
<select id="getUserByPermission" resultType="io.metersphere.system.domain.User">
SELECT u.id, u.name, u.email
<select id="getUserByPermission" resultType="io.metersphere.system.dto.user.UserDTO">
SELECT u.id as id, u.name as name, u.email as email, ue.avatar as avatar
FROM user u
LEFT JOIN user_extend ue ON u.id = ue.id
LEFT JOIN user_role_relation urr ON u.id = urr.user_id
WHERE urr.role_id IN (SELECT urp.role_id FROM user_role_permission urp WHERE urp.permission_id = #{permission})
AND urr.source_id = #{projectId}