Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-02-19 11:02:29 +08:00
8 changed files with 525 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
package com.test.test.domain;
import com.test.common.annotation.Excel;
import com.test.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 用例对象 test_case
*
* @author liangdl
* @date 2025-02-18
*/
@Setter
@Getter
@ToString
public class TestCase extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用例id */
private Long id;
/** 节点id */
@Excel(name = "节点id")
private Long groupId;
/** 项目id */
@Excel(name = "项目id")
private Long projectId;
/** 用例名 */
@Excel(name = "用例名")
private String name;
/** 重要性321 */
@Excel(name = "重要性", readConverterExp = "高=321")
private Long importance;
/** 用例状态草稿1通过2不通过3 */
@Excel(name = "用例状态", readConverterExp = "草=稿1通过2不通过3")
private Long status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
}

View File

@@ -0,0 +1,48 @@
package com.test.test.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.test.common.annotation.Excel;
import com.test.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.Date;
/**
* 用例日志对象 test_case_log
*
* @author liangdl
* @date 2025-02-18
*/
@Setter
@Getter
@ToString
public class TestCaseLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 日志id */
private Long id;
/** 用例id */
@Excel(name = "用例id")
private String caseId;
/** 操作类别 */
@Excel(name = "操作类别")
private String operType;
/** 操作详情 */
@Excel(name = "操作详情")
private String operDetail;
/** 操作人员 */
@Excel(name = "操作人员")
private Long operUser;
/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operTime;
}

View File

@@ -0,0 +1,72 @@
package com.test.test.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.test.common.annotation.Excel;
import com.test.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.Date;
/**
* 用例执行报告对象 test_case_result
*
* @author liangdl
* @date 2025-02-18
*/
@Setter
@Getter
@ToString
public class TestCaseResult extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 报告id */
private Long id;
/** 用例id */
@Excel(name = "用例id")
private Long caseId;
/** 用例步骤id */
@Excel(name = "用例步骤id")
private Long stepId;
/** http 响应头 */
@Excel(name = "http 响应头")
private String responseHeader;
/** http 响应体 */
@Excel(name = "http 响应体")
private String responseBody;
private String sqlResult;
/** 循环次 */
@Excel(name = "循环次")
private Long pollingCount;
/** 轮询次 */
@Excel(name = "轮询次")
private Long loopCount;
/**
* 参数提取
*/
private String assignment;
/**
* 校验规则
*/
private String assertion;
/** 耗时 */
@Excel(name = "耗时")
private Long useTime;
/** 执行时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date executeTime;
/** 执行结果 */
@Excel(name = "执行结果")
private String status;
}

View File

@@ -0,0 +1,62 @@
package com.test.test.mapper;
import com.test.test.domain.TestCaseLog;
import java.util.List;
/**
* 用例日志Mapper接口
*
* @author test
* @date 2025-02-18
*/
public interface TestCaseLogMapper
{
/**
* 查询用例日志
*
* @param id 用例日志主键
* @return 用例日志
*/
public TestCaseLog selectTestCaseLogById(Long id);
/**
* 查询用例日志列表
*
* @param testCaseLog 用例日志
* @return 用例日志集合
*/
public List<TestCaseLog> selectTestCaseLogList(TestCaseLog testCaseLog);
/**
* 新增用例日志
*
* @param testCaseLog 用例日志
* @return 结果
*/
public int insertTestCaseLog(TestCaseLog testCaseLog);
/**
* 修改用例日志
*
* @param testCaseLog 用例日志
* @return 结果
*/
public int updateTestCaseLog(TestCaseLog testCaseLog);
/**
* 删除用例日志
*
* @param id 用例日志主键
* @return 结果
*/
public int deleteTestCaseLogById(Long id);
/**
* 批量删除用例日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTestCaseLogByIds(Long[] ids);
}

View File

@@ -0,0 +1,62 @@
package com.test.test.mapper;
import com.test.test.domain.TestCase;
import java.util.List;
/**
* 用例Mapper接口
*
* @author test
* @date 2025-02-18
*/
public interface TestCaseMapper
{
/**
* 查询用例
*
* @param id 用例主键
* @return 用例
*/
public TestCase selectTestCaseById(Long id);
/**
* 查询用例列表
*
* @param testCase 用例
* @return 用例集合
*/
public List<TestCase> selectTestCaseList(TestCase testCase);
/**
* 新增用例
*
* @param testCase 用例
* @return 结果
*/
public int insertTestCase(TestCase testCase);
/**
* 修改用例
*
* @param testCase 用例
* @return 结果
*/
public int updateTestCase(TestCase testCase);
/**
* 删除用例
*
* @param id 用例主键
* @return 结果
*/
public int deleteTestCaseById(Long id);
/**
* 批量删除用例
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTestCaseByIds(Long[] ids);
}

View File

@@ -0,0 +1,62 @@
package com.test.test.mapper;
import com.test.test.domain.TestCaseResult;
import java.util.List;
/**
* 用例执行报告Mapper接口
*
* @author test
* @date 2025-02-18
*/
public interface TestCaseResultMapper
{
/**
* 查询用例执行报告
*
* @param id 用例执行报告主键
* @return 用例执行报告
*/
public TestCaseResult selectTestCaseResultById(Long id);
/**
* 查询用例执行报告列表
*
* @param testCaseResult 用例执行报告
* @return 用例执行报告集合
*/
public List<TestCaseResult> selectTestCaseResultList(TestCaseResult testCaseResult);
/**
* 新增用例执行报告
*
* @param testCaseResult 用例执行报告
* @return 结果
*/
public int insertTestCaseResult(TestCaseResult testCaseResult);
/**
* 修改用例执行报告
*
* @param testCaseResult 用例执行报告
* @return 结果
*/
public int updateTestCaseResult(TestCaseResult testCaseResult);
/**
* 删除用例执行报告
*
* @param id 用例执行报告主键
* @return 结果
*/
public int deleteTestCaseResultById(Long id);
/**
* 批量删除用例执行报告
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTestCaseResultByIds(Long[] ids);
}

View File

@@ -0,0 +1,76 @@
<?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.TestCaseLogMapper">
<resultMap type="TestCaseLog" id="TestCaseLogResult">
<result property="id" column="id" />
<result property="caseId" column="case_id" />
<result property="operType" column="oper_type" />
<result property="operDetail" column="oper_detail" />
<result property="operUser" column="oper_user" />
<result property="operTime" column="oper_time" />
</resultMap>
<sql id="selectTestCaseLogVo">
select id, case_id, oper_type, oper_detail, oper_user, oper_time from test_case_log
</sql>
<select id="selectTestCaseLogList" parameterType="TestCaseLog" resultMap="TestCaseLogResult">
<include refid="selectTestCaseLogVo"/>
<where>
<if test="caseId != null and caseId != ''"> and case_id = #{caseId}</if>
<if test="operType != null and operType != ''"> and oper_type = #{operType}</if>
<if test="operDetail != null and operDetail != ''"> and oper_detail = #{operDetail}</if>
<if test="operUser != null "> and oper_user = #{operUser}</if>
<if test="operTime != null "> and oper_time = #{operTime}</if>
</where>
</select>
<select id="selectTestCaseLogById" parameterType="Long" resultMap="TestCaseLogResult">
<include refid="selectTestCaseLogVo"/>
where id = #{id}
</select>
<insert id="insertTestCaseLog" parameterType="TestCaseLog" useGeneratedKeys="true" keyProperty="id">
insert into test_case_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="caseId != null">case_id,</if>
<if test="operType != null">oper_type,</if>
<if test="operDetail != null">oper_detail,</if>
<if test="operUser != null">oper_user,</if>
<if test="operTime != null">oper_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="caseId != null">#{caseId},</if>
<if test="operType != null">#{operType},</if>
<if test="operDetail != null">#{operDetail},</if>
<if test="operUser != null">#{operUser},</if>
<if test="operTime != null">#{operTime},</if>
</trim>
</insert>
<update id="updateTestCaseLog" parameterType="TestCaseLog">
update test_case_log
<trim prefix="SET" suffixOverrides=",">
<if test="caseId != null">case_id = #{caseId},</if>
<if test="operType != null">oper_type = #{operType},</if>
<if test="operDetail != null">oper_detail = #{operDetail},</if>
<if test="operUser != null">oper_user = #{operUser},</if>
<if test="operTime != null">oper_time = #{operTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTestCaseLogById" parameterType="Long">
delete from test_case_log where id = #{id}
</delete>
<delete id="deleteTestCaseLogByIds" parameterType="String">
delete from test_case_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,96 @@
<?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.TestCaseMapper">
<resultMap type="TestCase" id="TestCaseResult">
<result property="id" column="id" />
<result property="groupId" column="group_id" />
<result property="projectId" column="project_id" />
<result property="name" column="name" />
<result property="importance" column="importance" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTestCaseVo">
select id, group_id, project_id, name, importance, status, del_flag, create_by, create_time, update_by, update_time from test_case
</sql>
<select id="selectTestCaseList" parameterType="TestCase" resultMap="TestCaseResult">
<include refid="selectTestCaseVo"/>
<where>
<if test="groupId != null "> and group_id = #{groupId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="importance != null "> and importance = #{importance}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectTestCaseById" parameterType="Long" resultMap="TestCaseResult">
<include refid="selectTestCaseVo"/>
where id = #{id}
</select>
<insert id="insertTestCase" parameterType="TestCase" useGeneratedKeys="true" keyProperty="id">
insert into test_case
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupId != null">group_id,</if>
<if test="projectId != null">project_id,</if>
<if test="name != null">name,</if>
<if test="importance != null">importance,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupId != null">#{groupId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="name != null">#{name},</if>
<if test="importance != null">#{importance},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTestCase" parameterType="TestCase">
update test_case
<trim prefix="SET" suffixOverrides=",">
<if test="groupId != null">group_id = #{groupId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="name != null">name = #{name},</if>
<if test="importance != null">importance = #{importance},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTestCaseById" parameterType="Long">
delete from test_case where id = #{id}
</delete>
<delete id="deleteTestCaseByIds" parameterType="String">
delete from test_case where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>