Commit c894398a authored by 高滢's avatar 高滢

测试用例库

parent 8856858f
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
......@@ -69,6 +68,23 @@ public class TestUseCase implements Serializable {
@ApiModelProperty("用例描述")
private String description;
/** 更新者 */
@ApiModelProperty("更新者")
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("更新时间")
private Date updateTime;
/** 测试场景 */
@ApiModelProperty("测试场景")
private String testScenario;
/** 测试类型*/
@ApiModelProperty("测试类型")
private String testType;
/**
* 返回用例在矩阵中的坐标
* @return
......
......@@ -2,6 +2,10 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.TestUseCase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.web.request.TestUserCaseRequest;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author wangfei
......@@ -9,8 +13,16 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @createDate 2024-02-18 13:41:28
* @Entity com.ruoyi.domain.TestUseCase
*/
@Repository
public interface TestUseCaseMapper extends BaseMapper<TestUseCase> {
/**
* 查询测试用例列表
*
* @param testUserCaseRequest 测试用例库
* @return 测试用例集合
*/
public List<TestUseCase> selectseCaseList(TestUserCaseRequest testUserCaseRequest);
}
......
......@@ -2,6 +2,9 @@ package com.ruoyi.service;
import com.ruoyi.domain.TestUseCase;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.TestUserCaseRequest;
import java.util.List;
/**
* @author wangfei
......@@ -9,5 +12,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @createDate 2024-02-18 13:41:28
*/
public interface TestUseCaseService extends IService<TestUseCase> {
/**
* 查询测试用例列表
*
* @param testUserCaseRequest 测试用例库
* @return 测试用例集合
*/
public List<TestUseCase> selectseCaseList(TestUserCaseRequest testUserCaseRequest);
}
......@@ -4,7 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.mapper.TestUseCaseMapper;
import com.ruoyi.web.request.TestUserCaseRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author wangfei
......@@ -12,8 +17,22 @@ import org.springframework.stereotype.Service;
* @createDate 2024-02-18 13:41:28
*/
@Service
public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestUseCase>
implements TestUseCaseService{
@Transactional
public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestUseCase> implements TestUseCaseService{
@Autowired
private TestUseCaseMapper testUseCaseMapper;
/**
* 查询测试用例列表
*
* @param testUserCaseRequest 测试用例库
* @return 测试用例集合
*/
@Override
public List<TestUseCase> selectseCaseList(TestUserCaseRequest testUserCaseRequest){
return testUseCaseMapper.selectseCaseList(testUserCaseRequest);
}
}
......
package com.ruoyi.web;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.web.request.TestUserCaseRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = "测试用例")
@RestController
@RequestMapping("/system/testCase")
public class TestUserCaseController extends BaseController{
@Autowired
private TestUseCaseService testUseCaseService;
@ApiOperation("查询测试用例分页查询")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getList")
public TableDataInfo<TestUseCase> listPage(@Validated @RequestBody TestUserCaseRequest testUserCaseRequest){
startPage(testUserCaseRequest);
List<TestUseCase> list = testUseCaseService.selectseCaseList(testUserCaseRequest);
return getDataTable(list);
}
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel
public class TestUserCaseRequest extends PageDomain {
/**
* 测试场景id
*/
@ApiModelProperty("测试场景id")
private Long testScenarioId;
/**
* 测试类型id
*/
@ApiModelProperty("测试类型id")
private Long testTypeId;
/**
* 编号或者名称*/
@ApiModelProperty("编号或者名称")
private String searchKeywords;
}
......@@ -13,6 +13,10 @@
<result property="tools" column="tools" jdbcType="VARCHAR"/>
<result property="input" column="input" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="testType" column="test_type" />
<result property="testScenario" column="test_scenario" />
</resultMap>
<sql id="Base_Column_List">
......@@ -20,4 +24,27 @@
usecase_no,name,tools,
input,description
</sql>
<select id="selectseCaseList" parameterType="com.ruoyi.web.request.TestUserCaseRequest" resultMap="BaseResultMap">
select tu.id,
tu.test_scenario_id,
tu.test_type_id,
tu.usecase_no,
tu.name,
tu.tools,
tu.input,
tu.description,
tu.update_by,
tu.update_time,
ty.test_type,
ts.test_scenario
from t_test_usecase tu
left join t_test_type ty on ty.id = tu.test_type_id
left join t_test_scenario ts on ts.id = tu.test_scenario_id
<where>
<if test="testScenarioId != null and testScenarioId != ''"> and tu.test_scenario_id = #{testScenarioId}</if>
<if test="testTypeId != null and testTypeId != ''"> and tu.test_type_id = #{testTypeId}</if>
<if test="searchKeywords != null and searchKeywords != ''"> and tu.usecase_no like concat('%', #{searchKeywords}, '%') or tu.name like concat('%', #{searchKeywords}, '%')</if>
</where>
</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