Commit 6388f8fc authored by 盖献康's avatar 盖献康

检验内容库 - 检验内容 - 关联测试用例

parent 209a7e09
......@@ -7,7 +7,10 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 测试用例
......@@ -15,6 +18,9 @@ import lombok.Data;
*/
@TableName(value ="t_test_usecase")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TestUseCase implements Serializable {
/**
* 主键
......@@ -90,6 +96,9 @@ public class TestUseCase implements Serializable {
@ApiModelProperty("用例ID")
private String caseId;
@ApiModelProperty("标准条款ID")
private Long reviewStandardId;
/**
* 返回用例在矩阵中的坐标
* @return
......
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 可显示用例
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OptionalUseCasesVO {
@ApiModelProperty("禁用")
private Boolean disabled;
@ApiModelProperty("值")
private Long key;
@ApiModelProperty("键")
private String label;
@ApiModelProperty("标准ID")
private Long standardId;
}
......@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.TestUseCase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.vo.OptionalUseCasesVO;
import com.ruoyi.domain.vo.TestUsecaseVO;
import com.ruoyi.web.request.TestUserCaseRequest;
import org.springframework.stereotype.Repository;
......@@ -31,6 +32,13 @@ public interface TestUseCaseMapper extends BaseMapper<TestUseCase> {
* @return
*/
List<TestUsecaseVO> selectListByTaskId(Long id);
/**
* 查询测试用例列表
* @return
*/
List<OptionalUseCasesVO> selectOptionalUsecase();
}
......
......@@ -5,10 +5,8 @@ import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewFindListRequest;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
import com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest;
import com.ruoyi.web.response.*;
import java.util.List;
......@@ -59,4 +57,17 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
// 标准-要点-细则
List<ReviewStandard> findDetailsList(ReviewFindListRequest request);
/**
* 选择标准-测试用例
* @param standardId
* @return
*/
ReviewStandardStandardUsecaseResponse selectStandardUsecase(Long standardId);
/**
* 保存 标准-检验内容-用例
* @param request
*/
void saveStandardUsecase(ReviewStandardSaveStandardUsecaseRequest request);
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewKeyPointMapper;
import com.ruoyi.mapper.ReviewStandardMapper;
import com.ruoyi.domain.vo.OptionalUseCasesVO;
import com.ruoyi.mapper.*;
import com.ruoyi.service.*;
import com.ruoyi.web.request.ReviewFindListRequest;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
import com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest;
import com.ruoyi.web.response.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -21,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Transactional
@Service
......@@ -44,6 +44,9 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Autowired
private TestUseCaseMapper testUseCaseMapper;
/**
* 查询所有审查 标准、要点、细则、场景 并组织成树状结构返回
* @param standardId 关联到标准库中的id
......@@ -140,6 +143,37 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
return buildStandard(standardList,keyPointListTree);
}
/**
* 选择 标准-用例
* @param standardId
* @return
*/
@Override
public ReviewStandardStandardUsecaseResponse selectStandardUsecase(Long standardId) {
ReviewStandardStandardUsecaseResponse response = new ReviewStandardStandardUsecaseResponse();
// 查询当前所有的测试用例
List<OptionalUseCasesVO> testUseCases = testUseCaseMapper.selectOptionalUsecase();
// 查看此标准下所有的测试用例
List<TestUseCase> usecaseRelationList = testUseCaseMapper.selectList(new QueryWrapper<TestUseCase>().eq("review_standard_id", standardId));
// 此标准还可以选择的用例
List<OptionalUseCasesVO> optionalUseCasesVOList = testUseCases.stream().filter(a -> !a.getStandardId().equals(standardId)).collect(Collectors.toList());
optionalUseCasesVOList.stream().forEach(obj -> obj.setDisabled(false));
response.setOptionalUseCasesList(optionalUseCasesVOList);
response.setSelectedUseCaseList(usecaseRelationList.stream().map(TestUseCase::getId).collect(Collectors.toList()));
return response;
}
/**
* 保存 标准-用例
* @param request
*/
@Override
public void saveStandardUsecase(ReviewStandardSaveStandardUsecaseRequest request) {
testUseCaseMapper.update(
TestUseCase.builder().reviewStandardId(request.getStandardId()).build(),
new UpdateWrapper<TestUseCase>().in("id", request.getUsecaseIdList()));
}
/**
* 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中
* @param reviewStandardList
......
......@@ -8,10 +8,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
import com.ruoyi.web.response.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
......@@ -72,6 +69,32 @@ public class ReviewStandardController extends BaseController {
return R.ok(response);
}
/**
* 查询 标准-检验内容-用例
* @param request
* @return
*/
@Anonymous
@ApiOperation("查询 标准-检验内容-用例")
@PostMapping("/test/getStandardUsecase")
public R<ReviewStandardStandardUsecaseResponse> getStandardUsecase(@Validated @RequestBody ReviewStandardStandardUsecaseRequest request) {
ReviewStandardStandardUsecaseResponse response = reviewStandardService.selectStandardUsecase(request.getStandardId());
return R.ok(response);
}
/**
* 保存 标准-检验内容-用例
* @param request
* @return
*/
@Anonymous
@ApiOperation("保存 标准-检验内容-用例")
@PostMapping("/test/saveStandardUsecase")
public R<Boolean> saveStandardUsecase(@Validated @RequestBody ReviewStandardSaveStandardUsecaseRequest request) {
reviewStandardService.saveStandardUsecase(request);
return R.ok(true);
}
@ApiOperation("查询标注要求列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 保存标准用例请求DTO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("保存标准用例请求DTO")
public class ReviewStandardSaveStandardUsecaseRequest {
@ApiModelProperty("标准ID")
@NotNull(message = "标准ID不能为空")
private Long standardId;
@ApiModelProperty("用例ID集合")
private List<Long> usecaseIdList;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 标准-用例 请求
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("标准-用例 请求")
public class ReviewStandardStandardUsecaseRequest {
@ApiModelProperty("标准ID")
private Long standardId;
}
package com.ruoyi.web.response;
import com.ruoyi.domain.vo.OptionalUseCasesVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 标准-用例 返回 DTO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("标准-用例 返回 DTO")
public class ReviewStandardStandardUsecaseResponse {
@ApiModelProperty("可选择用例")
private List<OptionalUseCasesVO> optionalUseCasesList;
@ApiModelProperty("已选择用例")
private List<Long> selectedUseCaseList;
}
......@@ -76,4 +76,13 @@
where
mtt.id = #{id}
</select>
<select id="selectOptionalUsecase" resultType="com.ruoyi.domain.vo.OptionalUseCasesVO">
select
id AS `key`,
CONCAT('(', usecase_no, ')', name) AS label,
review_standard_id AS standardId
from
t_test_usecase
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment