feat(项目设置): “我的待办-待更新”时间应用-以及修改导入时对待更新的处理

--user=郭雨琦
--bug=1007895
https://www.tapd.cn/55049933/prong/stories/view/1155049933001007895
This commit is contained in:
guoyuqi 2022-07-18 18:14:12 +08:00 committed by f2c-ci-robot[bot]
parent 7041aa5c71
commit 831f655f4f
18 changed files with 327 additions and 40 deletions

View File

@ -33,4 +33,7 @@ public class ApiDefinitionRequest extends BaseQueryRequest {
private boolean repeatCase;
//是否进入待更新列表
private Boolean toBeUpdated;
//当前时间减去进入待更新的时间
private Long toBeUpdateTime;
}

View File

@ -41,6 +41,11 @@ public class ApiTestCaseRequest extends BaseQueryRequest {
* 是否进入待更新列表
*/
private Boolean toBeUpdated;
/**
* 当前时间减去进入待更新的时间
*/
private Long toBeUpdateTime;
/**
* 是否需要查询环境字段
*/
@ -50,7 +55,7 @@ public class ApiTestCaseRequest extends BaseQueryRequest {
* 查询排除一些接口
*/
private List<String> notInIds;
//页面跳转时附带的过滤条件
private String redirectFilter;
}

View File

@ -85,7 +85,7 @@ public class ApiExecuteService {
request.setEnvironmentId(extApiTestCaseMapper.getApiCaseEnvironment(request.getCaseId()));
}
//提前生成报告
ApiDefinitionExecResultWithBLOBs report = ApiDefinitionExecResultUtil.add(caseWithBLOBs.getId(), APITestStatus.Running.name(), request.getReportId(),Objects.requireNonNull(SessionUtils.getUser()).getId());
ApiDefinitionExecResultWithBLOBs report = ApiDefinitionExecResultUtil.add(caseWithBLOBs.getId(), APITestStatus.Running.name(), request.getReportId(), Objects.requireNonNull(SessionUtils.getUser()).getId());
report.setName(caseWithBLOBs.getName());
report.setTriggerMode(ApiRunMode.JENKINS.name());
report.setType(ApiRunMode.JENKINS.name());
@ -135,6 +135,7 @@ public class ApiExecuteService {
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = apiDefinitionMapper.selectByPrimaryKey(caseWithBLOBs.getApiDefinitionId());
if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) {
apiDefinitionWithBLOBs.setToBeUpdated(true);
apiDefinitionWithBLOBs.setToBeUpdateTime(System.currentTimeMillis());
apiDefinitionMapper.updateByPrimaryKey(apiDefinitionWithBLOBs);
}
}

View File

@ -165,6 +165,12 @@ public class ApiDefinitionService {
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
request = this.initRequest(request, true, true);
if (request.getToBeUpdated() != null && request.getToBeUpdated()) {
Long toBeUpdatedTime = apiTestCaseService.getToBeUpdatedTime(request.getProjectId());
if (toBeUpdatedTime != null) {
request.setToBeUpdateTime(toBeUpdatedTime);
}
}
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
buildUserInfo(resList);
if (StringUtils.isNotBlank(request.getProjectId())) {
@ -610,6 +616,7 @@ public class ApiDefinitionService {
test.setRemark(request.getRemark());
if (request.getToBeUpdated() != null && request.getToBeUpdated()) {
test.setToBeUpdated(request.getToBeUpdated());
test.setToBeUpdateTime(System.currentTimeMillis());
}
if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) {
test.setTags(request.getTags());
@ -872,6 +879,15 @@ public class ApiDefinitionService {
if (apiTestCaseWithBLOBs.getNum() == null) {
apiTestCaseWithBLOBs.setNum(testCaseService.getNextNum(apiDefinition.getId()));
}
if (apiDefinition.getToBeUpdated() != null) {
apiTestCaseWithBLOBs.setToBeUpdated(apiDefinition.getToBeUpdated());
}
if (apiDefinition.getToBeUpdateTime() != null) {
apiTestCaseWithBLOBs.setToBeUpdateTime(apiDefinition.getToBeUpdateTime());
}
if (StringUtils.isNotBlank(apiTestCaseWithBLOBs.getId())) {
apiTestCaseMapper.updateByPrimaryKeyWithBLOBs(apiTestCaseWithBLOBs);
} else {
@ -992,6 +1008,8 @@ public class ApiDefinitionService {
Boolean toChangeTime = checkIsSynchronize(existApi, apiDefinition);
if (toChangeTime) {
apiDefinition.setUpdateTime(System.currentTimeMillis());
} else if (apiTestImportRequest.getCoverModule() != null && apiTestImportRequest.getCoverModule()) {
apiDefinition.setUpdateTime(System.currentTimeMillis());
}
} else {
apiDefinition.setUpdateTime(System.currentTimeMillis());
@ -1039,24 +1057,50 @@ public class ApiDefinitionService {
} catch (JsonProcessingException e) {
e.printStackTrace();
}
ApiSyncCaseRequest apiSyncCaseRequest = new ApiSyncCaseRequest();
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
if (apiDefinitionSyncService != null) {
apiSyncCaseRequest = apiDefinitionSyncService.getApiSyncCaseRequest(existApi.getProjectId());
}
//Compare the basic information of the API. If it contains the comparison that needs to be done for the synchronization information,
// put the data into the to-be-synchronized
if (!StringUtils.equals(exApiString, apiString)) {
if (!StringUtils.equals(apiDefinition.getMethod(), existApi.getMethod())) {
apiDefinition.setToBeUpdated(true);
if (apiSyncCaseRequest.getMethod()) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}
return true;
}
if (!StringUtils.equals(apiDefinition.getProtocol(), existApi.getProtocol())) {
apiDefinition.setToBeUpdated(true);
if (apiSyncCaseRequest.getProtocol()) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}
return true;
}
if (!StringUtils.equals(apiDefinition.getPath(), existApi.getPath())) {
apiDefinition.setToBeUpdated(true);
if (apiSyncCaseRequest.getPath()) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}
return true;
}
}
if (!StringUtils.equals(apiDefinition.getCreateUser(), existApi.getCreateUser())) {
return true;
}
if (!StringUtils.equals(apiDefinition.getStatus(), existApi.getStatus())) {
return true;
}
if (!StringUtils.equals(apiDefinition.getTags(), existApi.getTags())) {
return true;
}
@ -1086,28 +1130,40 @@ public class ApiDefinitionService {
}
if (exApiRequest.get("headers") != null && apiRequest.get("headers") != null) {
if (!StringUtils.equals(exApiRequest.get("headers").toString(), apiRequest.get("headers").toString())) {
apiDefinition.setToBeUpdated(true);
if (apiSyncCaseRequest.getHeaders()) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}
return true;
}
}
if (exApiRequest.get("arguments") != null && apiRequest.get("arguments") != null) {
if (!StringUtils.equals(exApiRequest.get("arguments").toString(), apiRequest.get("arguments").toString())) {
apiDefinition.setToBeUpdated(true);
if (apiSyncCaseRequest.getQuery()) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}
return true;
}
}
if (exApiRequest.get("rest") != null && apiRequest.get("rest") != null) {
if (!StringUtils.equals(exApiRequest.get("rest").toString(), apiRequest.get("rest").toString())) {
apiDefinition.setToBeUpdated(true);
if (apiSyncCaseRequest.getRest()) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}
return true;
}
}
if (exApiRequest.get("body") != null && apiRequest.get("body") != null) {
if (!StringUtils.equals(exApiRequest.get("body").toString(), apiRequest.get("body").toString())) {
apiDefinition.setToBeUpdated(true);
if (apiSyncCaseRequest.getBody()) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}
return true;
}
}

View File

@ -1,9 +1,12 @@
package io.metersphere.api.service;
import io.metersphere.api.dto.definition.ApiSyncCaseRequest;
import io.metersphere.api.dto.definition.SaveApiDefinitionRequest;
public interface ApiDefinitionSyncService {
void syncApi(SaveApiDefinitionRequest request);
ApiSyncCaseRequest getApiSyncCaseRequest(String projectId);
}

View File

@ -19,10 +19,7 @@ import io.metersphere.api.dto.scenario.request.RequestType;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.CommonConstants;
import io.metersphere.commons.constants.MsTestElementConstants;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
@ -59,6 +56,8 @@ import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import static io.metersphere.api.service.utils.ShareUtil.getTimeMills;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiTestCaseService {
@ -117,6 +116,9 @@ public class ApiTestCaseService {
private ApiCaseExecutionInfoService apiCaseExecutionInfoService;
@Resource
private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource
private ProjectApplicationMapper projectApplicationMapper;
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
@ -144,14 +146,51 @@ public class ApiTestCaseService {
public List<ApiTestCaseDTO> listSimple(ApiTestCaseRequest request) {
request = this.initRequest(request, true, true);
if (request.getToBeUpdated() != null && request.getToBeUpdated()) {
Long toBeUpdatedTime = getToBeUpdatedTime(request.getProjectId());
if (toBeUpdatedTime != null) {
request.setToBeUpdateTime(toBeUpdatedTime);
}
}
List<ApiTestCaseDTO> apiTestCases = extApiTestCaseMapper.listSimple(request);
if (CollectionUtils.isEmpty(apiTestCases)) {
return apiTestCases;
}
buildUserInfo(apiTestCases, request.isSelectEnvironment());
return apiTestCases;
}
public Long getToBeUpdatedTime(String projectId) {
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andTypeEqualTo(ProjectApplicationType.OPEN_UPDATE_TIME.name())
.andProjectIdEqualTo(projectId);
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
if (projectApplications == null || projectApplications.size() == 0) {
return null;
}
ProjectApplication projectApplication = projectApplications.get(0);
String typeValue = projectApplication.getTypeValue();
if (typeValue.equals("false")) {
return null;
}
example = new ProjectApplicationExample();
example.createCriteria().andTypeEqualTo(ProjectApplicationType.OPEN_UPDATE_RULE_TIME.name())
.andProjectIdEqualTo(projectId);
List<ProjectApplication> projectApplicationTimes = projectApplicationMapper.selectByExample(example);
if (projectApplicationTimes == null || projectApplicationTimes.size() == 0) {
return null;
}
ProjectApplication projectApplicationTime = projectApplicationTimes.get(0);
String time = projectApplicationTime.getTypeValue();
if (StringUtils.isNotBlank(time)) {
time = "-" + time;
return getTimeMills(System.currentTimeMillis(), time);
}
return null;
}
public void setCaseEnvironment(List<ApiTestCaseDTO> apiTestCases) {
for (ApiTestCaseDTO apiCase : apiTestCases) {
ApiTestEnvironment environment = getApiCaseEnvironment(apiCase.getId());
@ -826,6 +865,9 @@ public class ApiTestCaseService {
apiTestCase.setRequest(requestStr);
if (toBeUpdated != null) {
apiTestCase.setToBeUpdated(toBeUpdated);
if (toBeUpdated) {
apiTestCase.setToBeUpdateTime(System.currentTimeMillis());
}
}
batchMapper.updateByPrimaryKeySelective(apiTestCase);
});

View File

@ -75,6 +75,7 @@ public class RemakeReportService {
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = apiDefinitionMapper.selectByPrimaryKey(apiTestCase.getApiDefinitionId());
if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) {
apiDefinitionWithBLOBs.setToBeUpdated(true);
apiDefinitionWithBLOBs.setToBeUpdateTime(System.currentTimeMillis());
apiDefinitionMapper.updateByPrimaryKey(apiDefinitionWithBLOBs);
}
}
@ -117,7 +118,7 @@ public class RemakeReportService {
} else if (StringUtils.equalsAny(request.getRunMode(), ApiRunMode.UI_SCENARIO_PLAN.name(),
request.getRunMode(), ApiRunMode.UI_SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.UI_JENKINS_SCENARIO_PLAN.name())) {
remarkUiScenarioPlan(request);
}else {
} else {
ApiScenarioReportWithBLOBs report = apiScenarioReportMapper.selectByPrimaryKey(request.getReportId());
if (report != null) {
report.setStatus(APITestStatus.Error.name());

View File

@ -1,6 +1,5 @@
package io.metersphere.api.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
@ -17,7 +16,6 @@ import io.metersphere.commons.json.JSONSchemaGenerator;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator;
import io.metersphere.service.ProjectApplicationService;
import io.metersphere.track.service.TestPlanApiCaseService;
@ -33,7 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import static io.metersphere.api.service.utils.ShareUtill.getTimeMills;
import static io.metersphere.api.service.utils.ShareUtil.getTimeMills;
/**
* @author song.tianyang
@ -211,12 +209,12 @@ public class ShareInfoService {
}
}
JSONSchemaBodyDTO jsonSchemaBodyDTO = new JSONSchemaBodyDTO();
if(isJsonSchema){
if (isJsonSchema) {
jsonSchemaBodyDTO.setJsonSchema(bodyObj.get("jsonSchema"));
apiInfoDTO.setJsonSchemaBody(jsonSchemaBodyDTO);
String raw =JSONSchemaGenerator.getJson(JSONObject.toJSONString(bodyObj.get("jsonSchema")));
String raw = JSONSchemaGenerator.getJson(JSONObject.toJSONString(bodyObj.get("jsonSchema")));
this.setPreviewData(previewJsonArray, raw);
}else {
} else {
if (bodyObj.containsKey("raw")) {
String raw = bodyObj.getString("raw");
jsonSchemaBodyDTO.setRaw(raw);
@ -405,9 +403,9 @@ public class ShareInfoService {
apiInfoDTO.setRemark(apiModel.getRemark());
}
if (!previewJsonArray.isEmpty()) {
if(previewJsonArray.size() == 1){
if (previewJsonArray.size() == 1) {
apiInfoDTO.setRequestPreviewData(previewJsonArray.get(0));
}else {
} else {
apiInfoDTO.setRequestPreviewData(previewJsonArray);
}
}

View File

@ -2,16 +2,25 @@ package io.metersphere.api.service.utils;
import org.apache.commons.lang3.StringUtils;
import java.time.*;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
public class ShareUtill {
public class ShareUtil {
private static final String UNIT_HOUR = "H";
private static final String UNIT_DAY = "D";
private static final String UNIT_MONTH = "M";
private static final String UNIT_YEAR = "Y";
public static long getTimeMills(long time,String expr) {
/**
* return time + expr
*
* @param time
* @param expr
* @return
*/
public static long getTimeMills(long time, String expr) {
Instant instant = Instant.ofEpochMilli(time);
ZoneId zone = ZoneId.systemDefault();
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
@ -27,7 +36,7 @@ public class ShareUtill {
LocalDateTime date = null;
String unit = expr.substring(expr.length() - 1);
int quantity = Integer.parseInt(expr.substring(0, expr.length() - 1));
if(StringUtils.equals(unit,UNIT_HOUR)){
if (StringUtils.equals(unit, UNIT_HOUR)) {
date = localDateTime.plusHours(quantity);
} else if (StringUtils.equals(unit, UNIT_DAY)) {
date = localDateTime.plusDays(quantity);

View File

@ -61,5 +61,7 @@ public class ApiDefinition implements Serializable {
private Boolean toBeUpdated;
private Long toBeUpdateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -1993,6 +1993,66 @@ public class ApiDefinitionExample {
addCriterion("to_be_updated not between", value1, value2, "toBeUpdated");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeIsNull() {
addCriterion("to_be_update_Time is null");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeIsNotNull() {
addCriterion("to_be_update_Time is not null");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeEqualTo(Long value) {
addCriterion("to_be_update_Time =", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeNotEqualTo(Long value) {
addCriterion("to_be_update_Time <>", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeGreaterThan(Long value) {
addCriterion("to_be_update_Time >", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("to_be_update_Time >=", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeLessThan(Long value) {
addCriterion("to_be_update_Time <", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("to_be_update_Time <=", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeIn(List<Long> values) {
addCriterion("to_be_update_Time in", values, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeNotIn(List<Long> values) {
addCriterion("to_be_update_Time not in", values, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeBetween(Long value1, Long value2) {
addCriterion("to_be_update_Time between", value1, value2, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("to_be_update_Time not between", value1, value2, "toBeUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -47,5 +47,7 @@ public class ApiTestCase implements Serializable {
private Boolean toBeUpdated;
private Long toBeUpdateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -1503,6 +1503,66 @@ public class ApiTestCaseExample {
addCriterion("to_be_updated not between", value1, value2, "toBeUpdated");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeIsNull() {
addCriterion("to_be_update_Time is null");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeIsNotNull() {
addCriterion("to_be_update_Time is not null");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeEqualTo(Long value) {
addCriterion("to_be_update_Time =", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeNotEqualTo(Long value) {
addCriterion("to_be_update_Time <>", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeGreaterThan(Long value) {
addCriterion("to_be_update_Time >", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("to_be_update_Time >=", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeLessThan(Long value) {
addCriterion("to_be_update_Time <", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("to_be_update_Time <=", value, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeIn(List<Long> values) {
addCriterion("to_be_update_Time in", values, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeNotIn(List<Long> values) {
addCriterion("to_be_update_Time not in", values, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeBetween(Long value1, Long value2) {
addCriterion("to_be_update_Time between", value1, value2, "toBeUpdateTime");
return (Criteria) this;
}
public Criteria andToBeUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("to_be_update_Time not between", value1, value2, "toBeUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -30,6 +30,7 @@
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="latest" jdbcType="BIT" property="latest" />
<result column="to_be_updated" jdbcType="BIT" property="toBeUpdated" />
<result column="to_be_update_Time" jdbcType="BIGINT" property="toBeUpdateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -99,7 +100,7 @@
id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`,
module_id, user_id, create_time, update_time, protocol, `path`, num, tags, original_state,
create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id,
`order`, ref_id, version_id, latest, to_be_updated
`order`, ref_id, version_id, latest, to_be_updated, to_be_update_Time
</sql>
<sql id="Blob_Column_List">
description, request, response, remark
@ -162,8 +163,9 @@
case_total, case_status, case_passing_rate,
delete_time, delete_user_id, `order`,
ref_id, version_id, latest,
to_be_updated, description, request,
response, remark)
to_be_updated, to_be_update_Time, description,
request, response, remark
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
#{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
@ -173,8 +175,9 @@
#{caseTotal,jdbcType=VARCHAR}, #{caseStatus,jdbcType=VARCHAR}, #{casePassingRate,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{refId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{latest,jdbcType=BIT},
#{toBeUpdated,jdbcType=BIT}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR},
#{response,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR})
#{toBeUpdated,jdbcType=BIT}, #{toBeUpdateTime,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR},
#{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition
@ -263,6 +266,9 @@
<if test="toBeUpdated != null">
to_be_updated,
</if>
<if test="toBeUpdateTime != null">
to_be_update_Time,
</if>
<if test="description != null">
description,
</if>
@ -361,6 +367,9 @@
<if test="toBeUpdated != null">
#{toBeUpdated,jdbcType=BIT},
</if>
<if test="toBeUpdateTime != null">
#{toBeUpdateTime,jdbcType=BIGINT},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
@ -468,6 +477,9 @@
<if test="record.toBeUpdated != null">
to_be_updated = #{record.toBeUpdated,jdbcType=BIT},
</if>
<if test="record.toBeUpdateTime != null">
to_be_update_Time = #{record.toBeUpdateTime,jdbcType=BIGINT},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
@ -515,6 +527,7 @@
version_id = #{record.versionId,jdbcType=VARCHAR},
latest = #{record.latest,jdbcType=BIT},
to_be_updated = #{record.toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{record.toBeUpdateTime,jdbcType=BIGINT},
description = #{record.description,jdbcType=LONGVARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR},
response = #{record.response,jdbcType=LONGVARCHAR},
@ -552,7 +565,8 @@
ref_id = #{record.refId,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
latest = #{record.latest,jdbcType=BIT},
to_be_updated = #{record.toBeUpdated,jdbcType=BIT}
to_be_updated = #{record.toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{record.toBeUpdateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -641,6 +655,9 @@
<if test="toBeUpdated != null">
to_be_updated = #{toBeUpdated,jdbcType=BIT},
</if>
<if test="toBeUpdateTime != null">
to_be_update_Time = #{toBeUpdateTime,jdbcType=BIGINT},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
@ -685,6 +702,7 @@
version_id = #{versionId,jdbcType=VARCHAR},
latest = #{latest,jdbcType=BIT},
to_be_updated = #{toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{toBeUpdateTime,jdbcType=BIGINT},
description = #{description,jdbcType=LONGVARCHAR},
request = #{request,jdbcType=LONGVARCHAR},
response = #{response,jdbcType=LONGVARCHAR},
@ -719,7 +737,8 @@
ref_id = #{refId,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
latest = #{latest,jdbcType=BIT},
to_be_updated = #{toBeUpdated,jdbcType=BIT}
to_be_updated = #{toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{toBeUpdateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -23,6 +23,7 @@
<result column="case_status" jdbcType="VARCHAR" property="caseStatus" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="to_be_updated" jdbcType="BIT" property="toBeUpdated" />
<result column="to_be_update_Time" jdbcType="BIGINT" property="toBeUpdateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -89,7 +90,7 @@
<sql id="Base_Column_List">
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
create_time, update_time, num, tags, last_result_id, `status`, original_status, delete_time,
delete_user_id, version, `order`, case_status, version_id, to_be_updated
delete_user_id, version, `order`, case_status, version_id, to_be_updated, to_be_update_Time
</sql>
<sql id="Blob_Column_List">
description, request
@ -150,7 +151,8 @@
`status`, original_status, delete_time,
delete_user_id, version, `order`,
case_status, version_id, to_be_updated,
description, request)
to_be_update_Time, description, request
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
@ -158,7 +160,8 @@
#{status,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
#{deleteUserId,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{order,jdbcType=BIGINT},
#{caseStatus,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{toBeUpdated,jdbcType=BIT},
#{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR})
#{toBeUpdateTime,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
insert into api_test_case
@ -226,6 +229,9 @@
<if test="toBeUpdated != null">
to_be_updated,
</if>
<if test="toBeUpdateTime != null">
to_be_update_Time,
</if>
<if test="description != null">
description,
</if>
@ -297,6 +303,9 @@
<if test="toBeUpdated != null">
#{toBeUpdated,jdbcType=BIT},
</if>
<if test="toBeUpdateTime != null">
#{toBeUpdateTime,jdbcType=BIGINT},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
@ -377,6 +386,9 @@
<if test="record.toBeUpdated != null">
to_be_updated = #{record.toBeUpdated,jdbcType=BIT},
</if>
<if test="record.toBeUpdateTime != null">
to_be_update_Time = #{record.toBeUpdateTime,jdbcType=BIGINT},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
@ -411,6 +423,7 @@
case_status = #{record.caseStatus,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
to_be_updated = #{record.toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{record.toBeUpdateTime,jdbcType=BIGINT},
description = #{record.description,jdbcType=LONGVARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -439,7 +452,8 @@
`order` = #{record.order,jdbcType=BIGINT},
case_status = #{record.caseStatus,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
to_be_updated = #{record.toBeUpdated,jdbcType=BIT}
to_be_updated = #{record.toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{record.toBeUpdateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -507,6 +521,9 @@
<if test="toBeUpdated != null">
to_be_updated = #{toBeUpdated,jdbcType=BIT},
</if>
<if test="toBeUpdateTime != null">
to_be_update_Time = #{toBeUpdateTime,jdbcType=BIGINT},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
@ -538,6 +555,7 @@
case_status = #{caseStatus,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
to_be_updated = #{toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{toBeUpdateTime,jdbcType=BIGINT},
description = #{description,jdbcType=LONGVARCHAR},
request = #{request,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
@ -563,7 +581,8 @@
`order` = #{order,jdbcType=BIGINT},
case_status = #{caseStatus,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
to_be_updated = #{toBeUpdated,jdbcType=BIT}
to_be_updated = #{toBeUpdated,jdbcType=BIT},
to_be_update_Time = #{toBeUpdateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -355,7 +355,7 @@
<update id="removeToGcByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExampleWithOperation">
update api_definition
set original_state=status,
status = 'Trash', delete_user_id = #{operator},delete_time = #{operationTime}
status = 'Trash', delete_user_id = #{operator},delete_time = #{operationTime}, to_be_updated = 'false'
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
@ -754,6 +754,9 @@
<if test="request.toBeUpdated != null">
AND api_definition.to_be_updated = #{request.toBeUpdated}
</if>
<if test="request.toBeUpdateTime != null">
AND api_definition.to_be_update_time >= #{request.toBeUpdateTime}
</if>
<if test="request.notInIds != null and request.notInIds.size() > 0">
and api_definition.id not in
<foreach collection="request.notInIds" item="id" separator="," open="(" close=")">

View File

@ -505,6 +505,9 @@
<if test="request.toBeUpdated !=null and request.toBeUpdated == true">
and (t1.to_be_updated = #{request.toBeUpdated} or t3.status = 'error')
</if>
<if test="request.toBeUpdateTime !=null">
and (t1.to_be_update_time >= #{request.toBeUpdateTime})
</if>
<include refid="queryVersionCondition">
<property name="versionTable" value="t1"/>
</include>
@ -858,7 +861,7 @@
<update id="deleteToGc" parameterType="io.metersphere.api.dto.definition.ApiTestCaseRequest">
update api_test_case
set original_status=status,
status = 'Trash',delete_time = #{deleteTime},delete_user_id = #{deleteUserId}
status = 'Trash',delete_time = #{deleteTime},delete_user_id = #{deleteUserId}, to_be_updated = 'false'
where id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}

View File

@ -392,6 +392,7 @@ export default {
if (this.config.openUpdateRuleTime) {
this.pastUnit = this.config.openUpdateRuleTime.substring(this.config.openUpdateRuleTime.length - 1);
this.pastQuantity = this.config.openUpdateRuleTime.substring(0, this.config.openUpdateRuleTime.length - 1);
this.showSyncTimeSetting = true;
}
}
});