fix(项目设置): 更改项目应用表字段值

--user=郭雨琦 更改项目应用表字段值
This commit is contained in:
guoyuqi 2022-02-16 18:43:33 +08:00 committed by jianxing
parent 91a9901533
commit 45b89410c1
16 changed files with 89 additions and 72 deletions

View File

@ -8,6 +8,7 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ShareInfoMapper; import io.metersphere.base.mapper.ShareInfoMapper;
import io.metersphere.base.mapper.TestPlanReportMapper; import io.metersphere.base.mapper.TestPlanReportMapper;
import io.metersphere.base.mapper.ext.ExtShareInfoMapper; import io.metersphere.base.mapper.ext.ExtShareInfoMapper;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.constants.ShareType; import io.metersphere.commons.constants.ShareType;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.json.JSONSchemaGenerator; import io.metersphere.commons.json.JSONSchemaGenerator;
@ -521,10 +522,10 @@ public class ShareInfoService {
} }
String type = ""; String type = "";
if(shareInfo.getShareType().equals("PERFORMANCE_REPORT")){ if(shareInfo.getShareType().equals("PERFORMANCE_REPORT")){
type = "PERFORMANCE"; type = ProjectApplicationType.TRACK_SHARE_REPORT_TIME.toString();
} }
if(shareInfo.getShareType().equals("PLAN_DB_REPORT")){ if(shareInfo.getShareType().equals("PLAN_DB_REPORT")){
type = "TRACK"; type = ProjectApplicationType.PERFORMANCE_SHARE_REPORT_TIME.toString();
} }
if(StringUtils.isBlank(type)){ if(StringUtils.isBlank(type)){
millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId()); millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId());
@ -533,7 +534,7 @@ public class ShareInfoService {
if(projectApplication.getProjectId()==null){ if(projectApplication.getProjectId()==null){
millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId()); millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId());
}else { }else {
String expr= projectApplication.getShareReportExpr(); String expr= projectApplication.getTypeValue();
long timeMills = getTimeMills(shareInfo.getUpdateTime(),expr); long timeMills = getTimeMills(shareInfo.getUpdateTime(),expr);
millisCheck(System.currentTimeMillis(),timeMills,shareInfo.getId()); millisCheck(System.currentTimeMillis(),timeMills,shareInfo.getId());
} }

View File

@ -9,7 +9,7 @@ public class ProjectApplication implements Serializable {
private String type; private String type;
private String shareReportExpr; private String typeValue;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -244,73 +244,73 @@ public class ProjectApplicationExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprIsNull() { public Criteria andTypeValueIsNull() {
addCriterion("share_report_expr is null"); addCriterion("type_value is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprIsNotNull() { public Criteria andTypeValueIsNotNull() {
addCriterion("share_report_expr is not null"); addCriterion("type_value is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprEqualTo(String value) { public Criteria andTypeValueEqualTo(String value) {
addCriterion("share_report_expr =", value, "shareReportExpr"); addCriterion("type_value =", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprNotEqualTo(String value) { public Criteria andTypeValueNotEqualTo(String value) {
addCriterion("share_report_expr <>", value, "shareReportExpr"); addCriterion("type_value <>", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprGreaterThan(String value) { public Criteria andTypeValueGreaterThan(String value) {
addCriterion("share_report_expr >", value, "shareReportExpr"); addCriterion("type_value >", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprGreaterThanOrEqualTo(String value) { public Criteria andTypeValueGreaterThanOrEqualTo(String value) {
addCriterion("share_report_expr >=", value, "shareReportExpr"); addCriterion("type_value >=", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprLessThan(String value) { public Criteria andTypeValueLessThan(String value) {
addCriterion("share_report_expr <", value, "shareReportExpr"); addCriterion("type_value <", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprLessThanOrEqualTo(String value) { public Criteria andTypeValueLessThanOrEqualTo(String value) {
addCriterion("share_report_expr <=", value, "shareReportExpr"); addCriterion("type_value <=", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprLike(String value) { public Criteria andTypeValueLike(String value) {
addCriterion("share_report_expr like", value, "shareReportExpr"); addCriterion("type_value like", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprNotLike(String value) { public Criteria andTypeValueNotLike(String value) {
addCriterion("share_report_expr not like", value, "shareReportExpr"); addCriterion("type_value not like", value, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprIn(List<String> values) { public Criteria andTypeValueIn(List<String> values) {
addCriterion("share_report_expr in", values, "shareReportExpr"); addCriterion("type_value in", values, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprNotIn(List<String> values) { public Criteria andTypeValueNotIn(List<String> values) {
addCriterion("share_report_expr not in", values, "shareReportExpr"); addCriterion("type_value not in", values, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprBetween(String value1, String value2) { public Criteria andTypeValueBetween(String value1, String value2) {
addCriterion("share_report_expr between", value1, value2, "shareReportExpr"); addCriterion("type_value between", value1, value2, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andShareReportExprNotBetween(String value1, String value2) { public Criteria andTypeValueNotBetween(String value1, String value2) {
addCriterion("share_report_expr not between", value1, value2, "shareReportExpr"); addCriterion("type_value not between", value1, value2, "typeValue");
return (Criteria) this; return (Criteria) this;
} }
} }

View File

@ -1,6 +1,5 @@
package io.metersphere.base.mapper; package io.metersphere.base.mapper;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.ProjectApplication; import io.metersphere.base.domain.ProjectApplication;
import io.metersphere.base.domain.ProjectApplicationExample; import io.metersphere.base.domain.ProjectApplicationExample;
import java.util.List; import java.util.List;
@ -20,5 +19,4 @@ public interface ProjectApplicationMapper {
int updateByExampleSelective(@Param("record") ProjectApplication record, @Param("example") ProjectApplicationExample example); int updateByExampleSelective(@Param("record") ProjectApplication record, @Param("example") ProjectApplicationExample example);
int updateByExample(@Param("record") ProjectApplication record, @Param("example") ProjectApplicationExample example); int updateByExample(@Param("record") ProjectApplication record, @Param("example") ProjectApplicationExample example);
} }

View File

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ProjectApplication"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.ProjectApplication">
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="type" jdbcType="VARCHAR" property="type" /> <result column="type" jdbcType="VARCHAR" property="type" />
<result column="share_report_expr" jdbcType="VARCHAR" property="shareReportExpr" /> <result column="type_value" jdbcType="VARCHAR" property="typeValue" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -65,7 +65,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
project_id, `type`, share_report_expr project_id, `type`, type_value
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectApplicationExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectApplicationExample" resultMap="BaseResultMap">
select select
@ -88,9 +88,9 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ProjectApplication"> <insert id="insert" parameterType="io.metersphere.base.domain.ProjectApplication">
insert into project_application (project_id, `type`, share_report_expr insert into project_application (project_id, `type`, type_value
) )
values (#{projectId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{shareReportExpr,jdbcType=VARCHAR} values (#{projectId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{typeValue,jdbcType=VARCHAR}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ProjectApplication"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.ProjectApplication">
@ -102,8 +102,8 @@
<if test="type != null"> <if test="type != null">
`type`, `type`,
</if> </if>
<if test="shareReportExpr != null"> <if test="typeValue != null">
share_report_expr, type_value,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -113,8 +113,8 @@
<if test="type != null"> <if test="type != null">
#{type,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
</if> </if>
<if test="shareReportExpr != null"> <if test="typeValue != null">
#{shareReportExpr,jdbcType=VARCHAR}, #{typeValue,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
</insert> </insert>
@ -133,8 +133,8 @@
<if test="record.type != null"> <if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
</if> </if>
<if test="record.shareReportExpr != null"> <if test="record.typeValue != null">
share_report_expr = #{record.shareReportExpr,jdbcType=VARCHAR}, type_value = #{record.typeValue,jdbcType=VARCHAR},
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
@ -145,7 +145,7 @@
update project_application update project_application
set project_id = #{record.projectId,jdbcType=VARCHAR}, set project_id = #{record.projectId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
share_report_expr = #{record.shareReportExpr,jdbcType=VARCHAR} type_value = #{record.typeValue,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>

View File

@ -0,0 +1,6 @@
package io.metersphere.commons.constants;
public enum ProjectApplicationType {
TRACK_SHARE_REPORT_TIME,
PERFORMANCE_SHARE_REPORT_TIME
}

View File

@ -114,7 +114,7 @@ public class SystemReference {
projectApplicationColumns.put("projectId", "项目ID"); projectApplicationColumns.put("projectId", "项目ID");
projectApplicationColumns.put("type", "类型"); projectApplicationColumns.put("type", "类型");
projectApplicationColumns.put("shareReportExpr", "报告分享链接时间"); projectApplicationColumns.put("typeValue", "");
jarColumns.put("name", "名称"); jarColumns.put("name", "名称");
jarColumns.put("fileName", "文件名称"); jarColumns.put("fileName", "文件名称");

View File

@ -14,10 +14,7 @@ import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtProjectVersionMapper; import io.metersphere.base.mapper.ext.ExtProjectVersionMapper;
import io.metersphere.base.mapper.ext.ExtUserGroupMapper; import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
import io.metersphere.base.mapper.ext.ExtUserMapper; import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.constants.*;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.constants.ScheduleType;
import io.metersphere.commons.constants.UserGroupConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
@ -172,9 +169,10 @@ public class ProjectService {
ProjectApplication projectApplication = new ProjectApplication(); ProjectApplication projectApplication = new ProjectApplication();
projectApplication.setProjectId(project.getId()); projectApplication.setProjectId(project.getId());
//每个新项目都会有测试跟踪/性能报告分享链接的有效时间,默认时间24H //每个新项目都会有测试跟踪/性能报告分享链接的有效时间,默认时间24H
projectApplication.setType("TRACK"); projectApplication.setType(ProjectApplicationType.TRACK_SHARE_REPORT_TIME.toString());
projectApplication.setTypeValue("24H");
projectApplicationMapper.insert(projectApplication); projectApplicationMapper.insert(projectApplication);
projectApplication.setType("PERFORMANCE"); projectApplication.setType(ProjectApplicationType.PERFORMANCE_SHARE_REPORT_TIME.toString());
projectApplicationMapper.insert(projectApplication); projectApplicationMapper.insert(projectApplication);
return project; return project;
} }

View File

@ -45,7 +45,7 @@ CREATE TABLE IF NOT EXISTS `project_application`
( (
`project_id` varchar(50) DEFAULT NULL, `project_id` varchar(50) DEFAULT NULL,
`type` varchar(50) DEFAULT NULL, `type` varchar(50) DEFAULT NULL,
`share_report_expr`varchar(50) NOT NULL DEFAULT '24H', `type_value` varchar(255) DEFAULT NULL,
UNIQUE KEY `project_application_pk` (`project_id`, `type`), UNIQUE KEY `project_application_pk` (`project_id`, `type`),
KEY `project_application_project_id_index` (`project_id`), KEY `project_application_project_id_index` (`project_id`),
KEY `project_application_type` (`type`) KEY `project_application_type` (`type`)
@ -143,9 +143,9 @@ BEGIN
#遍历游标 #遍历游标
REPEAT REPEAT
#利用取到的值进行数据库的操作 #利用取到的值进行数据库的操作
INSERT INTO project_application (project_id, type, share_report_expr) INSERT INTO project_application (project_id, type, type_value)
VALUES (projectId, 'TRACK', '24H'), VALUES (projectId, 'TRACK_SHARE_REPORT_TIME', '24H'),
(projectId, 'PERFORMANCE', '24H'); (projectId, 'PERFORMANCE_SHARE_REPORT_TIME', '24H');
# 将游标中的值再赋值给变量,供下次循环使用 # 将游标中的值再赋值给变量,供下次循环使用
FETCH project_curosr INTO projectId; FETCH project_curosr INTO projectId;
UNTIL end_flag END REPEAT; UNTIL end_flag END REPEAT;

View File

@ -37,7 +37,7 @@
width="300"> width="300">
<p>{{ shareUrl }}</p> <p>{{ shareUrl }}</p>
<span style="color: red;float: left;margin-left: 10px;">{{ <span style="color: red;float: left;margin-left: 10px;">{{
$t('commons.validity_period')+application.shareReportExpr $t('commons.validity_period')+application.typeValue
}}</span> }}</span>
<div style="text-align: right; margin: 0"> <div style="text-align: right; margin: 0">
<el-button type="primary" size="mini" :disabled="!shareUrl" <el-button type="primary" size="mini" :disabled="!shareUrl"
@ -379,7 +379,7 @@ export default {
this.getProjectApplication(); this.getProjectApplication();
}, },
getProjectApplication(){ getProjectApplication(){
this.$get('/project_application/get/' + getCurrentProjectID()+"/PERFORMANCE", res => { this.$get('/project_application/get/' + getCurrentProjectID()+"/PERFORMANCE_SHARE_REPORT_TIME", res => {
if(res.data){ if(res.data){
this.application = res.data; this.application = res.data;
} }

View File

@ -28,7 +28,7 @@
</app-manage-item> </app-manage-item>
<timing-item ref="trackTimingItem" :choose.sync="form.cleanTrackReport" :expr.sync="form.cleanTrackReportExpr" <timing-item ref="trackTimingItem" :choose.sync="form.cleanTrackReport" :expr.sync="form.cleanTrackReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_plan_report')"/> @chooseChange="chooseChange" :title="$t('project.timing_clean_plan_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="application.shareReport" :expr.sync="application.shareReportExpr" :share-link="true" <timing-item ref="trackTimingItem" :choose.sync="application.shareReport" :expr.sync="application.typeValue" :share-link="true" :unit-options="applyUnitOptions"
@chooseChange="chooseChangeApply" :title="$t('report.report_sharing_link')"/> @chooseChange="chooseChangeApply" :title="$t('report.report_sharing_link')"/>
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
@ -94,7 +94,7 @@
<el-row style="margin-top: 15px"> <el-row style="margin-top: 15px">
<timing-item ref="loadTimingItem" :choose.sync="form.cleanLoadReport" :expr.sync="form.cleanLoadReportExpr" <timing-item ref="loadTimingItem" :choose.sync="form.cleanLoadReport" :expr.sync="form.cleanLoadReportExpr"
@chooseChange="chooseChange" :title="$t('project.timing_clean_load_report')"/> @chooseChange="chooseChange" :title="$t('project.timing_clean_load_report')"/>
<timing-item ref="trackTimingItem" :choose.sync="application.shareReport" :expr.sync="application.shareReportExpr" :share-link="true" <timing-item ref="trackTimingItem" :choose.sync="application.shareReport" :expr.sync="application.typeValue" :share-link="true" :unit-options="applyUnitOptions"
@chooseChange="chooseChangeApply" :title="$t('report.report_sharing_link')"/> @chooseChange="chooseChangeApply" :title="$t('report.report_sharing_link')"/>
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
@ -147,14 +147,20 @@ export default {
}, },
application:{ application:{
shareReport:'', shareReport:'',
shareReportExpr:'', typeValue:'',
}, },
count: 0, count: 0,
isXpack: false, isXpack: false,
result: {}, result: {},
quantity: "", quantity: "",
unit: "", unit: "",
choose: false choose: false,
applyUnitOptions: [
{value: "H", label: this.$t('commons.date_unit.hour')},
{value: "D", label: this.$t('commons.date_unit.day')},
{value: "M", label: this.$t('commons.date_unit.month')},
{value: "Y", label: this.$t('commons.date_unit.year')},
]
}; };
}, },
created() { created() {
@ -192,11 +198,11 @@ export default {
getProjectApplication(){ getProjectApplication(){
let type; let type;
if(this.activeName==='test_track'){ if(this.activeName==='test_track'){
type = 'TRACK' type = 'TRACK_SHARE_REPORT_TIME'
}else if(this.activeName==='performance'){ }else if(this.activeName==='performance'){
type = 'PERFORMANCE' type = 'PERFORMANCE_SHARE_REPORT_TIME'
}else if(this.activeName==='api'){ }else if(this.activeName==='api'){
type = 'API' type = 'API_SHARE_REPORT_TIME'
} }
if(type){ if(type){
this.$get('/project_application/get/' + this.projectId+"/"+type, res => { this.$get('/project_application/get/' + this.projectId+"/"+type, res => {

View File

@ -63,6 +63,16 @@ export default {
return false; return false;
}, },
}, },
unitOptions:{
type: Array,
default() {
return [
{value: "D", label: this.$t('commons.date_unit.day')},
{value: "M", label: this.$t('commons.date_unit.month')},
{value: "Y", label: this.$t('commons.date_unit.year')},
];
},
}
}, },
watch: { watch: {
expr(val) { expr(val) {
@ -79,11 +89,6 @@ export default {
selfChoose: this.choose, selfChoose: this.choose,
selfExpr: this.expr, selfExpr: this.expr,
quantityOptions: 31, quantityOptions: 31,
unitOptions: [
{value: "D", label: this.$t('commons.date_unit.day')},
{value: "M", label: this.$t('commons.date_unit.month')},
{value: "Y", label: this.$t('commons.date_unit.year')},
]
} }
}, },
methods: { methods: {

View File

@ -5,7 +5,7 @@
placement="right" placement="right"
width="300"> width="300">
<p>{{shareUrl}}</p> <p>{{shareUrl}}</p>
<span style="color: red;float: left;margin-left: 10px;">{{ $t('commons.validity_period')+application.shareReportExpr}}</span> <span style="color: red;float: left;margin-left: 10px;">{{ $t('commons.validity_period')+application.typeValue}}</span>
<div style="text-align: right; margin: 0"> <div style="text-align: right; margin: 0">
<el-button type="primary" size="mini" :disabled="!shareUrl" <el-button type="primary" size="mini" :disabled="!shareUrl"
v-clipboard:copy="shareUrl">{{ $t("commons.copy") }}</el-button> v-clipboard:copy="shareUrl">{{ $t("commons.copy") }}</el-button>
@ -82,7 +82,7 @@ export default {
this.getProjectApplication(); this.getProjectApplication();
}, },
getProjectApplication(){ getProjectApplication(){
this.$get('/project_application/get/' + getCurrentProjectID()+"/TRACK", res => { this.$get('/project_application/get/' + getCurrentProjectID()+"/TRACK_SHARE_REPORT_TIME", res => {
if(res.data){ if(res.data){
this.application = res.data; this.application = res.data;
} }

View File

@ -166,6 +166,7 @@ export default {
weeks_5: 'Fri', weeks_5: 'Fri',
weeks_6: 'Sat', weeks_6: 'Sat',
date_unit: { date_unit: {
hour: "HOUR",
day: "Day", day: "Day",
month: "Month", month: "Month",
year: "Year" year: "Year"

View File

@ -160,6 +160,7 @@ export default {
weeks_5: '周五', weeks_5: '周五',
weeks_6: '周六', weeks_6: '周六',
date_unit: { date_unit: {
hour: "小时",
day: "天", day: "天",
month: "月", month: "月",
year: "年" year: "年"

View File

@ -160,6 +160,7 @@ export default {
weeks_5: '周五', weeks_5: '周五',
weeks_6: '周六', weeks_6: '周六',
date_unit: { date_unit: {
hour: "小時",
day: "天", day: "天",
month: "月", month: "月",
year: "年" year: "年"