diff --git a/test-test/src/main/java/com/test/test/controller/PerformanceTestController.java b/test-test/src/main/java/com/test/test/controller/PerformanceTestController.java new file mode 100644 index 0000000..3bf7e23 --- /dev/null +++ b/test-test/src/main/java/com/test/test/controller/PerformanceTestController.java @@ -0,0 +1,105 @@ +package com.test.test.controller; + +import java.util.List; + +import com.test.test.domain.PerformanceTest; +import com.test.test.service.IPerformanceTestService; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.test.common.annotation.Log; +import com.test.common.core.controller.BaseController; +import com.test.common.core.domain.AjaxResult; +import com.test.common.enums.BusinessType; +import com.test.common.utils.poi.ExcelUtil; +import com.test.common.core.page.TableDataInfo; + +/** + * 性能测试Controller + * + * @author test + * @date 2025-04-14 + */ +@RestController +@RequestMapping("/test/PerformanceTest") +public class PerformanceTestController extends BaseController +{ + @Autowired + private IPerformanceTestService performanceTestService; + + /** + * 查询性能测试列表 + */ +// @PreAuthorize("@ss.hasPermi('system:test:list')") + @GetMapping("/list") + public TableDataInfo list(PerformanceTest performanceTest) + { + startPage(); + List list = performanceTestService.selectPerformanceTestList(performanceTest); + return getDataTable(list); + } + + /** + * 导出性能测试列表 + */ + // @PreAuthorize("@ss.hasPermi('system:test:export')") + @Log(title = "性能测试", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PerformanceTest performanceTest) + { + List list = performanceTestService.selectPerformanceTestList(performanceTest); + ExcelUtil util = new ExcelUtil(PerformanceTest.class); + util.exportExcel(response, list, "性能测试数据"); + } + + /** + * 获取性能测试详细信息 + */ + // @PreAuthorize("@ss.hasPermi('system:test:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(performanceTestService.selectPerformanceTestById(id)); + } + + /** + * 新增性能测试 + */ + // @PreAuthorize("@ss.hasPermi('system:test:add')") + @Log(title = "性能测试", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PerformanceTest performanceTest) + { + return toAjax(performanceTestService.insertPerformanceTest(performanceTest)); + } + + /** + * 修改性能测试 + */ + // @PreAuthorize("@ss.hasPermi('system:test:edit')") + @Log(title = "性能测试", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PerformanceTest performanceTest) + { + return toAjax(performanceTestService.updatePerformanceTest(performanceTest)); + } + + /** + * 删除性能测试 + */ + // @PreAuthorize("@ss.hasPermi('system:test:remove')") + @Log(title = "性能测试", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(performanceTestService.deletePerformanceTestByIds(ids)); + } +} diff --git a/test-test/src/main/java/com/test/test/domain/PerformanceTest.java b/test-test/src/main/java/com/test/test/domain/PerformanceTest.java new file mode 100644 index 0000000..fc519d1 --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/PerformanceTest.java @@ -0,0 +1,250 @@ +package com.test.test.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.test.common.annotation.Excel; +import com.test.common.core.domain.BaseEntity; + +/** + * 性能测试对象 performance_test + * + * @author test + * @date 2025-04-14 + */ +public class PerformanceTest extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 性能测试名称 */ + @Excel(name = "性能测试名称") + private String performanceName; + + /** crontab表达式 */ + @Excel(name = "crontab表达式") + private String crontab; + + /** 定时任务状态:0关闭,1开启,默认0 */ + @Excel(name = "定时任务状态:0关闭,1开启,默认0") + private Long crontabStatus; + + /** 并发线程数 */ + @Excel(name = "并发线程数") + private Long concurrentThreads; + + /** 在取样器错误后要执行的动作,1:继续;2:开始下一个线程轮询;3:停止线程;4:停止测试;5:立即停止测试 */ + @Excel(name = "在取样器错误后要执行的动作,1:继续;2:开始下一个线程轮询;3:停止线程;4:停止测试;5:立即停止测试") + private Long errorOperType; + + /** 执行方式,1:按持续时间;2:按迭代次数 */ + @Excel(name = "执行方式,1:按持续时间;2:按迭代次数") + private Long executeType; + + /** 多少秒内线程建立完成,默认0 */ + @Excel(name = "多少秒内线程建立完成,默认0") + private Long rampUpSeconds; + + /** 压测时长,时,默认0 */ + @Excel(name = "压测时长,时,默认0") + private Long pressureHour; + + /** 压测时长,分,默认0 */ + @Excel(name = "压测时长,分,默认0") + private Long pressureMinute; + + /** 压测时长,秒,默认0 */ + @Excel(name = "压测时长,秒,默认0") + private Long pressureSecond; + + /** 迭代次数,默认0 */ + @Excel(name = "迭代次数,默认0") + private Long loopCount; + + /** rps状态:0关闭,1开启,默认0 */ + @Excel(name = "rps状态:0关闭,1开启,默认0") + private Long rpsStatus; + + /** 每分钟rps上限数,默认0 */ + @Excel(name = "每分钟rps上限数,默认0") + private Long rpsLimit; + + /** 是否已执行完成状态:0否,1是,默认0 */ + @Excel(name = "是否已执行完成状态:0否,1是,默认0") + private String status; + + /** 0,正常,1,删除 */ + private String delFlag; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPerformanceName(String performanceName) + { + this.performanceName = performanceName; + } + + public String getPerformanceName() + { + return performanceName; + } + public void setCrontab(String crontab) + { + this.crontab = crontab; + } + + public String getCrontab() + { + return crontab; + } + public void setCrontabStatus(Long crontabStatus) + { + this.crontabStatus = crontabStatus; + } + + public Long getCrontabStatus() + { + return crontabStatus; + } + public void setConcurrentThreads(Long concurrentThreads) + { + this.concurrentThreads = concurrentThreads; + } + + public Long getConcurrentThreads() + { + return concurrentThreads; + } + public void setErrorOperType(Long errorOperType) + { + this.errorOperType = errorOperType; + } + + public Long getErrorOperType() + { + return errorOperType; + } + public void setExecuteType(Long executeType) + { + this.executeType = executeType; + } + + public Long getExecuteType() + { + return executeType; + } + public void setRampUpSeconds(Long rampUpSeconds) + { + this.rampUpSeconds = rampUpSeconds; + } + + public Long getRampUpSeconds() + { + return rampUpSeconds; + } + public void setPressureHour(Long pressureHour) + { + this.pressureHour = pressureHour; + } + + public Long getPressureHour() + { + return pressureHour; + } + public void setPressureMinute(Long pressureMinute) + { + this.pressureMinute = pressureMinute; + } + + public Long getPressureMinute() + { + return pressureMinute; + } + public void setPressureSecond(Long pressureSecond) + { + this.pressureSecond = pressureSecond; + } + + public Long getPressureSecond() + { + return pressureSecond; + } + public void setLoopCount(Long loopCount) + { + this.loopCount = loopCount; + } + + public Long getLoopCount() + { + return loopCount; + } + public void setRpsStatus(Long rpsStatus) + { + this.rpsStatus = rpsStatus; + } + + public Long getRpsStatus() + { + return rpsStatus; + } + public void setRpsLimit(Long rpsLimit) + { + this.rpsLimit = rpsLimit; + } + + public Long getRpsLimit() + { + return rpsLimit; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("performanceName", getPerformanceName()) + .append("crontab", getCrontab()) + .append("crontabStatus", getCrontabStatus()) + .append("concurrentThreads", getConcurrentThreads()) + .append("errorOperType", getErrorOperType()) + .append("executeType", getExecuteType()) + .append("rampUpSeconds", getRampUpSeconds()) + .append("pressureHour", getPressureHour()) + .append("pressureMinute", getPressureMinute()) + .append("pressureSecond", getPressureSecond()) + .append("loopCount", getLoopCount()) + .append("rpsStatus", getRpsStatus()) + .append("rpsLimit", getRpsLimit()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/test-test/src/main/java/com/test/test/domain/PerformanceTestCase.java b/test-test/src/main/java/com/test/test/domain/PerformanceTestCase.java new file mode 100644 index 0000000..b1f2018 --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/PerformanceTestCase.java @@ -0,0 +1,79 @@ +package com.test.test.domain; + +import com.test.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.test.common.annotation.Excel; + +/** + * 性能测试与测试用例关联对象 performance_test_case + * + * @author test + * @date 2025-04-14 + */ +public class PerformanceTestCase extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 性能测试id(逻辑外键) */ + @Excel(name = "性能测试id", readConverterExp = "逻辑外键") + private Long performanceId; + + /** 性能测试关联测试用例的id(逻辑外键) */ + @Excel(name = "性能测试关联测试用例的id", readConverterExp = "逻辑外键") + private Long testCaseId; + + /** 状态:0关闭,1开启,默认1 */ + @Excel(name = "状态:0关闭,1开启,默认1") + private Long status; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPerformanceId(Long performanceId) + { + this.performanceId = performanceId; + } + + public Long getPerformanceId() + { + return performanceId; + } + public void setTestCaseId(Long testCaseId) + { + this.testCaseId = testCaseId; + } + + public Long getTestCaseId() + { + return testCaseId; + } + public void setStatus(Long status) + { + this.status = status; + } + + public Long getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("performanceId", getPerformanceId()) + .append("testCaseId", getTestCaseId()) + .append("status", getStatus()) + .toString(); + } +} diff --git a/test-test/src/main/java/com/test/test/mapper/PerformanceTestCaseMapper.java b/test-test/src/main/java/com/test/test/mapper/PerformanceTestCaseMapper.java new file mode 100644 index 0000000..a2b8068 --- /dev/null +++ b/test-test/src/main/java/com/test/test/mapper/PerformanceTestCaseMapper.java @@ -0,0 +1,62 @@ +package com.test.test.mapper; + +import com.test.test.domain.PerformanceTestCase; + +import java.util.List; + +/** + * 性能测试与测试用例关联Mapper接口 + * + * @author test + * @date 2025-04-14 + */ +public interface PerformanceTestCaseMapper +{ + /** + * 查询性能测试与测试用例关联 + * + * @param id 性能测试与测试用例关联主键 + * @return 性能测试与测试用例关联 + */ + public PerformanceTestCase selectPerformanceTestCaseById(Long id); + + /** + * 查询性能测试与测试用例关联列表 + * + * @param performanceTestCase 性能测试与测试用例关联 + * @return 性能测试与测试用例关联集合 + */ + public List selectPerformanceTestCaseList(PerformanceTestCase performanceTestCase); + + /** + * 新增性能测试与测试用例关联 + * + * @param performanceTestCase 性能测试与测试用例关联 + * @return 结果 + */ + public int insertPerformanceTestCase(PerformanceTestCase performanceTestCase); + + /** + * 修改性能测试与测试用例关联 + * + * @param performanceTestCase 性能测试与测试用例关联 + * @return 结果 + */ + public int updatePerformanceTestCase(PerformanceTestCase performanceTestCase); + + /** + * 删除性能测试与测试用例关联 + * + * @param id 性能测试与测试用例关联主键 + * @return 结果 + */ + public int deletePerformanceTestCaseById(Long id); + + /** + * 批量删除性能测试与测试用例关联 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePerformanceTestCaseByIds(Long[] ids); +} diff --git a/test-test/src/main/java/com/test/test/mapper/PerformanceTestMapper.java b/test-test/src/main/java/com/test/test/mapper/PerformanceTestMapper.java new file mode 100644 index 0000000..42aea90 --- /dev/null +++ b/test-test/src/main/java/com/test/test/mapper/PerformanceTestMapper.java @@ -0,0 +1,62 @@ +package com.test.test.mapper; + +import com.test.test.domain.PerformanceTest; + +import java.util.List; + +/** + * 性能测试Mapper接口 + * + * @author test + * @date 2025-04-14 + */ +public interface PerformanceTestMapper +{ + /** + * 查询性能测试 + * + * @param id 性能测试主键 + * @return 性能测试 + */ + public PerformanceTest selectPerformanceTestById(Long id); + + /** + * 查询性能测试列表 + * + * @param performanceTest 性能测试 + * @return 性能测试集合 + */ + public List selectPerformanceTestList(PerformanceTest performanceTest); + + /** + * 新增性能测试 + * + * @param performanceTest 性能测试 + * @return 结果 + */ + public int insertPerformanceTest(PerformanceTest performanceTest); + + /** + * 修改性能测试 + * + * @param performanceTest 性能测试 + * @return 结果 + */ + public int updatePerformanceTest(PerformanceTest performanceTest); + + /** + * 删除性能测试 + * + * @param id 性能测试主键 + * @return 结果 + */ + public int deletePerformanceTestById(Long id); + + /** + * 批量删除性能测试 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePerformanceTestByIds(Long[] ids); +} diff --git a/test-test/src/main/java/com/test/test/service/IPerformanceTestService.java b/test-test/src/main/java/com/test/test/service/IPerformanceTestService.java new file mode 100644 index 0000000..37d5ab4 --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/IPerformanceTestService.java @@ -0,0 +1,62 @@ +package com.test.test.service; + +import com.test.test.domain.PerformanceTest; + +import java.util.List; + +/** + * 性能测试Service接口 + * + * @author test + * @date 2025-04-14 + */ +public interface IPerformanceTestService +{ + /** + * 查询性能测试 + * + * @param id 性能测试主键 + * @return 性能测试 + */ + public PerformanceTest selectPerformanceTestById(Long id); + + /** + * 查询性能测试列表 + * + * @param performanceTest 性能测试 + * @return 性能测试集合 + */ + public List selectPerformanceTestList(PerformanceTest performanceTest); + + /** + * 新增性能测试 + * + * @param performanceTest 性能测试 + * @return 结果 + */ + public int insertPerformanceTest(PerformanceTest performanceTest); + + /** + * 修改性能测试 + * + * @param performanceTest 性能测试 + * @return 结果 + */ + public int updatePerformanceTest(PerformanceTest performanceTest); + + /** + * 批量删除性能测试 + * + * @param ids 需要删除的性能测试主键集合 + * @return 结果 + */ + public int deletePerformanceTestByIds(Long[] ids); + + /** + * 删除性能测试信息 + * + * @param id 性能测试主键 + * @return 结果 + */ + public int deletePerformanceTestById(Long id); +} diff --git a/test-test/src/main/java/com/test/test/service/impl/PerformanceTestServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/PerformanceTestServiceImpl.java new file mode 100644 index 0000000..1f16d9c --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/impl/PerformanceTestServiceImpl.java @@ -0,0 +1,97 @@ +package com.test.test.service.impl; + +import java.util.List; +import com.test.common.utils.DateUtils; +import com.test.test.domain.PerformanceTest; +import com.test.test.mapper.PerformanceTestMapper; +import com.test.test.service.IPerformanceTestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * 性能测试Service业务层处理 + * + * @author test + * @date 2025-04-14 + */ +@Service +public class PerformanceTestServiceImpl implements IPerformanceTestService +{ + @Autowired + private PerformanceTestMapper performanceTestMapper; + + /** + * 查询性能测试 + * + * @param id 性能测试主键 + * @return 性能测试 + */ + @Override + public PerformanceTest selectPerformanceTestById(Long id) + { + return performanceTestMapper.selectPerformanceTestById(id); + } + + /** + * 查询性能测试列表 + * + * @param performanceTest 性能测试 + * @return 性能测试 + */ + @Override + public List selectPerformanceTestList(PerformanceTest performanceTest) + { + return performanceTestMapper.selectPerformanceTestList(performanceTest); + } + + /** + * 新增性能测试 + * + * @param performanceTest 性能测试 + * @return 结果 + */ + @Override + public int insertPerformanceTest(PerformanceTest performanceTest) + { + performanceTest.setCreateTime(DateUtils.getNowDate()); + return performanceTestMapper.insertPerformanceTest(performanceTest); + } + + /** + * 修改性能测试 + * + * @param performanceTest 性能测试 + * @return 结果 + */ + @Override + public int updatePerformanceTest(PerformanceTest performanceTest) + { + performanceTest.setUpdateTime(DateUtils.getNowDate()); + return performanceTestMapper.updatePerformanceTest(performanceTest); + } + + /** + * 批量删除性能测试 + * + * @param ids 需要删除的性能测试主键 + * @return 结果 + */ + @Override + public int deletePerformanceTestByIds(Long[] ids) + { + return performanceTestMapper.deletePerformanceTestByIds(ids); + } + + /** + * 删除性能测试信息 + * + * @param id 性能测试主键 + * @return 结果 + */ + @Override + public int deletePerformanceTestById(Long id) + { + return performanceTestMapper.deletePerformanceTestById(id); + } +} diff --git a/test-test/src/main/resources/mapper/test/PerformanceTestCaseMapper.xml b/test-test/src/main/resources/mapper/test/PerformanceTestCaseMapper.xml new file mode 100644 index 0000000..e900734 --- /dev/null +++ b/test-test/src/main/resources/mapper/test/PerformanceTestCaseMapper.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + select id, performance_id, test_case_id, status from performance_test_case + + + + + + + + insert into performance_test_case + + id, + performance_id, + test_case_id, + status, + + + #{id}, + #{performanceId}, + #{testCaseId}, + #{status}, + + + + + update performance_test_case + + performance_id = #{performanceId}, + test_case_id = #{testCaseId}, + status = #{status}, + + where id = #{id} + + + + delete from performance_test_case where id = #{id} + + + + delete from performance_test_case where id in + + #{id} + + + \ No newline at end of file diff --git a/test-test/src/main/resources/mapper/test/PerformanceTestMapper.xml b/test-test/src/main/resources/mapper/test/PerformanceTestMapper.xml new file mode 100644 index 0000000..8aa8511 --- /dev/null +++ b/test-test/src/main/resources/mapper/test/PerformanceTestMapper.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, performance_name, crontab, crontab_status, concurrent_threads, error_oper_type, execute_type, ramp_up_seconds, pressure_hour, pressure_minute, pressure_second, loop_count, rps_status, rps_limit, status, create_by, create_time, update_by, update_time, del_flag from performance_test + + + + + + + + insert into performance_test + + id, + performance_name, + crontab, + crontab_status, + concurrent_threads, + error_oper_type, + execute_type, + ramp_up_seconds, + pressure_hour, + pressure_minute, + pressure_second, + loop_count, + rps_status, + rps_limit, + status, + create_by, + create_time, + update_by, + update_time, + del_flag, + + + #{id}, + #{performanceName}, + #{crontab}, + #{crontabStatus}, + #{concurrentThreads}, + #{errorOperType}, + #{executeType}, + #{rampUpSeconds}, + #{pressureHour}, + #{pressureMinute}, + #{pressureSecond}, + #{loopCount}, + #{rpsStatus}, + #{rpsLimit}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{delFlag}, + + + + + update performance_test + + performance_name = #{performanceName}, + crontab = #{crontab}, + crontab_status = #{crontabStatus}, + concurrent_threads = #{concurrentThreads}, + error_oper_type = #{errorOperType}, + execute_type = #{executeType}, + ramp_up_seconds = #{rampUpSeconds}, + pressure_hour = #{pressureHour}, + pressure_minute = #{pressureMinute}, + pressure_second = #{pressureSecond}, + loop_count = #{loopCount}, + rps_status = #{rpsStatus}, + rps_limit = #{rpsLimit}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + del_flag = #{delFlag}, + + where id = #{id} + + + + delete from performance_test where id = #{id} + + + + delete from performance_test where id in + + #{id} + + + \ No newline at end of file diff --git a/test-ui/src/views/test/performance/performance.vue b/test-ui/src/views/test/performance/performance.vue new file mode 100644 index 0000000..b9fb326 --- /dev/null +++ b/test-ui/src/views/test/performance/performance.vue @@ -0,0 +1,11 @@ + + + + +