Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
74417e6bec
|
@ -0,0 +1,49 @@
|
|||
package io.metersphere.api.controller;
|
||||
|
||||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
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/environment")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||
public class ApiTestEnvironmentController {
|
||||
|
||||
@Resource
|
||||
ApiTestEnvironmentService apiTestEnvironmentService;
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiTestEnvironmentWithBLOBs> list(@PathVariable String projectId) {
|
||||
return apiTestEnvironmentService.list(projectId);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
public ApiTestEnvironmentWithBLOBs get(@PathVariable String id) {
|
||||
return apiTestEnvironmentService.get(id);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
|
||||
public String add(@RequestBody ApiTestEnvironmentWithBLOBs apiTestEnvironmentWithBLOBs) {
|
||||
return apiTestEnvironmentService.add(apiTestEnvironmentWithBLOBs);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
|
||||
public void update(@RequestBody ApiTestEnvironmentWithBLOBs apiTestEnvironment) {
|
||||
apiTestEnvironmentService.update(apiTestEnvironment);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
|
||||
public void delete(@PathVariable String id) {
|
||||
apiTestEnvironmentService.delete(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentExample;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.base.mapper.ApiTestEnvironmentMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiTestEnvironmentService {
|
||||
|
||||
@Resource
|
||||
private ApiTestEnvironmentMapper apiTestEnvironmentMapper;
|
||||
|
||||
public List<ApiTestEnvironmentWithBLOBs> list(String projectId) {
|
||||
ApiTestEnvironmentExample example =new ApiTestEnvironmentExample();
|
||||
example.createCriteria().andProjectIdEqualTo(projectId);
|
||||
return apiTestEnvironmentMapper.selectByExampleWithBLOBs(example);
|
||||
}
|
||||
|
||||
public ApiTestEnvironmentWithBLOBs get(String id) {
|
||||
return apiTestEnvironmentMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
apiTestEnvironmentMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void update(ApiTestEnvironmentWithBLOBs apiTestEnvironment) {
|
||||
apiTestEnvironmentMapper.updateByPrimaryKeySelective(apiTestEnvironment);
|
||||
}
|
||||
|
||||
public String add(ApiTestEnvironmentWithBLOBs apiTestEnvironmentWithBLOBs) {
|
||||
apiTestEnvironmentWithBLOBs.setId(UUID.randomUUID().toString());
|
||||
apiTestEnvironmentMapper.insert(apiTestEnvironmentWithBLOBs);
|
||||
return apiTestEnvironmentWithBLOBs.getId();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiTestEnvironment implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String protocol;
|
||||
|
||||
private String socket;
|
||||
|
||||
private String domain;
|
||||
|
||||
private Integer port;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,680 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ApiTestEnvironmentExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public ApiTestEnvironmentExample() {
|
||||
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 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 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 andProtocolIsNull() {
|
||||
addCriterion("protocol is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolIsNotNull() {
|
||||
addCriterion("protocol is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolEqualTo(String value) {
|
||||
addCriterion("protocol =", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolNotEqualTo(String value) {
|
||||
addCriterion("protocol <>", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolGreaterThan(String value) {
|
||||
addCriterion("protocol >", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("protocol >=", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolLessThan(String value) {
|
||||
addCriterion("protocol <", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolLessThanOrEqualTo(String value) {
|
||||
addCriterion("protocol <=", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolLike(String value) {
|
||||
addCriterion("protocol like", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolNotLike(String value) {
|
||||
addCriterion("protocol not like", value, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolIn(List<String> values) {
|
||||
addCriterion("protocol in", values, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolNotIn(List<String> values) {
|
||||
addCriterion("protocol not in", values, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolBetween(String value1, String value2) {
|
||||
addCriterion("protocol between", value1, value2, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andProtocolNotBetween(String value1, String value2) {
|
||||
addCriterion("protocol not between", value1, value2, "protocol");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketIsNull() {
|
||||
addCriterion("socket is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketIsNotNull() {
|
||||
addCriterion("socket is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketEqualTo(String value) {
|
||||
addCriterion("socket =", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketNotEqualTo(String value) {
|
||||
addCriterion("socket <>", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketGreaterThan(String value) {
|
||||
addCriterion("socket >", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("socket >=", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketLessThan(String value) {
|
||||
addCriterion("socket <", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketLessThanOrEqualTo(String value) {
|
||||
addCriterion("socket <=", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketLike(String value) {
|
||||
addCriterion("socket like", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketNotLike(String value) {
|
||||
addCriterion("socket not like", value, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketIn(List<String> values) {
|
||||
addCriterion("socket in", values, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketNotIn(List<String> values) {
|
||||
addCriterion("socket not in", values, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketBetween(String value1, String value2) {
|
||||
addCriterion("socket between", value1, value2, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSocketNotBetween(String value1, String value2) {
|
||||
addCriterion("socket not between", value1, value2, "socket");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainIsNull() {
|
||||
addCriterion("`domain` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainIsNotNull() {
|
||||
addCriterion("`domain` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainEqualTo(String value) {
|
||||
addCriterion("`domain` =", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainNotEqualTo(String value) {
|
||||
addCriterion("`domain` <>", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainGreaterThan(String value) {
|
||||
addCriterion("`domain` >", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`domain` >=", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainLessThan(String value) {
|
||||
addCriterion("`domain` <", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainLessThanOrEqualTo(String value) {
|
||||
addCriterion("`domain` <=", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainLike(String value) {
|
||||
addCriterion("`domain` like", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainNotLike(String value) {
|
||||
addCriterion("`domain` not like", value, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainIn(List<String> values) {
|
||||
addCriterion("`domain` in", values, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainNotIn(List<String> values) {
|
||||
addCriterion("`domain` not in", values, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainBetween(String value1, String value2) {
|
||||
addCriterion("`domain` between", value1, value2, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDomainNotBetween(String value1, String value2) {
|
||||
addCriterion("`domain` not between", value1, value2, "domain");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortIsNull() {
|
||||
addCriterion("port is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortIsNotNull() {
|
||||
addCriterion("port is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortEqualTo(Integer value) {
|
||||
addCriterion("port =", value, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortNotEqualTo(Integer value) {
|
||||
addCriterion("port <>", value, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortGreaterThan(Integer value) {
|
||||
addCriterion("port >", value, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("port >=", value, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortLessThan(Integer value) {
|
||||
addCriterion("port <", value, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("port <=", value, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortIn(List<Integer> values) {
|
||||
addCriterion("port in", values, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortNotIn(List<Integer> values) {
|
||||
addCriterion("port not in", values, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortBetween(Integer value1, Integer value2) {
|
||||
addCriterion("port between", value1, value2, "port");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPortNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("port not between", value1, value2, "port");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ApiTestEnvironmentWithBLOBs extends ApiTestEnvironment implements Serializable {
|
||||
private String variables;
|
||||
|
||||
private String headers;
|
||||
|
||||
private String customData;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.ApiTestEnvironment;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentExample;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ApiTestEnvironmentMapper {
|
||||
long countByExample(ApiTestEnvironmentExample example);
|
||||
|
||||
int deleteByExample(ApiTestEnvironmentExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(ApiTestEnvironmentWithBLOBs record);
|
||||
|
||||
int insertSelective(ApiTestEnvironmentWithBLOBs record);
|
||||
|
||||
List<ApiTestEnvironmentWithBLOBs> selectByExampleWithBLOBs(ApiTestEnvironmentExample example);
|
||||
|
||||
List<ApiTestEnvironment> selectByExample(ApiTestEnvironmentExample example);
|
||||
|
||||
ApiTestEnvironmentWithBLOBs selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") ApiTestEnvironmentWithBLOBs record, @Param("example") ApiTestEnvironmentExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") ApiTestEnvironmentWithBLOBs record, @Param("example") ApiTestEnvironmentExample example);
|
||||
|
||||
int updateByExample(@Param("record") ApiTestEnvironment record, @Param("example") ApiTestEnvironmentExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(ApiTestEnvironmentWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(ApiTestEnvironmentWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(ApiTestEnvironment record);
|
||||
}
|
|
@ -0,0 +1,336 @@
|
|||
<?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.ApiTestEnvironmentMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestEnvironment">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
|
||||
<result column="socket" jdbcType="VARCHAR" property="socket" />
|
||||
<result column="domain" jdbcType="VARCHAR" property="domain" />
|
||||
<result column="port" jdbcType="INTEGER" property="port" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
|
||||
<result column="variables" jdbcType="LONGVARCHAR" property="variables" />
|
||||
<result column="headers" jdbcType="LONGVARCHAR" property="headers" />
|
||||
<result column="custom_data" jdbcType="LONGVARCHAR" property="customData" />
|
||||
</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, `name`, project_id, protocol, socket, `domain`, port
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
`variables`, headers, custom_data
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestEnvironmentExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from api_test_environment
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestEnvironmentExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from api_test_environment
|
||||
<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="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from api_test_environment
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from api_test_environment
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestEnvironmentExample">
|
||||
delete from api_test_environment
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
|
||||
insert into api_test_environment (id, `name`, project_id,
|
||||
protocol, socket, `domain`,
|
||||
port, `variables`, headers,
|
||||
custom_data)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
|
||||
#{protocol,jdbcType=VARCHAR}, #{socket,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR},
|
||||
#{port,jdbcType=INTEGER}, #{variables,jdbcType=LONGVARCHAR}, #{headers,jdbcType=LONGVARCHAR},
|
||||
#{customData,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
|
||||
insert into api_test_environment
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="protocol != null">
|
||||
protocol,
|
||||
</if>
|
||||
<if test="socket != null">
|
||||
socket,
|
||||
</if>
|
||||
<if test="domain != null">
|
||||
`domain`,
|
||||
</if>
|
||||
<if test="port != null">
|
||||
port,
|
||||
</if>
|
||||
<if test="variables != null">
|
||||
`variables`,
|
||||
</if>
|
||||
<if test="headers != null">
|
||||
headers,
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
custom_data,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
#{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="protocol != null">
|
||||
#{protocol,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="socket != null">
|
||||
#{socket,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="domain != null">
|
||||
#{domain,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="port != null">
|
||||
#{port,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="variables != null">
|
||||
#{variables,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="headers != null">
|
||||
#{headers,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
#{customData,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestEnvironmentExample" resultType="java.lang.Long">
|
||||
select count(*) from api_test_environment
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update api_test_environment
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.projectId != null">
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.protocol != null">
|
||||
protocol = #{record.protocol,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.socket != null">
|
||||
socket = #{record.socket,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.domain != null">
|
||||
`domain` = #{record.domain,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.port != null">
|
||||
port = #{record.port,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.variables != null">
|
||||
`variables` = #{record.variables,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.headers != null">
|
||||
headers = #{record.headers,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.customData != null">
|
||||
custom_data = #{record.customData,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update api_test_environment
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
protocol = #{record.protocol,jdbcType=VARCHAR},
|
||||
socket = #{record.socket,jdbcType=VARCHAR},
|
||||
`domain` = #{record.domain,jdbcType=VARCHAR},
|
||||
port = #{record.port,jdbcType=INTEGER},
|
||||
`variables` = #{record.variables,jdbcType=LONGVARCHAR},
|
||||
headers = #{record.headers,jdbcType=LONGVARCHAR},
|
||||
custom_data = #{record.customData,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update api_test_environment
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
protocol = #{record.protocol,jdbcType=VARCHAR},
|
||||
socket = #{record.socket,jdbcType=VARCHAR},
|
||||
`domain` = #{record.domain,jdbcType=VARCHAR},
|
||||
port = #{record.port,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
|
||||
update api_test_environment
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="protocol != null">
|
||||
protocol = #{protocol,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="socket != null">
|
||||
socket = #{socket,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="domain != null">
|
||||
`domain` = #{domain,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="port != null">
|
||||
port = #{port,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="variables != null">
|
||||
`variables` = #{variables,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="headers != null">
|
||||
headers = #{headers,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
custom_data = #{customData,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
|
||||
update api_test_environment
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
protocol = #{protocol,jdbcType=VARCHAR},
|
||||
socket = #{socket,jdbcType=VARCHAR},
|
||||
`domain` = #{domain,jdbcType=VARCHAR},
|
||||
port = #{port,jdbcType=INTEGER},
|
||||
`variables` = #{variables,jdbcType=LONGVARCHAR},
|
||||
headers = #{headers,jdbcType=LONGVARCHAR},
|
||||
custom_data = #{customData,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestEnvironment">
|
||||
update api_test_environment
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
protocol = #{protocol,jdbcType=VARCHAR},
|
||||
socket = #{socket,jdbcType=VARCHAR},
|
||||
`domain` = #{domain,jdbcType=VARCHAR},
|
||||
port = #{port,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,14 @@
|
|||
CREATE TABLE IF NOT EXISTS `api_test_environment` (
|
||||
`id` varchar(50) NOT NULL COMMENT 'Api Test Environment ID',
|
||||
`name` varchar(64) NOT NULL COMMENT 'Api Test Environment Name',
|
||||
`project_id` varchar(50) NOT NULL COMMENT 'Project ID',
|
||||
`protocol` varchar(20) NOT NULL COMMENT 'Api Test Protocol',
|
||||
`socket` varchar(225) NOT NULL COMMENT 'Api Test Socket',
|
||||
`domain` varchar(225) NOT NULL COMMENT 'Api Test Domain',
|
||||
`port` int(10) DEFAULT NULL COMMENT 'Api Test Port',
|
||||
`variables` text DEFAULT NULL COMMENT 'Global ariables',
|
||||
`headers` text DEFAULT NULL COMMENT 'Global Heards',
|
||||
`custom_data` longtext COMMENT 'Custom Data (JSON format)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `project_id` ( `project_id` )
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
|
@ -1,13 +1,11 @@
|
|||
<template>
|
||||
<el-dialog :title="'环境配置'" :visible.sync="visible" class="environment-dialog">
|
||||
<el-container >
|
||||
<ms-aside-item :title="'环境列表'" :data="environments" :add-fuc="addEnvironment" :delete-fuc="deleteEnvironment" @itemSelected="environmentSelected"/>
|
||||
<el-main>
|
||||
|
||||
</el-main>
|
||||
<el-container v-loading="result.loading">
|
||||
<ms-aside-item :title="'环境列表'" :data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
|
||||
:delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/>
|
||||
<environment-edit :environment="currentEnvironment" ref="environmentEdit"/>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -18,37 +16,83 @@
|
|||
import MsAsideContainer from "../../../common/components/MsAsideContainer";
|
||||
import MsMainContainer from "../../../common/components/MsMainContainer";
|
||||
import MsAsideItem from "../../../common/components/MsAsideItem";
|
||||
import EnvironmentEdit from "./environment/EnvironmentEdit";
|
||||
|
||||
export default {
|
||||
name: "ApiEnvironmentConfig",
|
||||
components: {
|
||||
EnvironmentEdit,
|
||||
MsAsideItem,
|
||||
MsMainContainer, MsAsideContainer, MsContainer, MsApiCollapseItem, MsApiCollapse, draggable},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
visible:false,
|
||||
environments: [{name: 'tesddd'}]
|
||||
projectId: '',
|
||||
environments: [],
|
||||
currentEnvironment: {variables: [{}], headers: [{}], protocol: 'https', projectId: this.projectId},
|
||||
environmentOperators: [
|
||||
{
|
||||
icon: 'el-icon-document-copy',
|
||||
func: this.copyEnvironment
|
||||
},
|
||||
{
|
||||
icon: 'el-icon-delete',
|
||||
func: this.deleteEnvironment
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(project) {
|
||||
this.visible = true
|
||||
open(projectId) {
|
||||
this.visible = true;
|
||||
this.projectId = projectId;
|
||||
this.getEnvironments();
|
||||
},
|
||||
deleteEnvironment(environment) {
|
||||
console.log(environment);
|
||||
for (let i = 0; i < this.environments.length; i++) {
|
||||
if (this.environments[i].name === environment.name) {
|
||||
this.environments.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.result = this.$get('/api/environment/delete/' + environment.id, response => {
|
||||
this.$success('删除成功');
|
||||
this.getEnvironments();
|
||||
});
|
||||
},
|
||||
copyEnvironment(environment) {
|
||||
let newEnvironment = {};
|
||||
Object.assign(newEnvironment, environment);
|
||||
newEnvironment.id = null;
|
||||
this.environments.push(newEnvironment);
|
||||
},
|
||||
addEnvironment() {
|
||||
this.environments.push({name: '新建'});
|
||||
console.log('add');
|
||||
this.environments.push(this.getDefaultEnvironment());
|
||||
},
|
||||
environmentSelected() {
|
||||
console.log('select');
|
||||
environmentSelected(environment) {
|
||||
this.getEnvironment(environment);
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.projectId) {
|
||||
this.result = this.$get('/api/environment/list/' + this.projectId, response => {
|
||||
this.environments = response.data;
|
||||
if (this.environments.length > 0) {
|
||||
this.$refs.environmentItems.itemSelected(0, this.environments[0]);
|
||||
} else {
|
||||
let item = this.getDefaultEnvironment();
|
||||
this.environments.push(item);
|
||||
this.$refs.environmentItems.itemSelected(0, item);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
getEnvironment(environment) {
|
||||
let item = environment;
|
||||
if (!(environment.variables instanceof Array)) {
|
||||
item.variables = JSON.parse(environment.variables);
|
||||
}
|
||||
if (!(environment.headers instanceof Array)) {
|
||||
item.headers = JSON.parse(environment.headers);
|
||||
}
|
||||
this.currentEnvironment = item;
|
||||
},
|
||||
getDefaultEnvironment() {
|
||||
return {variables: [{}], headers: [{}], protocol: 'https', projectId: this.projectId};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +104,15 @@
|
|||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.ms-aside-container {
|
||||
height: calc(100vh - 500px);
|
||||
.el-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ms-aside-container {
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
<template>
|
||||
<el-main v-loading="result.loading">
|
||||
<el-form :model="environment" :rules="rules" ref="from">
|
||||
|
||||
<span>环境名称</span>
|
||||
<el-form-item
|
||||
prop="name">
|
||||
<el-input v-model="environment.name" :placeholder="'请填写名称'" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<span>环境域名</span>
|
||||
<el-form-item
|
||||
prop="socket">
|
||||
<el-input v-model="environment.socket" :placeholder="$t('api_test.request.url_description')" clearable>
|
||||
<template v-slot:prepend>
|
||||
<el-select v-model="environment.protocol" class="request-protocol-select">
|
||||
<el-option label="http://" value="http"/>
|
||||
<el-option label="https://" value="https"/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<span>全局变量</span>
|
||||
<ms-api-scenario-variables :items="environment.variables"/>
|
||||
|
||||
<span>请求头</span>
|
||||
<ms-api-key-value :items="environment.headers"/>
|
||||
|
||||
<div class="environment-footer">
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
</el-main>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsApiScenarioVariables from "../ApiScenarioVariables";
|
||||
import MsApiKeyValue from "../ApiKeyValue";
|
||||
|
||||
export default {
|
||||
name: "EnvironmentEdit",
|
||||
components: {MsApiKeyValue, MsApiScenarioVariables},
|
||||
props: {
|
||||
environment: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {variables: [{}], headers: [{}], protocol: 'https'};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let socketValidator = (rule, value, callback) => {
|
||||
if (!this.validateSocket(value)) {
|
||||
callback(new Error('格式错误'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
result: {},
|
||||
rules: {
|
||||
name :[{required: true, message: '请填写名称', trigger: 'blur'}],
|
||||
socket :[{required: true, validator: socketValidator, trigger: 'blur'}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
this.$refs['from'].validate((valid) => {
|
||||
if (valid) {
|
||||
this._save();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
_save() {
|
||||
let param = this.buildParam();
|
||||
let url = '/api/environment/add';
|
||||
if (param.id) {
|
||||
url = '/api/environment/update';
|
||||
}
|
||||
this.result = this.$post(url, param, response => {
|
||||
this.environment.id = response.data;
|
||||
this.$success("保存成功");
|
||||
});
|
||||
},
|
||||
buildParam() {
|
||||
let param = {};
|
||||
Object.assign(param, this.environment);
|
||||
param.variables = JSON.stringify(this.environment.variables);
|
||||
param.headers = JSON.stringify(this.environment.headers);
|
||||
return param;
|
||||
},
|
||||
validateSocket(socket) {
|
||||
if (!socket) return;
|
||||
let socketInfo = socket.split(":");
|
||||
if (socketInfo.length > 2) {
|
||||
return false;
|
||||
}
|
||||
let host = socketInfo[0];
|
||||
let port = socketInfo[1];
|
||||
if (!this.validateHost(host) || !(port == undefined || this.validatePort(port))) {
|
||||
return false;
|
||||
}
|
||||
this.environment.domain = host;
|
||||
this.environment.port = port;
|
||||
return true;
|
||||
},
|
||||
validateHost(host) {
|
||||
let hostReg = /^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/;
|
||||
if (hostReg.test(host) || host === 'localhost') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
validatePort(port) {
|
||||
let portReg = /^[1-9]\d*$/;
|
||||
if (portReg.test(port) && 1 <= 1*port && 1*port <= 65535){
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.el-main {
|
||||
border: solid 1px #EBEEF5;
|
||||
margin-left: 200px;
|
||||
}
|
||||
|
||||
.request-protocol-select {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.el-row {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.environment-footer {
|
||||
margin-top: 15px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
span {
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
span:not(:first-child) {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -1,16 +1,23 @@
|
|||
<template>
|
||||
<ms-aside-container :width="width">
|
||||
<div class="title-bar">
|
||||
<span class="title-left">{{title}}</span>
|
||||
<span class="title-right">
|
||||
<i class="el-icon-plus" @click="addFuc"/>
|
||||
</span>
|
||||
<ms-aside-container :width="width + 'px'">
|
||||
<div class="title-bar" :style="{'height': titleBarHeight + 'px'}">
|
||||
<slot name="title">
|
||||
<span :style="{'line-height': titleBarHeight - 10 + 'px'}" class="title-left">
|
||||
{{title}}
|
||||
</span>
|
||||
<span :style="{'line-height': titleBarHeight - 10 + 'px'}" class="title-right">
|
||||
<i class="el-icon-plus" @click="addFuc"/>
|
||||
</span>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
<div v-for="(item, index) in data" :key="index" class="item-bar" @click="itemSelected(index, item)" :class="{'item-selected' : index == selectIndex}">
|
||||
<span class="item-left">{{item.name}}</span>
|
||||
<span class="item-right">
|
||||
<i class="el-icon-delete" @click="deleteFuc(item)"/>
|
||||
<div :style="{'height': itemBarHeight + 'px'}" v-for="(item, index) in data" :key="index" class="item-bar" @click="itemSelected(index, item)" :class="{'item-selected' : index == selectIndex}">
|
||||
<!-- <span :style="{'line-height': itemBarHeight - 10 + 'px'}" class="item-left">-->
|
||||
<!--<!– {{item.name}}–>-->
|
||||
<!-- </span>-->
|
||||
<input class="item-input" :style="{'height': itemBarHeight - 12 + 'px', 'line-height': itemBarHeight - 12 + 'px', 'width': width - 90 + 'px'}" v-model="item.name" placeholder="请输入内容"/>
|
||||
<span :style="{'line-height': itemBarHeight - 10 + 'px'}" class="item-right">
|
||||
<i v-for="(operator, index) in itemOperators" :key="index" :class="operator.icon" @click="operator.func(item)"/>
|
||||
</span>
|
||||
</div>
|
||||
</ms-aside-container>
|
||||
|
@ -29,13 +36,32 @@
|
|||
},
|
||||
props: {
|
||||
width: {
|
||||
type: String,
|
||||
default: '200px'
|
||||
type: Number,
|
||||
default: 200
|
||||
},
|
||||
titleBarHeight: {
|
||||
type: Number,
|
||||
default: 40
|
||||
},
|
||||
itemBarHeight: {
|
||||
type: Number,
|
||||
default: 35
|
||||
},
|
||||
title: String,
|
||||
data: Array,
|
||||
deleteFuc: Function,
|
||||
addFuc: Function,
|
||||
itemOperators: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [
|
||||
{
|
||||
icon: 'el-icon-delete',
|
||||
func: this.deleteFuc
|
||||
}
|
||||
];
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
itemSelected(index, item) {
|
||||
|
@ -48,28 +74,27 @@
|
|||
|
||||
<style scoped>
|
||||
|
||||
.ms-aside-container {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
width: 100%;
|
||||
background: #e9ebef;
|
||||
height: 40px;
|
||||
padding: 5px 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.title-bar span {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.item-bar {
|
||||
width: 100%;
|
||||
background: #F9F9F9;
|
||||
height: 35px;
|
||||
padding: 5px 10px;
|
||||
box-sizing: border-box;
|
||||
border: solid 1px #e6e6e6;
|
||||
}
|
||||
|
||||
.item-bar span {
|
||||
line-height: 25px;
|
||||
.item-bar:hover .item-right {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.title-right,.item-right {
|
||||
|
@ -80,8 +105,8 @@
|
|||
visibility: hidden;
|
||||
}
|
||||
|
||||
.ms-aside-container {
|
||||
padding: 0;
|
||||
.item-right i {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
i:hover {
|
||||
|
@ -89,16 +114,23 @@
|
|||
font-size: large;
|
||||
}
|
||||
|
||||
.item-bar:hover .item-right {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.item-selected {
|
||||
background: #edf6fd;
|
||||
background: #ECF5FF;
|
||||
border-left: solid #409EFF 5px;
|
||||
}
|
||||
|
||||
.item-selected .item-right {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.item-input {
|
||||
border: hidden;
|
||||
display: inline;
|
||||
background-color:rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
.item-input:focus{
|
||||
outline:none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
@click="stopTest(reportId)">
|
||||
{{$t('report.test_stop_now')}}
|
||||
</el-button>
|
||||
<!--<el-button :disabled="isReadOnly || status !== 'Completed'" type="success" plain size="mini">
|
||||
<el-button :disabled="isReadOnly || status !== 'Completed'" type="success" plain size="mini"
|
||||
@click="rerun(testId)">
|
||||
{{$t('report.test_execute_again')}}
|
||||
</el-button>
|
||||
<el-button :disabled="isReadOnly" type="info" plain size="mini">
|
||||
<!--<el-button :disabled="isReadOnly" type="info" plain size="mini">
|
||||
{{$t('report.export')}}
|
||||
</el-button>
|
||||
<el-button :disabled="isReadOnly" type="warning" plain size="mini">
|
||||
|
@ -179,6 +180,19 @@
|
|||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
rerun(testId) {
|
||||
this.$confirm(this.$t('report.test_rerun_confirm'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$post('/performance/run', {id: testId, triggerMode: 'MANUAL'}, () => {
|
||||
this.$success(this.$t('load_test.is_running'))
|
||||
this.$router.push({path: '/performance/report/all'})
|
||||
})
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
onOpen() {
|
||||
window.console.log("open WebSocket");
|
||||
},
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template v-if="baseUrl == 'api'" v-slot:default="scope">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)">
|
||||
<template v-slot:behind>
|
||||
<template v-if="baseUrl == 'api'" v-slot:behind>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="'环境配置'" icon="el-icon-setting"
|
||||
type="info" @exec="openEnvironmentConfig(scope.row)"/>
|
||||
</template>
|
||||
|
@ -238,7 +238,7 @@
|
|||
this.list();
|
||||
},
|
||||
openEnvironmentConfig(project) {
|
||||
this.$refs.environmentConfig.open(project);
|
||||
this.$refs.environmentConfig.open(project.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,6 +205,7 @@ export default {
|
|||
'test_end_time': 'Test End Time',
|
||||
'test_stop_now': 'Test Stop Now',
|
||||
'test_stop_now_confirm': 'Are you sure you want to stop the current test immediately?',
|
||||
'test_rerun_confirm': 'Are you sure you want to rerun the current test immediately?',
|
||||
'test_stop_success': 'Test stop successfully',
|
||||
'test_execute_again': 'Test Execute Again',
|
||||
'export': 'Export',
|
||||
|
|
|
@ -203,6 +203,7 @@ export default {
|
|||
'test_end_time': '结束时间',
|
||||
'test_stop_now': '立即停止',
|
||||
'test_stop_now_confirm': '确定要立即停止当前测试吗?',
|
||||
'test_rerun_confirm': '确定要再次执行当前测试吗?',
|
||||
'test_stop_success': '停止成功',
|
||||
'test_execute_again': '再次执行',
|
||||
'export': '导出',
|
||||
|
|
|
@ -203,6 +203,7 @@ export default {
|
|||
'test_end_time': '結束時間',
|
||||
'test_stop_now': '立即停止',
|
||||
'test_stop_now_confirm': '確定要立即停止當前測試嗎?',
|
||||
'test_rerun_confirm': '確定要再次執行當前測試嗎?',
|
||||
'test_stop_success': '停止成功',
|
||||
'test_execute_again': '再次執行',
|
||||
'export': '導出',
|
||||
|
|
Loading…
Reference in New Issue