fix
This commit is contained in:
@@ -3,20 +3,17 @@ package com.test.test.controller;
|
||||
import com.test.common.annotation.Log;
|
||||
import com.test.common.core.controller.BaseController;
|
||||
import com.test.common.core.domain.AjaxResult;
|
||||
import com.test.common.core.page.TableDataInfo;
|
||||
import com.test.common.enums.BusinessType;
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.test.domain.TestCase;
|
||||
import com.test.test.domain.TestCaseStep;
|
||||
import com.test.test.domain.qo.IDQO;
|
||||
import com.test.test.domain.qo.TestCaseListQO;
|
||||
import com.test.test.service.ITestCaseService;
|
||||
import com.test.test.domain.qo.TestCaseStepAddQO;
|
||||
import com.test.test.service.ITestCaseStepService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 步骤Controller
|
||||
@@ -48,10 +45,13 @@ public class TestCaseStepController extends BaseController {
|
||||
*/
|
||||
@Log(title = "步骤", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody TestCaseStep testCaseStep) {
|
||||
testCaseStep.setCreateBy(getLoginUser().getUsername());
|
||||
testCaseStep.setCreateTime(DateUtils.getNowDate());
|
||||
return toAjax(testCaseStepService.insertTestCaseStep(testCaseStep));
|
||||
public AjaxResult add(@RequestBody TestCaseStepAddQO qo) {
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
qo.getList().forEach(testCaseStep -> {
|
||||
testCaseStep.setCreateBy(getLoginUser().getUsername());
|
||||
testCaseStep.setCreateTime(nowDate);
|
||||
});
|
||||
return toAjax(testCaseStepService.insertBatchTestCaseStep(qo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.test.test.domain.qo;
|
||||
|
||||
import com.test.test.domain.TestCaseStep;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TestCaseStepAddQO {
|
||||
private Long caseId;
|
||||
private List<TestCaseStep> list;
|
||||
}
|
||||
@@ -67,4 +67,6 @@ public interface TestCaseStepMapper
|
||||
* @return 用例步骤集合
|
||||
*/
|
||||
public List<TestCaseStep> selectTestCaseStepListByCaseId(Long caseId);
|
||||
|
||||
int deleteTestCaseStepByCaseId(Long caseId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.test.test.service;
|
||||
|
||||
import com.test.test.domain.TestCaseStep;
|
||||
import com.test.test.domain.qo.TestCaseStepAddQO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -37,6 +38,14 @@ public interface ITestCaseStepService
|
||||
*/
|
||||
public int insertTestCaseStep(TestCaseStep testCaseStep);
|
||||
|
||||
/**
|
||||
* 新增用例步骤
|
||||
*
|
||||
* @param testCaseStep 用例步骤
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBatchTestCaseStep(TestCaseStepAddQO testCaseStep);
|
||||
|
||||
/**
|
||||
* 修改用例步骤
|
||||
*
|
||||
|
||||
@@ -4,11 +4,13 @@ import com.test.common.core.domain.model.JmeterRequest;
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.common.utils.JMeterUtil;
|
||||
import com.test.test.domain.TestCaseStep;
|
||||
import com.test.test.domain.qo.TestCaseStepAddQO;
|
||||
import com.test.test.mapper.TestCaseStepMapper;
|
||||
import com.test.test.service.ITestCaseStepService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -21,8 +23,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
{
|
||||
public class TestCaseStepServiceImpl implements ITestCaseStepService {
|
||||
@Resource
|
||||
private TestCaseStepMapper testCaseStepMapper;
|
||||
|
||||
@@ -33,8 +34,7 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
* @return 用例步骤
|
||||
*/
|
||||
@Override
|
||||
public TestCaseStep selectTestCaseStepById(Long id)
|
||||
{
|
||||
public TestCaseStep selectTestCaseStepById(Long id) {
|
||||
return testCaseStepMapper.selectTestCaseStepById(id);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,7 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
* @return 用例步骤
|
||||
*/
|
||||
@Override
|
||||
public List<TestCaseStep> selectTestCaseStepList(TestCaseStep testCaseStep)
|
||||
{
|
||||
public List<TestCaseStep> selectTestCaseStepList(TestCaseStep testCaseStep) {
|
||||
return testCaseStepMapper.selectTestCaseStepList(testCaseStep);
|
||||
}
|
||||
|
||||
@@ -57,12 +56,22 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTestCaseStep(TestCaseStep testCaseStep)
|
||||
{
|
||||
public int insertTestCaseStep(TestCaseStep testCaseStep) {
|
||||
testCaseStep.setCreateTime(DateUtils.getNowDate());
|
||||
return testCaseStepMapper.insertTestCaseStep(testCaseStep);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertBatchTestCaseStep(TestCaseStepAddQO qo) {
|
||||
testCaseStepMapper.deleteTestCaseStepByCaseId(qo.getCaseId());
|
||||
int i = 0;
|
||||
for (TestCaseStep testCaseStep1 : qo.getList()) {
|
||||
i += insertTestCaseStep(testCaseStep1);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用例步骤
|
||||
*
|
||||
@@ -70,8 +79,7 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTestCaseStep(TestCaseStep testCaseStep)
|
||||
{
|
||||
public int updateTestCaseStep(TestCaseStep testCaseStep) {
|
||||
testCaseStep.setUpdateTime(DateUtils.getNowDate());
|
||||
return testCaseStepMapper.updateTestCaseStep(testCaseStep);
|
||||
}
|
||||
@@ -83,8 +91,7 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestCaseStepByIds(Long[] ids)
|
||||
{
|
||||
public int deleteTestCaseStepByIds(Long[] ids) {
|
||||
return testCaseStepMapper.deleteTestCaseStepByIds(ids);
|
||||
}
|
||||
|
||||
@@ -95,8 +102,7 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestCaseStepById(Long id)
|
||||
{
|
||||
public int deleteTestCaseStepById(Long id) {
|
||||
return testCaseStepMapper.deleteTestCaseStepById(id);
|
||||
}
|
||||
|
||||
@@ -114,7 +120,7 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService
|
||||
/**
|
||||
* 执行jmeter用例步骤计划
|
||||
*
|
||||
* @param id 用例步骤主键
|
||||
* @param id 用例步骤主键
|
||||
* @param jmeterHomePath jmeter安装路径
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -215,6 +215,12 @@
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestCaseStepByCaseId" parameterType="Long">
|
||||
delete
|
||||
from test_case_step
|
||||
where case_id = #{caseId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestCaseStepByIds" parameterType="String">
|
||||
delete from test_case_step where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
|
||||
Reference in New Issue
Block a user