refactor(数据库字段命名优化): 数据库字段命名优化

数据库字段命名优化
This commit is contained in:
song-tianyang 2022-01-11 15:11:48 +08:00 committed by song-tianyang
parent e15672af3d
commit aeb9c52661
4 changed files with 56 additions and 58 deletions

View File

@ -37,11 +37,11 @@ public class TestPlanReportContentWithBLOBs extends TestPlanReportContent implem
private String loadFailureCases;
private String scenarioReportId;
private String planScenarioReportStruct;
private String apiCaseReportId;
private String planApiCaseReportStruct;
private String loadCaseReportId;
private String planLoadCaseReportStruct;
private static final long serialVersionUID = 1L;
}

View File

@ -26,9 +26,9 @@
<result column="scenario_failure_cases" jdbcType="LONGVARCHAR" property="scenarioFailureCases" />
<result column="load_all_Cases" jdbcType="LONGVARCHAR" property="loadAllCases" />
<result column="load_failure_cases" jdbcType="LONGVARCHAR" property="loadFailureCases" />
<result column="scenario_report_id" jdbcType="LONGVARCHAR" property="scenarioReportId" />
<result column="api_case_report_id" jdbcType="LONGVARCHAR" property="apiCaseReportId" />
<result column="load_case_report_id" jdbcType="LONGVARCHAR" property="loadCaseReportId" />
<result column="plan_scenario_report_struct" jdbcType="LONGVARCHAR" property="planScenarioReportStruct" />
<result column="plan_api_case_report_struct" jdbcType="LONGVARCHAR" property="planApiCaseReportStruct" />
<result column="plan_load_case_report_struct" jdbcType="LONGVARCHAR" property="planLoadCaseReportStruct" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -95,7 +95,8 @@
<sql id="Blob_Column_List">
config, summary, function_result, api_result, load_result, function_all_cases, function_failure_cases,
issue_list, api_all_cases, api_failure_cases, scenario_all_cases, scenario_failure_cases,
load_all_Cases, load_failure_cases, scenario_report_id, api_case_report_id, load_case_report_id
load_all_Cases, load_failure_cases, plan_scenario_report_struct, plan_api_case_report_struct,
plan_load_case_report_struct
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultMap="ResultMapWithBLOBs">
select
@ -154,8 +155,8 @@
issue_list, api_all_cases, api_failure_cases,
scenario_all_cases, scenario_failure_cases,
load_all_Cases, load_failure_cases,
scenario_report_id, api_case_report_id,
load_case_report_id)
plan_scenario_report_struct, plan_api_case_report_struct,
plan_load_case_report_struct)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
#{caseCount,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{executeRate,jdbcType=DOUBLE},
#{passRate,jdbcType=DOUBLE}, #{isThirdPartIssue,jdbcType=BIT}, #{config,jdbcType=LONGVARCHAR},
@ -164,8 +165,8 @@
#{issueList,jdbcType=LONGVARCHAR}, #{apiAllCases,jdbcType=LONGVARCHAR}, #{apiFailureCases,jdbcType=LONGVARCHAR},
#{scenarioAllCases,jdbcType=LONGVARCHAR}, #{scenarioFailureCases,jdbcType=LONGVARCHAR},
#{loadAllCases,jdbcType=LONGVARCHAR}, #{loadFailureCases,jdbcType=LONGVARCHAR},
#{scenarioReportId,jdbcType=LONGVARCHAR}, #{apiCaseReportId,jdbcType=LONGVARCHAR},
#{loadCaseReportId,jdbcType=LONGVARCHAR})
#{planScenarioReportStruct,jdbcType=LONGVARCHAR}, #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReportContentWithBLOBs">
insert into test_plan_report_content
@ -236,14 +237,14 @@
<if test="loadFailureCases != null">
load_failure_cases,
</if>
<if test="scenarioReportId != null">
scenario_report_id,
<if test="planScenarioReportStruct != null">
plan_scenario_report_struct,
</if>
<if test="apiCaseReportId != null">
api_case_report_id,
<if test="planApiCaseReportStruct != null">
plan_api_case_report_struct,
</if>
<if test="loadCaseReportId != null">
load_case_report_id,
<if test="planLoadCaseReportStruct != null">
plan_load_case_report_struct,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -313,14 +314,14 @@
<if test="loadFailureCases != null">
#{loadFailureCases,jdbcType=LONGVARCHAR},
</if>
<if test="scenarioReportId != null">
#{scenarioReportId,jdbcType=LONGVARCHAR},
<if test="planScenarioReportStruct != null">
#{planScenarioReportStruct,jdbcType=LONGVARCHAR},
</if>
<if test="apiCaseReportId != null">
#{apiCaseReportId,jdbcType=LONGVARCHAR},
<if test="planApiCaseReportStruct != null">
#{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
</if>
<if test="loadCaseReportId != null">
#{loadCaseReportId,jdbcType=LONGVARCHAR},
<if test="planLoadCaseReportStruct != null">
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
@ -399,14 +400,14 @@
<if test="record.loadFailureCases != null">
load_failure_cases = #{record.loadFailureCases,jdbcType=LONGVARCHAR},
</if>
<if test="record.scenarioReportId != null">
scenario_report_id = #{record.scenarioReportId,jdbcType=LONGVARCHAR},
<if test="record.planScenarioReportStruct != null">
plan_scenario_report_struct = #{record.planScenarioReportStruct,jdbcType=LONGVARCHAR},
</if>
<if test="record.apiCaseReportId != null">
api_case_report_id = #{record.apiCaseReportId,jdbcType=LONGVARCHAR},
<if test="record.planApiCaseReportStruct != null">
plan_api_case_report_struct = #{record.planApiCaseReportStruct,jdbcType=LONGVARCHAR},
</if>
<if test="record.loadCaseReportId != null">
load_case_report_id = #{record.loadCaseReportId,jdbcType=LONGVARCHAR},
<if test="record.planLoadCaseReportStruct != null">
plan_load_case_report_struct = #{record.planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
@ -437,9 +438,9 @@
scenario_failure_cases = #{record.scenarioFailureCases,jdbcType=LONGVARCHAR},
load_all_Cases = #{record.loadAllCases,jdbcType=LONGVARCHAR},
load_failure_cases = #{record.loadFailureCases,jdbcType=LONGVARCHAR},
scenario_report_id = #{record.scenarioReportId,jdbcType=LONGVARCHAR},
api_case_report_id = #{record.apiCaseReportId,jdbcType=LONGVARCHAR},
load_case_report_id = #{record.loadCaseReportId,jdbcType=LONGVARCHAR}
plan_scenario_report_struct = #{record.planScenarioReportStruct,jdbcType=LONGVARCHAR},
plan_api_case_report_struct = #{record.planApiCaseReportStruct,jdbcType=LONGVARCHAR},
plan_load_case_report_struct = #{record.planLoadCaseReportStruct,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -524,14 +525,14 @@
<if test="loadFailureCases != null">
load_failure_cases = #{loadFailureCases,jdbcType=LONGVARCHAR},
</if>
<if test="scenarioReportId != null">
scenario_report_id = #{scenarioReportId,jdbcType=LONGVARCHAR},
<if test="planScenarioReportStruct != null">
plan_scenario_report_struct = #{planScenarioReportStruct,jdbcType=LONGVARCHAR},
</if>
<if test="apiCaseReportId != null">
api_case_report_id = #{apiCaseReportId,jdbcType=LONGVARCHAR},
<if test="planApiCaseReportStruct != null">
plan_api_case_report_struct = #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
</if>
<if test="loadCaseReportId != null">
load_case_report_id = #{loadCaseReportId,jdbcType=LONGVARCHAR},
<if test="planLoadCaseReportStruct != null">
plan_load_case_report_struct = #{planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
@ -559,9 +560,9 @@
scenario_failure_cases = #{scenarioFailureCases,jdbcType=LONGVARCHAR},
load_all_Cases = #{loadAllCases,jdbcType=LONGVARCHAR},
load_failure_cases = #{loadFailureCases,jdbcType=LONGVARCHAR},
scenario_report_id = #{scenarioReportId,jdbcType=LONGVARCHAR},
api_case_report_id = #{apiCaseReportId,jdbcType=LONGVARCHAR},
load_case_report_id = #{loadCaseReportId,jdbcType=LONGVARCHAR}
plan_scenario_report_struct = #{planScenarioReportStruct,jdbcType=LONGVARCHAR},
plan_api_case_report_struct = #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
plan_load_case_report_struct = #{planLoadCaseReportStruct,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanReportContent">

View File

@ -314,9 +314,6 @@ public class TestPlanReportService {
TestPlanSimpleReportDTO reportDTO = testPlanService.buildPlanReport(testPlanReport, reportContent);
reportDTO.setStartTime(testPlanReport.getStartTime());
reportContent = parseReportDaoToReportContent(reportDTO, reportContent);
testPlanReportContentMapper.updateByPrimaryKeySelective(reportContent);
testPlanReportMapper.updateByPrimaryKey(testPlanReport);
return reportContent;
}
@ -725,7 +722,7 @@ public class TestPlanReportService {
private boolean isDynamicallyGenerateReports(TestPlanReportContentWithBLOBs testPlanReportContent) {
return testPlanReportContent != null &&
(StringUtils.isNotEmpty(testPlanReportContent.getApiCaseReportId()) || StringUtils.isNotEmpty(testPlanReportContent.getApiCaseReportId()) || StringUtils.isNotEmpty(testPlanReportContent.getApiCaseReportId()));
(StringUtils.isNotEmpty(testPlanReportContent.getPlanApiCaseReportStruct()) || StringUtils.isNotEmpty(testPlanReportContent.getPlanScenarioReportStruct()) || StringUtils.isNotEmpty(testPlanReportContent.getPlanLoadCaseReportStruct()));
}
private TestPlanReportContentWithBLOBs dynamicallyGenerateReports(TestPlanReportContentWithBLOBs testPlanReportContent) {
@ -740,16 +737,16 @@ public class TestPlanReportService {
content.setId(testPlanReportContentId);
if (MapUtils.isNotEmpty(apiCaseReportMap)) {
content.setApiCaseReportId(JSONObject.toJSONString(apiCaseReportMap));
content.setPlanApiCaseReportStruct(JSONObject.toJSONString(apiCaseReportMap));
}
if (MapUtils.isNotEmpty(scenarioReportIdMap)) {
content.setScenarioReportId(JSONObject.toJSONString(scenarioReportIdMap));
content.setPlanScenarioReportStruct(JSONObject.toJSONString(scenarioReportIdMap));
}
if (MapUtils.isNotEmpty(loadCaseReportIdMap)) {
content.setLoadCaseReportId(JSONObject.toJSONString(loadCaseReportIdMap));
content.setPlanLoadCaseReportStruct(JSONObject.toJSONString(loadCaseReportIdMap));
}
if (StringUtils.isNotEmpty(content.getApiCaseReportId()) || StringUtils.isNotEmpty(content.getScenarioReportId()) || StringUtils.isNotEmpty(content.getLoadCaseReportId())) {
if (StringUtils.isNotEmpty(content.getPlanApiCaseReportStruct()) || StringUtils.isNotEmpty(content.getPlanScenarioReportStruct()) || StringUtils.isNotEmpty(content.getPlanLoadCaseReportStruct())) {
testPlanReportContentMapper.updateByPrimaryKeySelective(content);
}
}
@ -761,21 +758,21 @@ public class TestPlanReportService {
Map<String, String> testPlanLoadCaseIdAndReportIdMap = new HashMap<>();
if (testPlanReportContentWithBLOBs != null) {
if (StringUtils.isNotEmpty(testPlanReportContentWithBLOBs.getApiCaseReportId())) {
if (StringUtils.isNotEmpty(testPlanReportContentWithBLOBs.getPlanApiCaseReportStruct())) {
try {
testPlanApiCaseIdAndReportIdMap = JSONObject.parseObject(testPlanReportContentWithBLOBs.getApiCaseReportId(), Map.class);
testPlanApiCaseIdAndReportIdMap = JSONObject.parseObject(testPlanReportContentWithBLOBs.getPlanApiCaseReportStruct(), Map.class);
} catch (Exception ignore) {
}
}
if (StringUtils.isNotEmpty(testPlanReportContentWithBLOBs.getScenarioReportId())) {
if (StringUtils.isNotEmpty(testPlanReportContentWithBLOBs.getPlanScenarioReportStruct())) {
try {
testPlanScenarioIdAndReportIdMap = JSONObject.parseObject(testPlanReportContentWithBLOBs.getScenarioReportId(), Map.class);
testPlanScenarioIdAndReportIdMap = JSONObject.parseObject(testPlanReportContentWithBLOBs.getPlanScenarioReportStruct(), Map.class);
} catch (Exception ignore) {
}
}
if (StringUtils.isNotEmpty(testPlanReportContentWithBLOBs.getLoadCaseReportId())) {
if (StringUtils.isNotEmpty(testPlanReportContentWithBLOBs.getPlanLoadCaseReportStruct())) {
try {
testPlanLoadCaseIdAndReportIdMap = JSONObject.parseObject(testPlanReportContentWithBLOBs.getLoadCaseReportId(), Map.class);
testPlanLoadCaseIdAndReportIdMap = JSONObject.parseObject(testPlanReportContentWithBLOBs.getPlanLoadCaseReportStruct(), Map.class);
} catch (Exception ignore) {
}
}

View File

@ -1,3 +1,3 @@
ALTER TABLE test_plan_report_content ADD scenario_report_id longtext NULL;
ALTER TABLE test_plan_report_content ADD api_case_report_id longtext NULL;
ALTER TABLE test_plan_report_content ADD load_case_report_id longtext NULL;
ALTER TABLE test_plan_report_content ADD plan_scenario_report_struct longtext NULL;
ALTER TABLE test_plan_report_content ADD plan_api_case_report_struct longtext NULL;
ALTER TABLE test_plan_report_content ADD plan_load_case_report_struct longtext NULL;