This commit is contained in:
even 2025-06-26 15:44:26 +08:00
commit c568df8e6f
3 changed files with 27 additions and 0 deletions

View File

@ -84,4 +84,12 @@ public class TestCaseInfoController {
return CommonResult.success(resp);
}
@PostMapping(path="/findFileTypeList")
public CommonResult<List<String>> findFileTypeList(){
List<String> respList = testCaseInfoService.findFileTypeList();
return CommonResult.success(respList);
}
}

View File

@ -31,4 +31,6 @@ public interface TestCaseInfoService extends IService<TestCaseInfo> {
PageResult<TestCaseInfoResp> findPage(@Valid TestCaseInfoQueryReq query);
TestCaseInfoResp findById(String id);
List<String> findFileTypeList();
}

View File

@ -20,6 +20,7 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
@ -101,6 +102,22 @@ public class TestCaseInfoServiceImpl extends ServiceImpl<TestCaseInfoDao, TestCa
return testCaseInfoResp;
}
@Override
public List<String> findFileTypeList() {
List<TestCaseInfo> testCaseInfos = testCaseInfoDao.selectList(new QueryWrapper<>());
if (ObjectUtils.isEmpty(testCaseInfos)){
return new ArrayList<>();
}
//将文件类型取出并去重
List<String> fileTypeList = testCaseInfos.stream().map(TestCaseInfo::getTestFileType).distinct().toList();
if (CollectionUtils.isEmpty(fileTypeList)){
return new ArrayList<>();
}
return fileTypeList;
}
private void setUserName(TestCaseInfoResp testCaseInfoResp) {