测试计划接口调整
This commit is contained in:
@@ -8,6 +8,7 @@ import com.test.common.enums.BusinessType;
|
||||
import com.test.common.utils.poi.ExcelUtil;
|
||||
import com.test.test.domain.TestPlanDefect;
|
||||
import com.test.test.domain.qo.TestPlanDefectQO;
|
||||
import com.test.test.domain.qo.TestPlanDefectRelQO;
|
||||
import com.test.test.domain.vo.TestPlanDefectVo;
|
||||
import com.test.test.service.ITestPlanDefectService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -65,10 +66,11 @@ public class TestPlanDefectController extends BaseController
|
||||
* 新增测试计划测试缺陷关联
|
||||
*/
|
||||
@Log(title = "测试计划测试缺陷关联", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TestPlanDefect testPlanDefect)
|
||||
@PostMapping(value = "/addRelDefect")
|
||||
public AjaxResult add(@RequestBody TestPlanDefectRelQO qo)
|
||||
{
|
||||
return toAjax(testPlanDefectService.insertTestPlanDefect(testPlanDefect));
|
||||
testPlanDefectService.insertTestPlanDefect(qo);
|
||||
return success(qo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +87,7 @@ public class TestPlanDefectController extends BaseController
|
||||
* 删除测试计划测试缺陷关联
|
||||
*/
|
||||
@Log(title = "测试计划测试缺陷关联", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/{ids}")
|
||||
@PostMapping("/delRelDefect/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(testPlanDefectService.deleteTestPlanDefectByIds(ids));
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.test.test.domain.qo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 测试计划缺陷关联
|
||||
*/
|
||||
@Data
|
||||
public class TestPlanDefectRelQO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4779866915656657001L;
|
||||
|
||||
private Long planId;
|
||||
private Integer type;
|
||||
private List<Long> defectIdList;
|
||||
}
|
||||
@@ -60,4 +60,11 @@ public interface TestPlanDefectMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTestPlanDefectByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询关联列表
|
||||
* @param testPlanDefect
|
||||
* @return
|
||||
*/
|
||||
List<TestPlanDefect> selectRelList(TestPlanDefect testPlanDefect);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.test.test.service;
|
||||
import com.test.test.domain.TestPlanDefect;
|
||||
|
||||
import com.test.test.domain.qo.TestPlanDefectQO;
|
||||
import com.test.test.domain.qo.TestPlanDefectRelQO;
|
||||
import com.test.test.domain.vo.TestPlanDefectVo;
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,10 +34,10 @@ public interface ITestPlanDefectService
|
||||
/**
|
||||
* 新增测试计划测试缺陷关联
|
||||
*
|
||||
* @param testPlanDefect 测试计划测试缺陷关联
|
||||
* @param qo 测试计划测试缺陷关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTestPlanDefect(TestPlanDefect testPlanDefect);
|
||||
public void insertTestPlanDefect(TestPlanDefectRelQO qo);
|
||||
|
||||
/**
|
||||
* 修改测试计划测试缺陷关联
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.test.test.service.impl;
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.test.domain.TestPlanDefect;
|
||||
import com.test.test.domain.qo.TestPlanDefectQO;
|
||||
import com.test.test.domain.qo.TestPlanDefectRelQO;
|
||||
import com.test.test.domain.vo.TestPlanDefectVo;
|
||||
import com.test.test.mapper.TestPlanDefectMapper;
|
||||
import com.test.test.service.ITestPlanDefectService;
|
||||
@@ -10,6 +11,7 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 测试计划测试缺陷关联Service业务层处理
|
||||
@@ -50,14 +52,34 @@ public class TestPlanDefectServiceImpl implements ITestPlanDefectService
|
||||
/**
|
||||
* 新增测试计划测试缺陷关联
|
||||
*
|
||||
* @param testPlanDefect 测试计划测试缺陷关联
|
||||
* @param testPlanDefectRelQO 测试计划测试缺陷关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTestPlanDefect(TestPlanDefect testPlanDefect)
|
||||
public void insertTestPlanDefect(TestPlanDefectRelQO testPlanDefectRelQO)
|
||||
{
|
||||
testPlanDefect.setCreateTime(DateUtils.getNowDate());
|
||||
return testPlanDefectMapper.insertTestPlanDefect(testPlanDefect);
|
||||
List<Long> defectIdList = testPlanDefectRelQO.getDefectIdList();
|
||||
for (Long defectId : defectIdList) {
|
||||
TestPlanDefect testPlanDefect = new TestPlanDefect();
|
||||
testPlanDefect.setPlanId(String.valueOf(testPlanDefectRelQO.getPlanId()));
|
||||
testPlanDefect.setDefectId(String.valueOf(defectId));
|
||||
testPlanDefect.setType(String.valueOf(testPlanDefectRelQO.getType()));
|
||||
List<TestPlanDefect> testPlanDefectList = selectRelList(testPlanDefect);
|
||||
if (!CollectionUtils.isEmpty(testPlanDefectList)) {
|
||||
continue;
|
||||
}
|
||||
testPlanDefect.setCreateTime(DateUtils.getNowDate());
|
||||
testPlanDefectMapper.insertTestPlanDefect(testPlanDefect);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已存在的关联列表
|
||||
* @param testPlanDefect
|
||||
* @return
|
||||
*/
|
||||
private List<TestPlanDefect> selectRelList(TestPlanDefect testPlanDefect) {
|
||||
return testPlanDefectMapper.selectRelList(testPlanDefect);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,6 +53,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectRelList" resultType="TestPlanDefect">
|
||||
SELECT
|
||||
tpd.id,
|
||||
tpd.defect_id AS defectId,
|
||||
tpd.plan_id AS planId,
|
||||
tpd.type,
|
||||
tpd.create_time
|
||||
FROM test_plan_defect tpd
|
||||
where 1=1
|
||||
AND tpd.del_flag = '0'
|
||||
<if test="planId != null">
|
||||
AND tpd.plan_id = #{planId}
|
||||
</if>
|
||||
<if test="defectId != null">
|
||||
AND tpd.defect_id = #{defectId}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND tpd.type = #{type}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertTestPlanDefect" parameterType="TestPlanDefect">
|
||||
insert into test_plan_defect
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -96,7 +117,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestPlanDefectByIds" parameterType="String">
|
||||
delete from test_plan_defect where id in
|
||||
UPDATE test_plan_defect
|
||||
SET del_flag = '1'
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
Reference in New Issue
Block a user