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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.ProjectApplication;
import io.metersphere.base.domain.ProjectApplicationExample;
import java.util.List;
@ -20,5 +19,4 @@ public interface ProjectApplicationMapper {
int updateByExampleSelective(@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">
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<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>
<sql id="Example_Where_Clause">
<where>
@ -65,7 +65,7 @@
</where>
</sql>
<sql id="Base_Column_List">
project_id, `type`, share_report_expr
project_id, `type`, type_value
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectApplicationExample" resultMap="BaseResultMap">
select
@ -88,9 +88,9 @@
</if>
</delete>
<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 id="insertSelective" parameterType="io.metersphere.base.domain.ProjectApplication">
@ -102,8 +102,8 @@
<if test="type != null">
`type`,
</if>
<if test="shareReportExpr != null">
share_report_expr,
<if test="typeValue != null">
type_value,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -113,8 +113,8 @@
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="shareReportExpr != null">
#{shareReportExpr,jdbcType=VARCHAR},
<if test="typeValue != null">
#{typeValue,jdbcType=VARCHAR},
</if>
</trim>
</insert>
@ -133,8 +133,8 @@
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.shareReportExpr != null">
share_report_expr = #{record.shareReportExpr,jdbcType=VARCHAR},
<if test="record.typeValue != null">
type_value = #{record.typeValue,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
@ -145,7 +145,7 @@
update project_application
set project_id = #{record.projectId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
share_report_expr = #{record.shareReportExpr,jdbcType=VARCHAR}
type_value = #{record.typeValue,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</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("type", "类型");
projectApplicationColumns.put("shareReportExpr", "报告分享链接时间");
projectApplicationColumns.put("typeValue", "");
jarColumns.put("name", "名称");
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.ExtUserGroupMapper;
import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.commons.constants.IssuesManagePlatform;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.constants.ScheduleType;
import io.metersphere.commons.constants.UserGroupConstants;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
@ -172,9 +169,10 @@ public class ProjectService {
ProjectApplication projectApplication = new ProjectApplication();
projectApplication.setProjectId(project.getId());
//每个新项目都会有测试跟踪/性能报告分享链接的有效时间,默认时间24H
projectApplication.setType("TRACK");
projectApplication.setType(ProjectApplicationType.TRACK_SHARE_REPORT_TIME.toString());
projectApplication.setTypeValue("24H");
projectApplicationMapper.insert(projectApplication);
projectApplication.setType("PERFORMANCE");
projectApplication.setType(ProjectApplicationType.PERFORMANCE_SHARE_REPORT_TIME.toString());
projectApplicationMapper.insert(projectApplication);
return project;
}

View File

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

View File

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

View File

@ -28,7 +28,7 @@
</app-manage-item>
<timing-item ref="trackTimingItem" :choose.sync="form.cleanTrackReport" :expr.sync="form.cleanTrackReportExpr"
@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')"/>
</el-row>
</el-tab-pane>
@ -94,7 +94,7 @@
<el-row style="margin-top: 15px">
<timing-item ref="loadTimingItem" :choose.sync="form.cleanLoadReport" :expr.sync="form.cleanLoadReportExpr"
@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')"/>
</el-row>
</el-tab-pane>
@ -147,14 +147,20 @@ export default {
},
application:{
shareReport:'',
shareReportExpr:'',
typeValue:'',
},
count: 0,
isXpack: false,
result: {},
quantity: "",
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() {
@ -192,11 +198,11 @@ export default {
getProjectApplication(){
let type;
if(this.activeName==='test_track'){
type = 'TRACK'
type = 'TRACK_SHARE_REPORT_TIME'
}else if(this.activeName==='performance'){
type = 'PERFORMANCE'
type = 'PERFORMANCE_SHARE_REPORT_TIME'
}else if(this.activeName==='api'){
type = 'API'
type = 'API_SHARE_REPORT_TIME'
}
if(type){
this.$get('/project_application/get/' + this.projectId+"/"+type, res => {

View File

@ -63,6 +63,16 @@ export default {
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: {
expr(val) {
@ -79,11 +89,6 @@ export default {
selfChoose: this.choose,
selfExpr: this.expr,
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: {

View File

@ -5,7 +5,7 @@
placement="right"
width="300">
<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">
<el-button type="primary" size="mini" :disabled="!shareUrl"
v-clipboard:copy="shareUrl">{{ $t("commons.copy") }}</el-button>
@ -82,7 +82,7 @@ export default {
this.getProjectApplication();
},
getProjectApplication(){
this.$get('/project_application/get/' + getCurrentProjectID()+"/TRACK", res => {
this.$get('/project_application/get/' + getCurrentProjectID()+"/TRACK_SHARE_REPORT_TIME", res => {
if(res.data){
this.application = res.data;
}

View File

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

View File

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

View File

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