瀏覽代碼

fix: 修复对于 testStep 鉴权错误的问题

刘一也 5 年之前
父節點
當前提交
d0192a4eeb

+ 3 - 0
web/src/main/java/cn/seecoder/web/dao/func_test/FuncTestStepMapper.java

@@ -27,4 +27,7 @@ public interface FuncTestStepMapper {
 
     @Select("select * from func_test_step where test_case_id = #{testCaseId}")
     List<FuncTestStepPO> selectByTestCaseId(Integer testCaseId);
+
+    @Select("select * from func_test_step where id = #{testStepId}")
+    FuncTestStepPO selectById(Integer testStepId);
 }

+ 3 - 3
web/src/main/java/cn/seecoder/web/infrastructure/config/AuthTools.java

@@ -143,11 +143,11 @@ public class AuthTools {
 
     public boolean checkTestStepOwnership (Integer testStepId) {
         log.info("checkTestStepOwnership verifying testStepId: " + testStepId);
-        List<FuncTestStepPO> funcTestStepPOS = funcTestStepMapper.selectByTestCaseId(testStepId);
-        if (funcTestStepPOS == null) {
+        FuncTestStepPO funcTestStepPO = funcTestStepMapper.selectById(testStepId);
+        if (funcTestStepPO == null) {
             return false;
         }
-        Integer testCaseId = funcTestStepPOS.get(0).getTestCaseId();
+        Integer testCaseId = funcTestStepPO.getTestCaseId();
         return checkTestCaseOwnership(testCaseId);
     }