fix(接口测试): 修复mock只读用户无法复制mock地址的缺陷

--bug=1041184 --user=王孝刚 【接口测试】Mock权限-只有查询权限的用户,不能使用复制Mock地址的功能
https://www.tapd.cn/55049933/s/1520656
This commit is contained in:
wxg0103 2024-05-24 16:00:52 +08:00 committed by wxg0103
parent 92b806599d
commit af19dab80b
4 changed files with 3 additions and 17 deletions

View File

@ -51,7 +51,7 @@ public interface ExtApiScenarioReportMapper {
void updateApiScenario(List<String> ids); void updateApiScenario(List<String> ids);
List<ApiScenarioReportStepDTO> selectStepDetailByReportId(@Param("id") String id, @Param("limit") int limit, @Param("offset") int offset); List<ApiScenarioReportStepDTO> selectStepDetailByReportId(@Param("id") String id);
List<ApiReportMessageDTO> getNoticeList(@Param("ids") List<String> ids); List<ApiReportMessageDTO> getNoticeList(@Param("ids") List<String> ids);

View File

@ -222,7 +222,6 @@
api_scenario_report_detail.sort as loopIndex api_scenario_report_detail.sort as loopIndex
from api_scenario_report_detail from api_scenario_report_detail
where api_scenario_report_detail.report_id = #{id} where api_scenario_report_detail.report_id = #{id}
limit #{limit} offset #{offset}
</select> </select>
<select id="getNoticeList" resultType="io.metersphere.system.dto.sdk.ApiReportMessageDTO"> <select id="getNoticeList" resultType="io.metersphere.system.dto.sdk.ApiReportMessageDTO">
select id ,name from api_scenario_report select id ,name from api_scenario_report

View File

@ -192,20 +192,7 @@ public class ApiScenarioReportService {
//需要查询出所有的步骤 //需要查询出所有的步骤
List<ApiScenarioReportStepDTO> scenarioReportSteps = extApiScenarioReportMapper.selectStepByReportId(id); List<ApiScenarioReportStepDTO> scenarioReportSteps = extApiScenarioReportMapper.selectStepByReportId(id);
//查询所有步骤的detail //查询所有步骤的detail
ApiScenarioReportDetailExample detailExample = new ApiScenarioReportDetailExample(); List<ApiScenarioReportStepDTO> deatilList = extApiScenarioReportMapper.selectStepDetailByReportId(id);
detailExample.createCriteria().andReportIdEqualTo(id);
long detailCount = apiScenarioReportDetailMapper.countByExample(detailExample);
// 分批查询 一次性查询1000个 超过50000个也只查询50000条
if (detailCount > MAX) {
detailCount = MAX;
}
int remainingCount = (int) detailCount;
List<ApiScenarioReportStepDTO> deatilList = new ArrayList<>();
for (int i = 0; i < detailCount; i += BATCH_SIZE) {
int currentBatchSize = Math.min(BATCH_SIZE, remainingCount);
deatilList.addAll(extApiScenarioReportMapper.selectStepDetailByReportId(id, currentBatchSize, i));
remainingCount -= currentBatchSize;
}
//根据stepId进行分组 //根据stepId进行分组
Map<String, List<ApiScenarioReportStepDTO>> detailMap = deatilList.stream().collect(Collectors.groupingBy(ApiScenarioReportStepDTO::getStepId)); Map<String, List<ApiScenarioReportStepDTO>> detailMap = deatilList.stream().collect(Collectors.groupingBy(ApiScenarioReportStepDTO::getStepId));

View File

@ -369,7 +369,7 @@
eventTag: 'copyMock', eventTag: 'copyMock',
label: t('mockManagement.copyMock'), label: t('mockManagement.copyMock'),
danger: false, danger: false,
permission: ['PROJECT_API_DEFINITION_MOCK:READ+ADD'], permission: ['PROJECT_API_DEFINITION_MOCK:READ'],
}, },
{ {
eventTag: 'delete', eventTag: 'delete',