Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2020-12-22 20:02:17 +08:00
commit e997234fda
23 changed files with 238 additions and 1370 deletions

View File

@ -1,56 +0,0 @@
package io.metersphere.api.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.automation.ApiTagRequest;
import io.metersphere.api.dto.automation.SaveApiTagRequest;
import io.metersphere.api.service.ApiTagService;
import io.metersphere.base.domain.ApiTag;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping(value = "/api/tag")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
public class ApiTagController {
@Resource
ApiTagService apiTagService;
@PostMapping("/list")
public List<ApiTag> list(@RequestBody ApiTagRequest request) {
return apiTagService.list(request);
}
@PostMapping("/getTgas/{goPage}/{pageSize}")
public Pager<List<ApiTag>> getTgas(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTagRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return PageUtils.setPageInfo(page, apiTagService.getTgas(request));
}
@PostMapping(value = "/create")
public void create(@RequestBody SaveApiTagRequest request) {
apiTagService.create(request);
}
@PostMapping(value = "/update")
public void update(@RequestBody SaveApiTagRequest request) {
apiTagService.update(request);
}
@GetMapping("/delete/{id}")
public void delete(@PathVariable String id) {
apiTagService.delete(id);
}
}

View File

@ -13,7 +13,7 @@ public class SaveApiScenarioRequest {
private String projectId; private String projectId;
private String tagId; private String tags;
private String userId; private String userId;

View File

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.automation.*;
import io.metersphere.api.dto.datacount.ApiDataCountResult; import io.metersphere.api.dto.datacount.ApiDataCountResult;
import io.metersphere.api.dto.definition.RunDefinitionRequest; import io.metersphere.api.dto.definition.RunDefinitionRequest;
@ -13,9 +12,11 @@ import io.metersphere.api.dto.definition.request.*;
import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
import io.metersphere.api.jmeter.JMeterService; import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.ApiScenario;
import io.metersphere.base.domain.ApiScenarioExample;
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.base.mapper.ApiScenarioMapper; import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiTagMapper;
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper; import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper; import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.commons.constants.APITestStatus; import io.metersphere.commons.constants.APITestStatus;
@ -54,8 +55,6 @@ public class ApiAutomationService {
@Resource @Resource
private ExtApiScenarioMapper extApiScenarioMapper; private ExtApiScenarioMapper extApiScenarioMapper;
@Resource @Resource
private ApiTagMapper apiTagMapper;
@Resource
private JMeterService jMeterService; private JMeterService jMeterService;
@Resource @Resource
private ApiTestEnvironmentService environmentService; private ApiTestEnvironmentService environmentService;
@ -70,29 +69,7 @@ public class ApiAutomationService {
public List<ApiScenarioDTO> list(ApiScenarioRequest request) { public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request); return extApiScenarioMapper.list(request);
ApiTagExample example = new ApiTagExample();
example.createCriteria().andProjectIdEqualTo(request.getProjectId());
List<ApiTag> tags = apiTagMapper.selectByExample(example);
Map<String, String> tagMap = tags.stream().collect(Collectors.toMap(ApiTag::getId, ApiTag::getName));
Gson gs = new Gson();
list.forEach(item -> {
if (item.getTagId() != null) {
StringBuilder buf = new StringBuilder();
gs.fromJson(item.getTagId(), List.class).forEach(t -> {
buf.append(tagMap.get(t));
buf.append(",");
});
if (buf != null && buf.length() > 0) {
String tagNames = buf.toString().substring(0, buf.toString().length() - 1);
List<String> tagList = Arrays.asList(tagNames.split(","));
item.setTagNames(tagList);
} else {
item.setTagNames(new ArrayList<>());
}
}
});
return list;
} }
public void deleteByIds(List<String> nodeIds) { public void deleteByIds(List<String> nodeIds) {
@ -109,7 +86,7 @@ public class ApiAutomationService {
scenario.setId(request.getId()); scenario.setId(request.getId());
scenario.setName(request.getName()); scenario.setName(request.getName());
scenario.setProjectId(request.getProjectId()); scenario.setProjectId(request.getProjectId());
scenario.setTagId(request.getTagId()); scenario.setTags(request.getTags());
scenario.setApiScenarioModuleId(request.getApiScenarioModuleId()); scenario.setApiScenarioModuleId(request.getApiScenarioModuleId());
scenario.setModulePath(request.getModulePath()); scenario.setModulePath(request.getModulePath());
scenario.setLevel(request.getLevel()); scenario.setLevel(request.getLevel());
@ -146,7 +123,7 @@ public class ApiAutomationService {
scenario.setId(request.getId()); scenario.setId(request.getId());
scenario.setName(request.getName()); scenario.setName(request.getName());
scenario.setProjectId(request.getProjectId()); scenario.setProjectId(request.getProjectId());
scenario.setTagId(request.getTagId()); scenario.setTags(request.getTags());
scenario.setApiScenarioModuleId(request.getApiScenarioModuleId()); scenario.setApiScenarioModuleId(request.getApiScenarioModuleId());
scenario.setModulePath(request.getModulePath()); scenario.setModulePath(request.getModulePath());
scenario.setLevel(request.getLevel()); scenario.setLevel(request.getLevel());
@ -207,19 +184,6 @@ public class ApiAutomationService {
return new ArrayList<>(); return new ArrayList<>();
} }
public void deleteTag(String id) {
List<ApiScenarioWithBLOBs> list = extApiScenarioMapper.selectByTagId(id);
if (!list.isEmpty()) {
Gson gs = new Gson();
list.forEach(item -> {
List<String> tagIds = gs.fromJson(item.getTagId(), List.class);
tagIds.remove(id);
item.setTagId(JSON.toJSONString(tagIds));
apiScenarioMapper.updateByPrimaryKeySelective(item);
});
}
}
private void createAPIScenarioReportResult(String id, String triggerMode, String execType, String projectId) { private void createAPIScenarioReportResult(String id, String triggerMode, String execType, String projectId) {
APIScenarioReportResult report = new APIScenarioReportResult(); APIScenarioReportResult report = new APIScenarioReportResult();
report.setId(id); report.setId(id);

View File

@ -1,77 +0,0 @@
package io.metersphere.api.service;
import io.metersphere.api.dto.automation.ApiTagRequest;
import io.metersphere.api.dto.automation.SaveApiTagRequest;
import io.metersphere.base.domain.ApiTag;
import io.metersphere.base.domain.ApiTagExample;
import io.metersphere.base.mapper.ApiTagMapper;
import io.metersphere.base.mapper.ext.ExtApiTagMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.SessionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiTagService {
@Resource
private ApiTagMapper apiTagMapper;
@Resource
private ExtApiTagMapper extApiTagMapper;
@Resource
private ApiAutomationService apiAutomationService;
public List<ApiTag> list(ApiTagRequest request) {
ApiTagExample example = new ApiTagExample();
example.createCriteria().andProjectIdEqualTo(request.getProjectId());
return apiTagMapper.selectByExample(example);
}
public List<ApiTag> getTgas(ApiTagRequest request) {
return extApiTagMapper.list(request);
}
public void create(SaveApiTagRequest request) {
checkNameExist(request);
final ApiTag apiTag = new ApiTag();
apiTag.setId(request.getId());
apiTag.setName(request.getName());
apiTag.setProjectId(request.getProjectId());
apiTag.setCreateTime(System.currentTimeMillis());
apiTag.setUpdateTime(System.currentTimeMillis());
if (request.getUserId() == null) {
apiTag.setUserId(SessionUtils.getUserId());
} else {
apiTag.setUserId(request.getUserId());
}
apiTagMapper.insert(apiTag);
}
public void update(SaveApiTagRequest request) {
checkNameExist(request);
final ApiTag apiTag = new ApiTag();
apiTag.setId(request.getId());
apiTag.setName(request.getName());
apiTag.setProjectId(request.getProjectId());
apiTag.setUpdateTime(System.currentTimeMillis());
apiTag.setUserId(request.getUserId());
apiTagMapper.updateByPrimaryKeySelective(apiTag);
}
public void delete(String id) {
apiTagMapper.deleteByPrimaryKey(id);
apiAutomationService.deleteTag(id);
}
private void checkNameExist(SaveApiTagRequest request) {
ApiTagExample example = new ApiTagExample();
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId())
.andIdNotEqualTo(request.getId());
if (apiTagMapper.countByExample(example) > 0) {
MSException.throwException("名称不能重复");
}
}
}

View File

@ -9,7 +9,7 @@ public class ApiScenario implements Serializable {
private String projectId; private String projectId;
private String tagId; private String tags;
private String userId; private String userId;

View File

@ -244,73 +244,73 @@ public class ApiScenarioExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdIsNull() { public Criteria andTagsIsNull() {
addCriterion("tag_id is null"); addCriterion("tags is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdIsNotNull() { public Criteria andTagsIsNotNull() {
addCriterion("tag_id is not null"); addCriterion("tags is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdEqualTo(String value) { public Criteria andTagsEqualTo(String value) {
addCriterion("tag_id =", value, "tagId"); addCriterion("tags =", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdNotEqualTo(String value) { public Criteria andTagsNotEqualTo(String value) {
addCriterion("tag_id <>", value, "tagId"); addCriterion("tags <>", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdGreaterThan(String value) { public Criteria andTagsGreaterThan(String value) {
addCriterion("tag_id >", value, "tagId"); addCriterion("tags >", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdGreaterThanOrEqualTo(String value) { public Criteria andTagsGreaterThanOrEqualTo(String value) {
addCriterion("tag_id >=", value, "tagId"); addCriterion("tags >=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdLessThan(String value) { public Criteria andTagsLessThan(String value) {
addCriterion("tag_id <", value, "tagId"); addCriterion("tags <", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdLessThanOrEqualTo(String value) { public Criteria andTagsLessThanOrEqualTo(String value) {
addCriterion("tag_id <=", value, "tagId"); addCriterion("tags <=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdLike(String value) { public Criteria andTagsLike(String value) {
addCriterion("tag_id like", value, "tagId"); addCriterion("tags like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdNotLike(String value) { public Criteria andTagsNotLike(String value) {
addCriterion("tag_id not like", value, "tagId"); addCriterion("tags not like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdIn(List<String> values) { public Criteria andTagsIn(List<String> values) {
addCriterion("tag_id in", values, "tagId"); addCriterion("tags in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdNotIn(List<String> values) { public Criteria andTagsNotIn(List<String> values) {
addCriterion("tag_id not in", values, "tagId"); addCriterion("tags not in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdBetween(String value1, String value2) { public Criteria andTagsBetween(String value1, String value2) {
addCriterion("tag_id between", value1, value2, "tagId"); addCriterion("tags between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagIdNotBetween(String value1, String value2) { public Criteria andTagsNotBetween(String value1, String value2) {
addCriterion("tag_id not between", value1, value2, "tagId"); addCriterion("tags not between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -1,21 +0,0 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiTag implements Serializable {
private String id;
private String projectId;
private String name;
private String userId;
private Long createTime;
private Long updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -1,600 +0,0 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiTagExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiTagExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiScenario"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiScenario">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="tag_id" jdbcType="VARCHAR" property="tagId" /> <result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="user_id" jdbcType="VARCHAR" property="userId" /> <result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="api_scenario_module_id" jdbcType="VARCHAR" property="apiScenarioModuleId" /> <result column="api_scenario_module_id" jdbcType="VARCHAR" property="apiScenarioModuleId" />
<result column="module_path" jdbcType="VARCHAR" property="modulePath" /> <result column="module_path" jdbcType="VARCHAR" property="modulePath" />
@ -84,7 +84,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, project_id, tag_id, user_id, api_scenario_module_id, module_path, `name`, `level`, id, project_id, tags, user_id, api_scenario_module_id, module_path, `name`, `level`,
`status`, principal, step_total, follow_people, schedule, create_time, update_time, `status`, principal, step_total, follow_people, schedule, create_time, update_time,
pass_rate, last_result, report_id pass_rate, last_result, report_id
</sql> </sql>
@ -140,7 +140,7 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs"> <insert id="insert" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
insert into api_scenario (id, project_id, tag_id, insert into api_scenario (id, project_id, tags,
user_id, api_scenario_module_id, module_path, user_id, api_scenario_module_id, module_path,
`name`, `level`, `status`, `name`, `level`, `status`,
principal, step_total, follow_people, principal, step_total, follow_people,
@ -148,7 +148,7 @@
pass_rate, last_result, report_id, pass_rate, last_result, report_id,
scenario_definition, description scenario_definition, description
) )
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tagId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR},
@ -166,8 +166,8 @@
<if test="projectId != null"> <if test="projectId != null">
project_id, project_id,
</if> </if>
<if test="tagId != null"> <if test="tags != null">
tag_id, tags,
</if> </if>
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
@ -228,8 +228,8 @@
<if test="projectId != null"> <if test="projectId != null">
#{projectId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
</if> </if>
<if test="tagId != null"> <if test="tags != null">
#{tagId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
</if> </if>
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
@ -299,8 +299,8 @@
<if test="record.projectId != null"> <if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
</if> </if>
<if test="record.tagId != null"> <if test="record.tags != null">
tag_id = #{record.tagId,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR},
</if> </if>
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
@ -362,7 +362,7 @@
update api_scenario update api_scenario
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
tag_id = #{record.tagId,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
api_scenario_module_id = #{record.apiScenarioModuleId,jdbcType=VARCHAR}, api_scenario_module_id = #{record.apiScenarioModuleId,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR}, module_path = #{record.modulePath,jdbcType=VARCHAR},
@ -388,7 +388,7 @@
update api_scenario update api_scenario
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
tag_id = #{record.tagId,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
api_scenario_module_id = #{record.apiScenarioModuleId,jdbcType=VARCHAR}, api_scenario_module_id = #{record.apiScenarioModuleId,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR}, module_path = #{record.modulePath,jdbcType=VARCHAR},
@ -414,8 +414,8 @@
<if test="projectId != null"> <if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
</if> </if>
<if test="tagId != null"> <if test="tags != null">
tag_id = #{tagId,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR},
</if> </if>
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
@ -474,7 +474,7 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
update api_scenario update api_scenario
set project_id = #{projectId,jdbcType=VARCHAR}, set project_id = #{projectId,jdbcType=VARCHAR},
tag_id = #{tagId,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
api_scenario_module_id = #{apiScenarioModuleId,jdbcType=VARCHAR}, api_scenario_module_id = #{apiScenarioModuleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR}, module_path = #{modulePath,jdbcType=VARCHAR},
@ -497,7 +497,7 @@
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiScenario"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiScenario">
update api_scenario update api_scenario
set project_id = #{projectId,jdbcType=VARCHAR}, set project_id = #{projectId,jdbcType=VARCHAR},
tag_id = #{tagId,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
api_scenario_module_id = #{apiScenarioModuleId,jdbcType=VARCHAR}, api_scenario_module_id = #{apiScenarioModuleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR}, module_path = #{modulePath,jdbcType=VARCHAR},

View File

@ -1,31 +0,0 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiTag;
import io.metersphere.base.domain.ApiTagExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ApiTagMapper {
long countByExample(ApiTagExample example);
int deleteByExample(ApiTagExample example);
int deleteByPrimaryKey(String id);
int insert(ApiTag record);
int insertSelective(ApiTag record);
List<ApiTag> selectByExample(ApiTagExample example);
ApiTag selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiTag record, @Param("example") ApiTagExample example);
int updateByExample(@Param("record") ApiTag record, @Param("example") ApiTagExample example);
int updateByPrimaryKeySelective(ApiTag record);
int updateByPrimaryKey(ApiTag record);
}

View File

@ -1,228 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ApiTagMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTag">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, user_id, create_time, update_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTagExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_tag
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from api_tag
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from api_tag
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTagExample">
delete from api_tag
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTag">
insert into api_tag (id, project_id, `name`,
user_id, create_time, update_time
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTag">
insert into api_tag
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="userId != null">
user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTagExample" resultType="java.lang.Long">
select count(*) from api_tag
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_tag
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_tag
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiTag">
update api_tag
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTag">
update api_tag
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -9,7 +9,7 @@
</resultMap> </resultMap>
<select id="list" resultMap="BaseResultMap"> <select id="list" resultMap="BaseResultMap">
select api_scenario.id, api_scenario.project_id, api_scenario.tag_id, api_scenario.user_id, select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id,
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level, api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people, api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id, api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
@ -62,7 +62,7 @@
</select> </select>
<select id="selectByTagId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs"> <select id="selectByTagId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
select * from api_scenario where tag_id like CONCAT('%', #{id},'%') select * from api_scenario where tags like CONCAT('%', #{id},'%')
</select> </select>
<select id="selectIds" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs"> <select id="selectIds" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">

View File

@ -1,11 +0,0 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.automation.ApiTagRequest;
import io.metersphere.base.domain.ApiTag;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtApiTagMapper {
List<ApiTag> list(@Param("request") ApiTagRequest request);
}

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiTagMapper">
<select id="list" resultType="io.metersphere.base.domain.ApiTag">
select * from api_tag
<where>
<if test="request.name != null">
and api_tag.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.projectId != null">
AND api_tag.project_id = #{request.projectId}
</if>
<if test="request.id != null">
AND api_tag.id = #{request.id}
</if>
<if test="request.userId != null">
AND api_tag.user_id = #{request.userId}
</if>
</where>
</select>
</mapper>

View File

@ -59,13 +59,3 @@ CREATE TABLE `api_scenario_report_detail` (
`content` longblob COMMENT 'Report Content', `content` longblob COMMENT 'Report Content',
PRIMARY KEY (`report_id`) PRIMARY KEY (`report_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `api_tag` (
`id` varchar(50) NOT NULL COMMENT 'Test ID',
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
`name` varchar(200) NOT NULL COMMENT 'api tag',
`user_id` varchar(64) DEFAULT NULL COMMENT 'User ID',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -0,0 +1 @@
ALTER TABLE api_scenario CHANGE tag_id tags varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'tag list';

View File

@ -64,7 +64,7 @@
<!--要生成的数据库表 --> <!--要生成的数据库表 -->
<table tableName="api_definition_exec_result"/> <table tableName="api_scenario"/>
<!--<table tableName="test_plan_api_scenario"/>--> <!--<table tableName="test_plan_api_scenario"/>-->
<!--<table tableName="test_plan"/>--> <!--<table tableName="test_plan"/>-->
<!--<table tableName="api_scenario_report"/>--> <!--<table tableName="api_scenario_report"/>-->

View File

@ -17,29 +17,30 @@
"@fortawesome/vue-fontawesome": "^0.1.9", "@fortawesome/vue-fontawesome": "^0.1.9",
"axios": "^0.19.0", "axios": "^0.19.0",
"core-js": "^3.4.3", "core-js": "^3.4.3",
"diffable-html": "^4.0.0",
"echarts": "^4.6.0", "echarts": "^4.6.0",
"el-table-infinite-scroll": "^1.0.10",
"element-ui": "^2.13.0", "element-ui": "^2.13.0",
"html2canvas": "^1.0.0-rc.7",
"js-base64": "^3.4.4",
"json-bigint": "^1.0.0",
"jsoneditor": "^9.1.2",
"jspdf": "^2.1.1",
"md5": "^2.3.0",
"mockjs": "^1.1.0",
"nprogress": "^0.2.0",
"sha.js": "^2.4.11",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-calendar-heatmap": "^0.8.4",
"vue-echarts": "^4.1.0", "vue-echarts": "^4.1.0",
"vue-i18n": "^8.15.3", "vue-i18n": "^8.15.3",
"vue-input-tag": "^2.0.7",
"vue-pdf": "^4.2.0",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuedraggable": "^2.23.2", "vuedraggable": "^2.23.2",
"vuex": "^3.1.2", "vuex": "^3.1.2",
"vue-calendar-heatmap": "^0.8.4",
"mockjs": "^1.1.0",
"md5": "^2.3.0",
"sha.js": "^2.4.11",
"js-base64": "^3.4.4",
"json-bigint": "^1.0.0",
"html2canvas": "^1.0.0-rc.7",
"jspdf": "^2.1.1",
"yan-progress": "^1.0.3",
"nprogress": "^0.2.0",
"el-table-infinite-scroll": "^1.0.10",
"vue-pdf": "^4.2.0",
"diffable-html": "^4.0.0",
"xml-js": "^1.6.11", "xml-js": "^1.6.11",
"jsoneditor": "^9.1.2" "yan-progress": "^1.0.3"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0", "@vue/cli-plugin-babel": "^4.1.0",

View File

@ -1,126 +0,0 @@
<template>
<el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.create_tag')" :visible.sync="visible"
width="45%"
:destroy-on-close="true">
<el-form :model="tagForm" label-position="right" label-width="80px" size="small" :rules="rule" ref="tagForm">
<el-form-item :label="$t('commons.name')" prop="name">
<el-row>
<el-col :span="20">
<el-input v-model="tagForm.name" autocomplete="off" :placeholder="$t('commons.name')"/>
</el-col>
<el-col :span="4">
<el-button style="margin-left: 20px" @click="saveTag">{{$t('commons.save')}}</el-button>
</el-col>
</el-row>
</el-form-item>
</el-form>
<el-table :data="tagData" row-key="id">
<el-table-column prop="name" :label="$t('commons.name')" show-overflow-tooltip/>
<el-table-column :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope">
<el-button type="text" @click="editApi(scope.row)">{{$t('commons.edit')}}</el-button>
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button>
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<template v-slot:footer>
<ms-dialog-footer
@cancel="confirm"
@confirm="confirm">
</ms-dialog-footer>
</template>
</el-dialog>
</template>
<script>
import {WORKSPACE_ID} from '@/common/js/constants';
import {getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import MsTablePagination from "../../../common/pagination/TablePagination";
export default {
name: "MsAddTag",
components: {MsDialogFooter, MsTablePagination},
props: {},
data() {
return {
tagForm: {},
visible: false,
currentModule: {},
projectId: "",
userOptions: [],
currentPage: 1,
pageSize: 10,
total: 0,
tagData: [],
path: "/api/tag/create",
rule: {
name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
],
principal: [{
required: true,
message: this.$t('api_test.automation.scenario.select_principal'),
trigger: 'change'
}],
},
}
},
methods: {
saveTag() {
if (this.tagForm.id != undefined && this.tagForm.id != null) {
this.path = "/api/tag/update";
} else {
this.path = "/api/tag/create";
this.tagForm.id = getUUID();
}
this.$refs['tagForm'].validate((valid) => {
if (valid) {
this.setParameter();
this.result = this.$post(this.path, this.tagForm, () => {
this.$success(this.$t('commons.save_success'));
this.initTable();
this.tagForm = {};
});
} else {
return false;
}
})
},
setParameter() {
this.tagForm.projectId = this.projectId;
},
open() {
this.projectId = getCurrentProjectID();
this.visible = true;
this.initTable();
},
initTable() {
let condition = {};
condition.projectId = this.projectId;
this.result = this.$post("/api/tag/getTgas/" + this.currentPage + "/" + this.pageSize, condition, response => {
this.total = response.data.itemCount;
this.tagData = response.data.listObject;
});
},
editApi(row) {
this.tagForm = row;
},
handleDelete(row) {
this.result = this.$get("/api/tag/delete/" + row.id, response => {
this.$success(this.$t('commons.delete_success'));
this.initTable();
});
},
confirm() {
this.visible = false
this.$emit('refreshTags');
}
}
}
</script>

View File

@ -25,9 +25,9 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" width="200px"> <el-table-column prop="tags" :label="$t('api_test.automation.tag')" width="200px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<div v-for="itemName in scope.row.tagNames" :key="itemName"> <div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/> <ms-tag type="success" effect="plain" :content="itemName"/>
</div> </div>
</template> </template>
@ -167,6 +167,11 @@
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
})
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -79,25 +79,8 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="Tag" prop="tagId"> <el-form-item label="Tag" prop="tags">
<el-select v-model="currentScenario.tagId" size="small" class="ms-scenario-input" placeholder="Tag" :multiple="true"> <ms-input-tag :currentScenario="currentScenario" ref="tag"/>
<el-option
v-for="item in tags"
:key="item.id"
:label="item.name"
:value="item.id"/>
<el-button size="mini" type="primary" @click="openTagConfig" class="ms-scenario-button">
{{ $t('api_test.automation.create_tag') }}
</el-button>
<template v-slot:empty>
<div>
<el-button size="mini" type="primary" @click="openTagConfig" class="ms-scenario-button">
{{ $t('api_test.automation.create_tag') }}
</el-button>
</div>
</template>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -259,8 +242,6 @@
<!-- 环境 --> <!-- 环境 -->
<api-environment-config ref="environmentConfig" @close="environmentConfigClose"/> <api-environment-config ref="environmentConfig" @close="environmentConfigClose"/>
<!--TAG-->
<ms-add-tag @refreshTags="refreshTags" ref="tag"/>
<!--执行组件--> <!--执行组件-->
<ms-run :debug="true" :environment="currentEnvironmentId" :reportId="reportId" :run-data="debugData" <ms-run :debug="true" :environment="currentEnvironmentId" :reportId="reportId" :run-data="debugData"
@runRefresh="runRefresh" ref="runTest"/> @runRefresh="runRefresh" ref="runTest"/>
@ -293,13 +274,14 @@
import MsApiCustomize from "./ApiCustomize"; import MsApiCustomize from "./ApiCustomize";
import {getUUID, getCurrentProjectID} from "@/common/js/utils"; import {getUUID, getCurrentProjectID} from "@/common/js/utils";
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig"; import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
import MsAddTag from "./AddTag"; import MsInputTag from "./MsInputTag";
import MsRun from "./DebugRun"; import MsRun from "./DebugRun";
import MsImportApiScenario from "./ImportApiScenario"; import MsImportApiScenario from "./ImportApiScenario";
import MsApiScenarioComponent from "./ApiScenarioComponent"; import MsApiScenarioComponent from "./ApiScenarioComponent";
import MsApiReportDetail from "../report/ApiReportDetail"; import MsApiReportDetail from "../report/ApiReportDetail";
import MsScenarioParameters from "./ScenarioParameters"; import MsScenarioParameters from "./ScenarioParameters";
import ApiImport from "../../definition/components/import/ApiImport"; import ApiImport from "../../definition/components/import/ApiImport";
import InputTag from 'vue-input-tag'
export default { export default {
name: "EditApiScenario", name: "EditApiScenario",
@ -311,7 +293,7 @@
ApiEnvironmentConfig, ApiEnvironmentConfig,
MsScenarioParameters, MsScenarioParameters,
MsApiReportDetail, MsApiReportDetail,
MsAddTag, MsRun, MsInputTag, MsRun,
MsApiScenarioComponent, MsApiScenarioComponent,
MsImportApiScenario, MsImportApiScenario,
MsJsr233Processor, MsJsr233Processor,
@ -323,6 +305,7 @@
MsApiComponent, MsApiComponent,
MsApiCustomize, MsApiCustomize,
ApiImport, ApiImport,
InputTag,
}, },
data() { data() {
return { return {
@ -341,7 +324,6 @@
principal: [{required: true, message: this.$t('api_test.definition.request.responsible'), trigger: 'change'}], principal: [{required: true, message: this.$t('api_test.definition.request.responsible'), trigger: 'change'}],
}, },
environments: [], environments: [],
tags: [],
currentEnvironmentId: "", currentEnvironmentId: "",
maintainerOptions: [], maintainerOptions: [],
value: API_STATUS[0].id, value: API_STATUS[0].id,
@ -366,7 +348,8 @@
visibleRef: "", visibleRef: "",
enableCookieShare: false, enableCookieShare: false,
} }
}, }
,
created() { created() {
if (!this.currentScenario.apiScenarioModuleId) { if (!this.currentScenario.apiScenarioModuleId) {
this.currentScenario.apiScenarioModuleId = ""; this.currentScenario.apiScenarioModuleId = "";
@ -374,11 +357,12 @@
this.projectId = getCurrentProjectID(); this.projectId = getCurrentProjectID();
this.operatingElements = ELEMENTS.get("ALL"); this.operatingElements = ELEMENTS.get("ALL");
this.getMaintainerOptions(); this.getMaintainerOptions();
this.refreshTags();
this.getApiScenario(); this.getApiScenario();
this.getEnvironments(); this.getEnvironments();
}, }
watch: {}, ,
watch: {}
,
methods: { methods: {
addComponent(type) { addComponent(type) {
switch (type) { switch (type) {
@ -423,7 +407,8 @@
} }
this.sort(); this.sort();
this.reload(); this.reload();
}, }
,
nodeClick(e) { nodeClick(e) {
if (e.referenced != 'REF' && e.referenced != 'Deleted') { if (e.referenced != 'REF' && e.referenced != 'Deleted') {
this.operatingElements = ELEMENTS.get(e.type); this.operatingElements = ELEMENTS.get(e.type);
@ -431,16 +416,19 @@
this.operatingElements = []; this.operatingElements = [];
} }
this.selectedTreeNode = e; this.selectedTreeNode = e;
}, }
,
showAll() { showAll() {
this.operatingElements = ELEMENTS.get("ALL"); this.operatingElements = ELEMENTS.get("ALL");
this.selectedTreeNode = undefined; this.selectedTreeNode = undefined;
this.reload(); this.reload();
}, }
,
apiListImport() { apiListImport() {
this.visibleRef = getUUID(); this.visibleRef = getUUID();
this.apiListVisible = true; this.apiListVisible = true;
}, }
,
recursiveSorting(arr) { recursiveSorting(arr) {
for (let i in arr) { for (let i in arr) {
arr[i].index = Number(i) + 1; arr[i].index = Number(i) + 1;
@ -448,7 +436,8 @@
this.recursiveSorting(arr[i].hashTree); this.recursiveSorting(arr[i].hashTree);
} }
} }
}, }
,
sort() { sort() {
for (let i in this.scenarioDefinition) { for (let i in this.scenarioDefinition) {
this.scenarioDefinition[i].index = Number(i) + 1; this.scenarioDefinition[i].index = Number(i) + 1;
@ -456,7 +445,8 @@
this.recursiveSorting(this.scenarioDefinition[i].hashTree); this.recursiveSorting(this.scenarioDefinition[i].hashTree);
} }
} }
}, }
,
addCustomizeApi(request) { addCustomizeApi(request) {
this.customizeVisible = false; this.customizeVisible = false;
request.enable === undefined ? request.enable = true : request.enable; request.enable === undefined ? request.enable = true : request.enable;
@ -468,7 +458,8 @@
this.customizeRequest = {}; this.customizeRequest = {};
this.sort(); this.sort();
this.reload(); this.reload();
}, }
,
addScenario(arr) { addScenario(arr) {
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
arr.forEach(item => { arr.forEach(item => {
@ -483,7 +474,8 @@
this.sort(); this.sort();
this.reload(); this.reload();
this.scenarioVisible = false; this.scenarioVisible = false;
}, }
,
setApiParameter(item, refType, referenced) { setApiParameter(item, refType, referenced) {
let request = {}; let request = {};
if (Object.prototype.toString.call(item.request).indexOf("String") > 0) { if (Object.prototype.toString.call(item.request).indexOf("String") > 0) {
@ -512,7 +504,8 @@
} else { } else {
this.scenarioDefinition.push(request); this.scenarioDefinition.push(request);
} }
}, }
,
pushApiOrCase(referenced) { pushApiOrCase(referenced) {
if (this.currentRow.cases.length === 0 && this.currentRow.apis.length === 0) { if (this.currentRow.cases.length === 0 && this.currentRow.apis.length === 0) {
this.$warning(this.$t('api_test.automation.reference_info')); this.$warning(this.$t('api_test.automation.reference_info'));
@ -529,13 +522,15 @@
this.currentRow.apis = []; this.currentRow.apis = [];
this.sort(); this.sort();
this.reload(); this.reload();
}, }
,
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID); let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => { this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });
}, }
,
openTagConfig() { openTagConfig() {
if (!this.projectId) { if (!this.projectId) {
this.$error(this.$t('api_test.select_project')); this.$error(this.$t('api_test.select_project'));
@ -543,20 +538,6 @@
} }
this.$refs.tag.open(); this.$refs.tag.open();
}, },
refreshTags() {
let obj = {projectId: this.projectId};
let tagIds = [];
this.$post('/api/tag/list', obj, response => {
this.tags = response.data;
this.tags.forEach(item => {
tagIds.push(item.id);
})
if (this.currentScenario.tagId != undefined && this.currentScenario.tagId.length > 0) {
this.currentScenario.tagId = this.currentScenario.tagId.filter(id => tagIds.indexOf(id) != -1);
}
});
},
remove(row, node) { remove(row, node) {
const parent = node.parent const parent = node.parent
const hashTree = parent.data.hashTree || parent.data; const hashTree = parent.data.hashTree || parent.data;
@ -564,7 +545,8 @@
hashTree.splice(index, 1); hashTree.splice(index, 1);
this.sort(); this.sort();
this.reload(); this.reload();
}, }
,
copyRow(row, node) { copyRow(row, node) {
const parent = node.parent const parent = node.parent
const hashTree = parent.data.hashTree || parent.data; const hashTree = parent.data.hashTree || parent.data;
@ -574,13 +556,15 @@
hashTree.push(obj); hashTree.push(obj);
this.sort(); this.sort();
this.reload(); this.reload();
}, }
,
reload() { reload() {
this.loading = true this.loading = true
this.$nextTick(() => { this.$nextTick(() => {
this.loading = false this.loading = false
}) })
}, }
,
runDebug() { runDebug() {
/*触发执行操作*/ /*触发执行操作*/
if (!this.currentEnvironmentId) { if (!this.currentEnvironmentId) {
@ -593,7 +577,8 @@
environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
}; };
this.reportId = getUUID().substring(0, 8); this.reportId = getUUID().substring(0, 8);
}, }
,
getEnvironments() { getEnvironments() {
if (this.projectId) { if (this.projectId) {
this.$get('/api/environment/list/' + this.projectId, response => { this.$get('/api/environment/list/' + this.projectId, response => {
@ -603,17 +588,20 @@
}); });
}); });
} }
}, }
,
openEnvironmentConfig() { openEnvironmentConfig() {
if (!this.projectId) { if (!this.projectId) {
this.$error(this.$t('api_test.select_project')); this.$error(this.$t('api_test.select_project'));
return; return;
} }
this.$refs.environmentConfig.open(this.projectId); this.$refs.environmentConfig.open(this.projectId);
}, }
,
environmentConfigClose() { environmentConfigClose() {
this.getEnvironments(); this.getEnvironments();
}, }
,
allowDrop(draggingNode, dropNode, dropType) { allowDrop(draggingNode, dropNode, dropType) {
if (dropType != "inner") { if (dropType != "inner") {
return true; return true;
@ -622,21 +610,25 @@
return true; return true;
} }
return false; return false;
}, }
,
allowDrag(draggingNode, dropNode, dropType) { allowDrag(draggingNode, dropNode, dropType) {
this.sort(); this.sort();
this.reload(); this.reload();
}, }
,
nodeExpand(data) { nodeExpand(data) {
if (data.resourceId) { if (data.resourceId) {
this.expandedNode.push(data.resourceId); this.expandedNode.push(data.resourceId);
} }
}, }
,
nodeCollapse(data) { nodeCollapse(data) {
if (data.resourceId) { if (data.resourceId) {
this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1); this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1);
} }
}, }
,
getPath(id) { getPath(id) {
if (id === null) { if (id === null) {
return null; return null;
@ -645,7 +637,8 @@
return item.id === id ? item.path : ""; return item.id === id ? item.path : "";
}); });
return path[0].path; return path[0].path;
}, }
,
setFiles(item, bodyUploadFiles, obj) { setFiles(item, bodyUploadFiles, obj) {
if (item.body) { if (item.body) {
if (item.body.kvs) { if (item.body.kvs) {
@ -683,7 +676,8 @@
}); });
} }
} }
}, }
,
recursiveFile(arr, bodyUploadFiles, obj) { recursiveFile(arr, bodyUploadFiles, obj) {
arr.forEach(item => { arr.forEach(item => {
this.setFiles(item, bodyUploadFiles, obj); this.setFiles(item, bodyUploadFiles, obj);
@ -691,7 +685,8 @@
this.recursiveFile(item.hashTree, bodyUploadFiles, obj); this.recursiveFile(item.hashTree, bodyUploadFiles, obj);
} }
}); });
}, }
,
getBodyUploadFiles(obj) { getBodyUploadFiles(obj) {
let bodyUploadFiles = []; let bodyUploadFiles = [];
obj.bodyUploadIds = []; obj.bodyUploadIds = [];
@ -702,7 +697,8 @@
} }
}) })
return bodyUploadFiles; return bodyUploadFiles;
}, }
,
editScenario() { editScenario() {
this.$refs['currentScenario'].validate((valid) => { this.$refs['currentScenario'].validate((valid) => {
if (valid) { if (valid) {
@ -714,15 +710,18 @@
if (response.data) { if (response.data) {
this.currentScenario.id = response.data.id; this.currentScenario.id = response.data.id;
} }
this.currentScenario.tagId = JSON.parse(this.currentScenario.tagId); if (this.currentScenario.tags instanceof String) {
this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
}
this.$emit('refresh'); this.$emit('refresh');
}) })
} }
}) })
}, }
,
getApiScenario() { getApiScenario() {
if (this.currentScenario.tagId != undefined && !(this.currentScenario.tagId instanceof Array)) { if (this.currentScenario.tags != undefined && !(this.currentScenario.tags instanceof Array)) {
this.currentScenario.tagId = JSON.parse(this.currentScenario.tagId); this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
} }
if (this.currentScenario.id) { if (this.currentScenario.id) {
this.result = this.$get("/api/automation/getApiScenario/" + this.currentScenario.id, response => { this.result = this.$get("/api/automation/getApiScenario/" + this.currentScenario.id, response => {
@ -743,7 +742,8 @@
} }
}) })
} }
}, }
,
setParameter() { setParameter() {
this.currentScenario.stepTotal = this.scenarioDefinition.length; this.currentScenario.stepTotal = this.scenarioDefinition.length;
this.currentScenario.projectId = getCurrentProjectID(); this.currentScenario.projectId = getCurrentProjectID();
@ -754,26 +754,30 @@
type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
}; };
this.currentScenario.scenarioDefinition = scenario; this.currentScenario.scenarioDefinition = scenario;
if (this.currentScenario.tagId instanceof Array) { if (this.currentScenario.tags instanceof Array) {
this.currentScenario.tagId = JSON.stringify(this.currentScenario.tagId); this.currentScenario.tags = JSON.stringify(this.currentScenario.tags);
} }
if (this.currentModule != null) { if (this.currentModule != null) {
this.currentScenario.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null; this.currentScenario.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null;
this.currentScenario.apiScenarioModuleId = this.currentModule.id; this.currentScenario.apiScenarioModuleId = this.currentModule.id;
} }
this.currentScenario.projectId = this.projectId; this.currentScenario.projectId = this.projectId;
}, }
,
runRefresh() { runRefresh() {
this.debugVisible = true; this.debugVisible = true;
this.loading = false; this.loading = false;
}, }
,
showScenarioParameters() { showScenarioParameters() {
this.$refs.scenarioParameters.open(this.currentScenario.variables); this.$refs.scenarioParameters.open(this.currentScenario.variables);
}, }
,
addParameters(data) { addParameters(data) {
this.currentScenario.variables = data; this.currentScenario.variables = data;
this.reload(); this.reload();
}, }
,
apiImport(importData) { apiImport(importData) {
if (importData && importData.data) { if (importData && importData.data) {
importData.data.forEach(item => { importData.data.forEach(item => {
@ -939,4 +943,9 @@
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
font-size: 13px; font-size: 13px;
} }
/deep/ .el-form-item__content {
line-height: 100%;
}
</style> </style>

View File

@ -0,0 +1,69 @@
<template>
<input-tag v-model="data"></input-tag>
</template>
<script>
import InputTag from 'vue-input-tag'
export default {
name: "MsInputTag",
components: {InputTag},
props: {currentScenario: {}},
created() {
if (!this.currentScenario.tags) {
this.currentScenario.tags = [];
}
console.log(this.currentScenario.tags)
this.data = this.currentScenario.tags;
},
data() {
return {
data: [],
}
},
watch: {
data() {
this.currentScenario.tags = this.data;
}
},
methods: {}
}
</script>
<style scoped>
/deep/ .vue-input-tag-wrapper {
border-radius: 2px;
border: 1px solid #a5d24a;
color: #909399;
display: inline-block;
}
/deep/ .input-tag {
display: inline-block;
font-size: 12px;
min-width: auto;
border-width: 1px;
border-style: solid;
border-radius: 4px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
white-space: nowrap;
background-color: #fff;
border-color: #909399;
color: #909399;
width: auto;
height: 23px;
padding: 0 5px;
line-height: 19px;
}
/deep/ .remove {
color: #909399;
}
/deep/ .el-form-item__content {
line-height: 100%;
}
</style>

View File

@ -2,7 +2,7 @@
<div id="menu-bar"> <div id="menu-bar">
<el-row type="flex"> <el-row type="flex">
<project-change :project-name="currentProject"/> <project-change :project-name="currentProject"/>
<el-col :span="12"> <el-col :span="9">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'> <el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
<el-menu-item :index="'/performance/home'"> <el-menu-item :index="'/performance/home'">
{{ $t("i18n.home") }} {{ $t("i18n.home") }}
@ -32,7 +32,7 @@
<ms-create-test :to="'/performance/test/create'"/> <ms-create-test :to="'/performance/test/create'"/>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="10"/> <el-col :span="11"/>
</el-row> </el-row>
</div> </div>
</template> </template>