测试计划前端及后端代码完善
This commit is contained in:
@@ -8,7 +8,7 @@ import com.test.test.service.ITestPlanProjectService;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -30,7 +30,7 @@ public class TestPlanProjectController extends BaseController {
|
||||
/**
|
||||
* 查询测试计划需求关联列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody IDQO qo) {
|
||||
startPage();
|
||||
List<TestPlanProjectVo> list = testPlanProjectService.selectTestPlanProjectList(qo.getId());
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
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.test.domain.qo.IDQO;
|
||||
import com.test.test.domain.qo.TestReportAddQO;
|
||||
import com.test.test.domain.vo.TestReportVo;
|
||||
import com.test.test.service.ITestReportService;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -31,10 +36,21 @@ public class TestReportController extends BaseController {
|
||||
* 查询测试计划关联测试报告列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/reportList")
|
||||
@PostMapping("/reportList")
|
||||
public TableDataInfo list(@RequestBody IDQO qo) {
|
||||
startPage();
|
||||
List<TestReportVo> list = testReportService.selectTestReportList(qo.getId());
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增测试报告及关联测试计划
|
||||
* @param testReportAddQO
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "测试报告", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addTestReport")
|
||||
public AjaxResult addTestReport(@RequestBody TestReportAddQO testReportAddQO) {
|
||||
return toAjax(testReportService.addTestReport(testReportAddQO));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.test.test.domain.qo;
|
||||
|
||||
import com.test.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 测试报告新增参数QO
|
||||
*/
|
||||
@Data
|
||||
public class TestReportAddQO extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = -6325566452451878775L;
|
||||
|
||||
/**
|
||||
* 测试报告id
|
||||
*/
|
||||
private Long reportId;
|
||||
|
||||
/**
|
||||
* 测试计划id
|
||||
*/
|
||||
private Long planId;
|
||||
|
||||
/**
|
||||
* 测试用例类型(0,冒烟测试,1,功能测试,2,回归测试,3,准生产测试,4,生产验证)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/** 测试报告编码 */
|
||||
private String serialNumber;
|
||||
|
||||
/** 测试报告名称 */
|
||||
private String name;
|
||||
|
||||
/** 测试结果(0,未通过,1,通过) */
|
||||
private String result;
|
||||
|
||||
/** 测试报告发送状态(0,未发送,1,已发送) */
|
||||
private String status;
|
||||
|
||||
/** 测试报告(jason格式存储) */
|
||||
private String report;
|
||||
|
||||
/** 版本 */
|
||||
private String version;
|
||||
|
||||
/** 0,正常,1,删除 */
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.test.test.mapper;
|
||||
|
||||
import com.test.test.domain.qo.TestReportAddQO;
|
||||
|
||||
public interface TestPlanReportMapper {
|
||||
|
||||
/**
|
||||
* 新增测试计划关联测试报告
|
||||
* @param testReportAddQO
|
||||
* @return
|
||||
*/
|
||||
int insertTestPlanReport(TestReportAddQO testReportAddQO);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.test.test.mapper;
|
||||
|
||||
import com.test.test.domain.TestReport;
|
||||
import com.test.test.domain.vo.TestReportVo;
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,4 +13,11 @@ public interface TestReportMapper {
|
||||
* @return
|
||||
*/
|
||||
List<TestReportVo> selectTestReportList(Long planId);
|
||||
|
||||
/**
|
||||
* 新增测试报告
|
||||
* @param testReport
|
||||
* @return
|
||||
*/
|
||||
int addTestReport(TestReport testReport);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.test.test.service;
|
||||
|
||||
import com.test.test.domain.TestReport;
|
||||
import com.test.test.domain.qo.TestReportAddQO;
|
||||
import com.test.test.domain.vo.TestReportVo;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,4 +16,11 @@ public interface ITestReportService {
|
||||
* @return
|
||||
*/
|
||||
List<TestReportVo> selectTestReportList(Long planId);
|
||||
|
||||
/**
|
||||
* 新增测试报告
|
||||
* @param testReportAddQO
|
||||
* @return
|
||||
*/
|
||||
public int addTestReport(TestReportAddQO testReportAddQO);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package com.test.test.service.impl;
|
||||
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.common.utils.SecurityUtils;
|
||||
import com.test.common.utils.bean.BeanUtils;
|
||||
import com.test.test.domain.TestReport;
|
||||
import com.test.test.domain.qo.TestReportAddQO;
|
||||
import com.test.test.domain.vo.TestReportVo;
|
||||
import com.test.test.mapper.TestPlanReportMapper;
|
||||
import com.test.test.mapper.TestReportMapper;
|
||||
import com.test.test.service.ITestReportService;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -19,6 +26,9 @@ public class TestReportServiceImpl implements ITestReportService {
|
||||
@Resource
|
||||
private TestReportMapper testReportMapper;
|
||||
|
||||
@Resource
|
||||
private TestPlanReportMapper testPlanReportMapper;
|
||||
|
||||
/**
|
||||
* 查询测试报告列表
|
||||
* @param planId
|
||||
@@ -28,4 +38,34 @@ public class TestReportServiceImpl implements ITestReportService {
|
||||
public List<TestReportVo> selectTestReportList(Long planId) {
|
||||
return testReportMapper.selectTestReportList(planId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增测试报告
|
||||
* @param testReportAddQO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int addTestReport(TestReportAddQO testReportAddQO) {
|
||||
TestReport testReport = new TestReport();
|
||||
BeanUtils.copyProperties(testReportAddQO,testReport);
|
||||
testReport.setSerialNumber(generateSerialNumber());
|
||||
testReport.setResult("0");
|
||||
testReport.setStatus("0");
|
||||
testReport.setCreateTime(DateUtils.getNowDate());
|
||||
testReport.setDelFlag("0");
|
||||
testReport.setUpdateBy(SecurityUtils.getUsername());
|
||||
testReportMapper.addTestReport(testReport);
|
||||
testReportAddQO.setReportId(testReport.getId());
|
||||
testReportAddQO.setCreateTime(DateUtils.getNowDate());
|
||||
testReportAddQO.setDelFlag("0");
|
||||
return testPlanReportMapper.insertTestPlanReport(testReportAddQO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机序列号
|
||||
* @return
|
||||
*/
|
||||
private String generateSerialNumber() {
|
||||
return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.test.test.mapper.TestPlanReportMapper">
|
||||
|
||||
<insert id="insertTestPlanReport" parameterType="testPlanAddQO">
|
||||
insert into test_plan_report
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="planId != null and planId != ''">plan_id,</if>
|
||||
<if test="reportId != null and reportId != ''">report_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="planId != null and planId != ''">#{planId},</if>
|
||||
<if test="reportId != null and reportId != ''">#{reportId},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -3,6 +3,33 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.test.test.mapper.TestReportMapper">
|
||||
<insert id="addTestReport" parameterType="TestReport" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into test_report
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="result != null and result != ''">result,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="report != null">report,</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="result != null and result != ''">#{result},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="report != null">#{report},</if>
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectTestReportList" parameterType="Long" resultType="TestReportVo">
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user