Parcourir la source

代码测试案例修改

车车 il y a 1 an
Parent
commit
eef9368217

+ 4 - 4
ktg-iscs/src/main/java/com/ktg/iscs/controller/TestIscsController.java

@@ -24,7 +24,7 @@ import java.util.List;
  * 测试用Controller
  *
  * @author yinjinlu
- * @date 2024-10-14
+ * @date 2024-10-15
  */
 @Api(tags = "测试用")
 @RestController
@@ -73,7 +73,7 @@ public class TestIscsController extends BaseController
     @Parameter(name = "id", description = "id")
     @PreAuthorize("@ss.hasPermi('test:iscs:query')")
     @GetMapping(value = "/selectTestIscsById")
-    public CommonResult<TestIscs> selectTestIscsById(@PathVariable("id") Long id)
+    public CommonResult<TestIscs> selectTestIscsById(Long id)
     {
         return CommonResult.success(testIscsService.selectTestIscsById(id));
     }
@@ -109,8 +109,8 @@ public class TestIscsController extends BaseController
     @PreAuthorize("@ss.hasPermi('test:iscs:remove')")
     @Log(title = "测试用", businessType = BusinessType.DELETE)
 	@PostMapping("/deleteTestIscsByIds")
-    public CommonResult<Boolean> deleteTestIscsByIds(@PathVariable Long[] ids)
+    public CommonResult<Boolean> deleteTestIscsByIds(String ids)
     {
-        return CommonResult.success(testIscsService.deleteTestIscsByIds(ids) == 1);
+        return CommonResult.success(testIscsService.deleteTestIscsByIds(ids) != 0);
     }
 }

+ 2 - 2
ktg-iscs/src/main/java/com/ktg/iscs/service/ITestIscsService.java

@@ -9,7 +9,7 @@ import java.util.List;
  * 测试用Service接口
  *
  * @author yinjinlu
- * @date 2024-10-14
+ * @date 2024-10-15
  */
 public interface ITestIscsService extends IService<TestIscs>
 {
@@ -51,7 +51,7 @@ public interface ITestIscsService extends IService<TestIscs>
      * @param ids 需要删除的测试用主键集合
      * @return 结果
      */
-    int deleteTestIscsByIds(Long[] ids);
+    int deleteTestIscsByIds(String ids);
 
     /**
      * 删除测试用信息

+ 10 - 3
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/TestIscsServiceImpl.java

@@ -1,6 +1,8 @@
 package com.ktg.iscs.service.impl;
 
+import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ktg.common.core.text.Convert;
 import com.ktg.common.utils.DateUtils;
 import com.ktg.iscs.domain.TestIscs;
 import com.ktg.iscs.mapper.TestIscsMapper;
@@ -8,13 +10,14 @@ import com.ktg.iscs.service.ITestIscsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
 import java.util.List;
 
 /**
  * 测试用Service业务层处理
  *
  * @author yinjinlu
- * @date 2024-10-14
+ * @date 2024-10-15
  */
 @Service
 public class TestIscsServiceImpl extends ServiceImpl<TestIscsMapper, TestIscs> implements ITestIscsService
@@ -79,9 +82,13 @@ public class TestIscsServiceImpl extends ServiceImpl<TestIscsMapper, TestIscs> i
      * @return 结果
      */
     @Override
-    public int deleteTestIscsByIds(Long[] ids)
+    public int deleteTestIscsByIds(String ids)
     {
-        return testIscsMapper.deleteTestIscsByIds(ids);
+        Assert.notBlank(ids, "请选择需要删除的数据!");
+        Long[] longIds = Convert.toLongArray(ids);
+        boolean b = removeBatchByIds(Arrays.asList(longIds));
+        return 1;
+        // return testIscsMapper.deleteTestIscsByIds(longIds);
     }
 
     /**