feat(接口测试): jar包管理
This commit is contained in:
parent
7375aaff65
commit
b21c799ba2
|
@ -0,0 +1,50 @@
|
|||
package io.metersphere.api.controller;
|
||||
|
||||
import io.metersphere.api.service.ApiTestJarConfigService;
|
||||
import io.metersphere.base.domain.ApiTestJarConfig;
|
||||
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 org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/jar")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||
public class ApiTestJarConfigController {
|
||||
|
||||
@Resource
|
||||
ApiTestJarConfigService apiTestJarConfigService;
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiTestJarConfig> list(@PathVariable String projectId) {
|
||||
return apiTestJarConfigService.list(projectId);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
public ApiTestJarConfig get(@PathVariable String id) {
|
||||
return apiTestJarConfigService.get(id);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/add", consumes = {"multipart/form-data"})
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
|
||||
public String add(@RequestPart("request") ApiTestJarConfig request, @RequestPart(value = "file") MultipartFile file) {
|
||||
return apiTestJarConfigService.add(request, file);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
|
||||
public void update(@RequestPart("request") ApiTestJarConfig request, @RequestPart(value = "file", required = false) MultipartFile file) {
|
||||
apiTestJarConfigService.update(request, file);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
|
||||
public void delete(@PathVariable String id) {
|
||||
apiTestJarConfigService.delete(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import io.metersphere.base.domain.ApiTestJarConfig;
|
||||
import io.metersphere.base.domain.ApiTestJarConfigExample;
|
||||
import io.metersphere.base.mapper.ApiTestJarConfigMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiTestJarConfigService {
|
||||
|
||||
private static final String JAR_FILE_DIR = "/opt/metersphere/data/jar";
|
||||
|
||||
@Resource
|
||||
private ApiTestJarConfigMapper apiTestJarConfigMapper;
|
||||
|
||||
public List<ApiTestJarConfig> list(String projectId) {
|
||||
ApiTestJarConfigExample example = new ApiTestJarConfigExample();
|
||||
example.createCriteria().andProjectIdEqualTo(projectId);
|
||||
return apiTestJarConfigMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public ApiTestJarConfig get(String id) {
|
||||
return apiTestJarConfigMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
ApiTestJarConfig apiTestJarConfig = apiTestJarConfigMapper.selectByPrimaryKey(id);
|
||||
deleteJarFile(apiTestJarConfig.getPath());
|
||||
apiTestJarConfigMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void update(ApiTestJarConfig apiTestJarConfig, MultipartFile file) {
|
||||
checkExist(apiTestJarConfig);
|
||||
apiTestJarConfig.setOwner(SessionUtils.getUser().getId());
|
||||
apiTestJarConfig.setUpdateTime(System.currentTimeMillis());
|
||||
String deletePath = apiTestJarConfig.getPath();
|
||||
if (file != null) {
|
||||
apiTestJarConfig.setFileName(file.getOriginalFilename());
|
||||
apiTestJarConfig.setPath(getJarPath(apiTestJarConfig, file));
|
||||
}
|
||||
apiTestJarConfigMapper.updateByPrimaryKey(apiTestJarConfig);
|
||||
if (file != null) {
|
||||
deleteJarFile(deletePath);
|
||||
createJarFiles(apiTestJarConfig.getProjectId(), file);
|
||||
}
|
||||
}
|
||||
|
||||
public String add(ApiTestJarConfig apiTestJarConfig, MultipartFile file) {
|
||||
apiTestJarConfig.setId(UUID.randomUUID().toString());
|
||||
apiTestJarConfig.setOwner(SessionUtils.getUser().getId());
|
||||
checkExist(apiTestJarConfig);
|
||||
apiTestJarConfig.setCreateTime(System.currentTimeMillis());
|
||||
apiTestJarConfig.setUpdateTime(System.currentTimeMillis());
|
||||
apiTestJarConfig.setPath(getJarPath(apiTestJarConfig, file));
|
||||
apiTestJarConfig.setFileName(file.getOriginalFilename());
|
||||
apiTestJarConfigMapper.insert(apiTestJarConfig);
|
||||
createJarFiles(apiTestJarConfig.getProjectId(), file);
|
||||
return apiTestJarConfig.getId();
|
||||
}
|
||||
|
||||
public void deleteJarFiles(String testId) {
|
||||
File file = new File(JAR_FILE_DIR + "/" + testId);
|
||||
FileUtil.deleteContents(file);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteJarFile(String path) {
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public String getJarPath(ApiTestJarConfig apiTestJarConfig, MultipartFile file) {
|
||||
return JAR_FILE_DIR + "/" + apiTestJarConfig.getProjectId() + "/" + file.getOriginalFilename();
|
||||
}
|
||||
|
||||
private String createJarFiles(String projectId, MultipartFile jar) {
|
||||
if (jar == null) {
|
||||
return null;
|
||||
}
|
||||
String dir = JAR_FILE_DIR + "/" + projectId;
|
||||
File testDir = new File(dir);
|
||||
if (!testDir.exists()) {
|
||||
testDir.mkdirs();
|
||||
}
|
||||
String filePath = testDir + "/" + jar.getOriginalFilename();
|
||||
File file = new File(filePath);
|
||||
try (InputStream in = jar.getInputStream(); OutputStream out = new FileOutputStream(file)) {
|
||||
file.createNewFile();
|
||||
FileUtil.copyStream(in, out);
|
||||
} catch (IOException e) {
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(Translator.get("upload_fail"));
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
private void checkExist(ApiTestJarConfig jarConfig) {
|
||||
if (jarConfig.getName() != null) {
|
||||
ApiTestJarConfigExample example = new ApiTestJarConfigExample();
|
||||
ApiTestJarConfigExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andNameEqualTo(jarConfig.getName())
|
||||
.andProjectIdEqualTo(jarConfig.getProjectId());
|
||||
if (StringUtils.isNotBlank(jarConfig.getId())) {
|
||||
criteria.andIdNotEqualTo(jarConfig.getId());
|
||||
}
|
||||
if (apiTestJarConfigMapper.selectByExample(example).size() > 0) {
|
||||
MSException.throwException(Translator.get("api_test_jarConfig_already_exists"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiTestJarConfig implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private String owner;
|
||||
|
||||
private String path;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String description;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,810 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ApiTestJarConfigExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public ApiTestJarConfigExample() {
|
||||
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 andFileNameIsNull() {
|
||||
addCriterion("file_name is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameIsNotNull() {
|
||||
addCriterion("file_name is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameEqualTo(String value) {
|
||||
addCriterion("file_name =", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameNotEqualTo(String value) {
|
||||
addCriterion("file_name <>", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameGreaterThan(String value) {
|
||||
addCriterion("file_name >", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("file_name >=", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameLessThan(String value) {
|
||||
addCriterion("file_name <", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("file_name <=", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameLike(String value) {
|
||||
addCriterion("file_name like", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameNotLike(String value) {
|
||||
addCriterion("file_name not like", value, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameIn(List<String> values) {
|
||||
addCriterion("file_name in", values, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameNotIn(List<String> values) {
|
||||
addCriterion("file_name not in", values, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameBetween(String value1, String value2) {
|
||||
addCriterion("file_name between", value1, value2, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFileNameNotBetween(String value1, String value2) {
|
||||
addCriterion("file_name not between", value1, value2, "fileName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerIsNull() {
|
||||
addCriterion("`owner` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerIsNotNull() {
|
||||
addCriterion("`owner` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerEqualTo(String value) {
|
||||
addCriterion("`owner` =", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerNotEqualTo(String value) {
|
||||
addCriterion("`owner` <>", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerGreaterThan(String value) {
|
||||
addCriterion("`owner` >", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`owner` >=", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerLessThan(String value) {
|
||||
addCriterion("`owner` <", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerLessThanOrEqualTo(String value) {
|
||||
addCriterion("`owner` <=", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerLike(String value) {
|
||||
addCriterion("`owner` like", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerNotLike(String value) {
|
||||
addCriterion("`owner` not like", value, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerIn(List<String> values) {
|
||||
addCriterion("`owner` in", values, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerNotIn(List<String> values) {
|
||||
addCriterion("`owner` not in", values, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerBetween(String value1, String value2) {
|
||||
addCriterion("`owner` between", value1, value2, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOwnerNotBetween(String value1, String value2) {
|
||||
addCriterion("`owner` not between", value1, value2, "owner");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathIsNull() {
|
||||
addCriterion("`path` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathIsNotNull() {
|
||||
addCriterion("`path` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathEqualTo(String value) {
|
||||
addCriterion("`path` =", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathNotEqualTo(String value) {
|
||||
addCriterion("`path` <>", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathGreaterThan(String value) {
|
||||
addCriterion("`path` >", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`path` >=", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathLessThan(String value) {
|
||||
addCriterion("`path` <", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathLessThanOrEqualTo(String value) {
|
||||
addCriterion("`path` <=", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathLike(String value) {
|
||||
addCriterion("`path` like", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathNotLike(String value) {
|
||||
addCriterion("`path` not like", value, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathIn(List<String> values) {
|
||||
addCriterion("`path` in", values, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathNotIn(List<String> values) {
|
||||
addCriterion("`path` not in", values, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathBetween(String value1, String value2) {
|
||||
addCriterion("`path` between", value1, value2, "path");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPathNotBetween(String value1, String value2) {
|
||||
addCriterion("`path` not between", value1, value2, "path");
|
||||
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 andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNotNull() {
|
||||
addCriterion("description is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionEqualTo(String value) {
|
||||
addCriterion("description =", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotEqualTo(String value) {
|
||||
addCriterion("description <>", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThan(String value) {
|
||||
addCriterion("description >", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("description >=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThan(String value) {
|
||||
addCriterion("description <", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
||||
addCriterion("description <=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLike(String value) {
|
||||
addCriterion("description like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotLike(String value) {
|
||||
addCriterion("description not like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIn(List<String> values) {
|
||||
addCriterion("description in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotIn(List<String> values) {
|
||||
addCriterion("description not in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
||||
addCriterion("description between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
||||
addCriterion("description not between", value1, value2, "description");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.ApiTestJarConfig;
|
||||
import io.metersphere.base.domain.ApiTestJarConfigExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ApiTestJarConfigMapper {
|
||||
long countByExample(ApiTestJarConfigExample example);
|
||||
|
||||
int deleteByExample(ApiTestJarConfigExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(ApiTestJarConfig record);
|
||||
|
||||
int insertSelective(ApiTestJarConfig record);
|
||||
|
||||
List<ApiTestJarConfig> selectByExample(ApiTestJarConfigExample example);
|
||||
|
||||
ApiTestJarConfig selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") ApiTestJarConfig record, @Param("example") ApiTestJarConfigExample example);
|
||||
|
||||
int updateByExample(@Param("record") ApiTestJarConfig record, @Param("example") ApiTestJarConfigExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(ApiTestJarConfig record);
|
||||
|
||||
int updateByPrimaryKey(ApiTestJarConfig record);
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
<?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.ApiTestJarConfigMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestJarConfig">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
|
||||
<result column="owner" jdbcType="VARCHAR" property="owner" />
|
||||
<result column="path" jdbcType="VARCHAR" property="path" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<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, `name`, file_name, `owner`, `path`, project_id, description, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestJarConfigExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from api_test_jar_config
|
||||
<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_test_jar_config
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from api_test_jar_config
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestJarConfigExample">
|
||||
delete from api_test_jar_config
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestJarConfig">
|
||||
insert into api_test_jar_config (id, `name`, file_name,
|
||||
`owner`, `path`, project_id,
|
||||
description, create_time, update_time
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
|
||||
#{owner,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestJarConfig">
|
||||
insert into api_test_jar_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
file_name,
|
||||
</if>
|
||||
<if test="owner != null">
|
||||
`owner`,
|
||||
</if>
|
||||
<if test="path != null">
|
||||
`path`,
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</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="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
#{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="owner != null">
|
||||
#{owner,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="path != null">
|
||||
#{path,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
#{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,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.ApiTestJarConfigExample" resultType="java.lang.Long">
|
||||
select count(*) from api_test_jar_config
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update api_test_jar_config
|
||||
<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.fileName != null">
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.owner != null">
|
||||
`owner` = #{record.owner,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.path != null">
|
||||
`path` = #{record.path,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.projectId != null">
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,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_test_jar_config
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
`owner` = #{record.owner,jdbcType=VARCHAR},
|
||||
`path` = #{record.path,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
description = #{record.description,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.ApiTestJarConfig">
|
||||
update api_test_jar_config
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="owner != null">
|
||||
`owner` = #{owner,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="path != null">
|
||||
`path` = #{path,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,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.ApiTestJarConfig">
|
||||
update api_test_jar_config
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
`owner` = #{owner,jdbcType=VARCHAR},
|
||||
`path` = #{path,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,12 @@
|
|||
CREATE TABLE IF NOT EXISTS `api_test_jar_config` (
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`name` varchar(64) NOT NULL COMMENT 'Name',
|
||||
`file_name` varchar(64) NOT NULL COMMENT 'File name',
|
||||
`owner` varchar(50) NOT NULL COMMENT 'User ID',
|
||||
`path` varchar(255) NOT NULL COMMENT 'File path',
|
||||
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this jar belongs to',
|
||||
`description` varchar(255) DEFAULT NULL COMMENT 'description',
|
||||
`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;
|
|
@ -64,8 +64,8 @@
|
|||
|
||||
<!--要生成的数据库表 -->
|
||||
|
||||
<table tableName="schedule"/>
|
||||
<table tableName="notice"/>
|
||||
<table tableName="api_test_jar_config"/>
|
||||
<!--<table tableName="notice"/>-->
|
||||
|
||||
|
||||
</context>
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<template>
|
||||
<el-dialog width="50%" :close-on-click-modal="false" :title="$t('api_test.jar_config.title')" :visible.sync="visible" class="jar-import" @close="close">
|
||||
<div v-loading="result.loading">
|
||||
<ms-jar-config-from :config="currentConfig" :callback="saveConfig" ref="jarConfigFrom" :read-only="isReadOnly"/>
|
||||
<ms-jar-config-list @refresh="getJarConfigs" v-if="configs.length > 0" @rowSelect="rowSelect" :table-data="configs"/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import ApiEnvironmentConfig from "../ApiEnvironmentConfig";
|
||||
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
|
||||
import MsJarConfigList from "./JarConfigList";
|
||||
import MsJarConfigFrom from "./JarConfigFrom";
|
||||
export default {
|
||||
name: "MsJarConfig",
|
||||
components: {MsJarConfigFrom, MsJarConfigList, ApiEnvironmentConfig, MsDialogFooter},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
result: {},
|
||||
projectId: "",
|
||||
currentConfig: {},
|
||||
configs: []
|
||||
}
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
open(projectId) {
|
||||
this.visible = true;
|
||||
this.projectId = projectId;
|
||||
this.getJarConfigs();
|
||||
listenGoBack(this.close);
|
||||
},
|
||||
saveConfig(config, file) {
|
||||
for (let item of this.configs) {
|
||||
if (item.name === config.name && item.id !== config.id) {
|
||||
this.$warning(this.$t('commons.already_exists'));
|
||||
return;
|
||||
}
|
||||
if (item.fileName === file.name && item.id !== config.id) {
|
||||
this.$warning(this.$t('api_test.jar_config.file_exist'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
let url = config.id ? "/api/jar/update" : "/api/jar/add";
|
||||
config.projectId = this.projectId;
|
||||
this.result = this.$fileUpload(url, file, null, config, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.getJarConfigs();
|
||||
});
|
||||
},
|
||||
getJarConfigs() {
|
||||
this.result = this.$get("/api/jar/list/" + this.projectId, response => {
|
||||
this.configs = response.data;
|
||||
this.currentConfig = {};
|
||||
})
|
||||
},
|
||||
rowSelect(config) {
|
||||
this.currentConfig = config;
|
||||
},
|
||||
close() {
|
||||
this.$refs.jarConfigFrom.clear();
|
||||
removeGoBackListener(this.close);
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,187 @@
|
|||
<template>
|
||||
<el-form :model="currentConfig" :rules="rules" label-width="100px" v-loading="result.loading" ref="form">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input size="small" v-model="currentConfig.name" clearable show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.project')" prop="description">
|
||||
<el-input :disabled="readOnly" v-model="currentConfig.description"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 4}"
|
||||
:rows="2"
|
||||
:placeholder="$t('commons.input_content')"/>
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
|
||||
<el-col :span="1">
|
||||
<el-divider direction="vertical"/>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="11">
|
||||
<el-upload
|
||||
class="jar-upload"
|
||||
drag
|
||||
action="#"
|
||||
:http-request="upload"
|
||||
:limit="1"
|
||||
:beforeUpload="uploadValidate"
|
||||
:on-remove="handleRemove"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileList"
|
||||
ref="fileUpload">
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text" v-html="$t('load_test.upload_tips')"></div>
|
||||
<div class="el-upload__tip" slot="tip">{{$t('api_test.api_import.file_size_limit')}}</div>
|
||||
</el-upload>
|
||||
</el-col>
|
||||
|
||||
<el-col>
|
||||
<div class="buttons">
|
||||
<el-button type="primary" v-show="currentConfig.id" size="small" @click="save('update')">{{$t('commons.update')}}</el-button>
|
||||
<el-button type="primary" size="small" @click="save('add')">{{$t('commons.add')}}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "MsJarConfigFrom",
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
result: {},
|
||||
currentConfig: {
|
||||
name: '',
|
||||
description: '',
|
||||
fileName: '',
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: this.$t('commons.input_name'), trigger: 'blur'},
|
||||
{max: 60, message: this.$t('commons.input_limit', [1, 60]), trigger: 'blur'}
|
||||
],
|
||||
},
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
props: {
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
config: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
type: Function
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
config() {
|
||||
this.currentConfig = {
|
||||
name: '',
|
||||
description: '',
|
||||
fileName: ''
|
||||
};
|
||||
if (this.config.fileName) {
|
||||
this.fileList = [{name: this.config.fileName}];
|
||||
} else {
|
||||
this.fileList = [];
|
||||
}
|
||||
Object.assign(this.currentConfig, this.config);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
Object.assign(this.currentConfig, this.config);
|
||||
},
|
||||
methods: {
|
||||
upload(file) {
|
||||
this.fileList.push(file.file)
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$warning(this.$t('test_track.case.import.upload_limit_count'));
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
this.fileList = [];
|
||||
},
|
||||
uploadValidate(file, fileList) {
|
||||
let suffix = file.name.substring(file.name.lastIndexOf('.') + 1);
|
||||
if (suffix != 'jar') {
|
||||
this.$warning(this.$t('api_test.api_import.suffixFormatErr'));
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 30) {
|
||||
this.$warning(this.$t('jar_config.upload_limit_size'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
save(type) {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.fileList <= 0) {
|
||||
this.$warning(this.$t('commons.please_upload'));
|
||||
return;
|
||||
}
|
||||
if (this.callback) {
|
||||
if (type === 'add') {
|
||||
this.currentConfig.id = undefined;
|
||||
}
|
||||
this.callback(this.currentConfig, this.fileList[0]);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
clear() {
|
||||
this.$refs['form'].clearValidate();
|
||||
this.fileList = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.el-divider {
|
||||
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.jar-upload {
|
||||
text-align: center;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.jar-upload >>> .el-upload {
|
||||
width: 100%;
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
.jar-upload >>> .el-upload-dragger {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-form {
|
||||
border: solid #E1E1E1 1px;
|
||||
margin: 10px 0;
|
||||
padding: 30px 10px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
margin-top: 10px;
|
||||
margin-bottom: -10px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,67 @@
|
|||
<template>
|
||||
<div class="jar-config-list">
|
||||
|
||||
<el-table border :data="tableData"
|
||||
class="adjust-table table-content"
|
||||
highlight-current-row
|
||||
@row-click="handleView">
|
||||
|
||||
<el-table-column prop="name" :label="$t('commons.name')" show-overflow-tooltip/>
|
||||
<el-table-column prop="fileName" :label="$t('api_test.jar_config.jar_file')" show-overflow-tooltip/>
|
||||
<el-table-column prop="description" :label="$t('commons.description')" show-overflow-tooltip/>
|
||||
<!--<el-table-column prop="createTime" :label="$t('创建时间')" show-overflow-tooltip/>-->
|
||||
<el-table-column prop="updateTime" :label="$t('commons.update_time')" show-overflow-tooltip/>
|
||||
<el-table-column prop="owner" :label="$t('report.user_name')" show-overflow-tooltip/>
|
||||
|
||||
<el-table-column :label="$t('commons.operating')" min-width="100">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_test.scenario.reference')" icon="el-icon-connection" type="success" @exec="handleCopy(scope.$index, scope.row)"/>
|
||||
<ms-table-operator-button :isTesterPermission="true" :tip="$t('commons.delete')" icon="el-icon-delete" type="danger" @exec="handleDelete(scope.row.id)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
|
||||
|
||||
export default {
|
||||
name: "MsJarConfigList",
|
||||
components: {MsTableOperatorButton, MsTableOperator},
|
||||
props: {
|
||||
tableData: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleView(row) {
|
||||
this.$emit('rowSelect', row);
|
||||
},
|
||||
handleDelete(id) {
|
||||
this.result = this.$get("/api/jar/delete/" + id, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.$emit('refresh');
|
||||
});
|
||||
},
|
||||
handleCopy(index, config) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -37,8 +37,10 @@
|
|||
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
<template v-if="baseUrl == 'api'" v-slot:behind>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="'环境配置'" icon="el-icon-setting"
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_test.environment.environment_config')" icon="el-icon-setting"
|
||||
type="info" @exec="openEnvironmentConfig(scope.row)"/>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_test.jar_config.title')" icon="el-icon-box"
|
||||
type="info" @exec="openJarConfig(scope.row)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
|
@ -76,6 +78,7 @@
|
|||
<ms-delete-confirm :title="$t('project.delete')" @delete="_handleDelete" ref="deleteConfirm"/>
|
||||
|
||||
<api-environment-config ref="environmentConfig"/>
|
||||
<ms-jar-config ref="jarConfig"/>
|
||||
|
||||
</ms-container>
|
||||
</template>
|
||||
|
@ -95,10 +98,12 @@ import MsTableOperatorButton from "../common/components/MsTableOperatorButton";
|
|||
import ApiEnvironmentConfig from "../api/test/components/ApiEnvironmentConfig";
|
||||
import TemplateComponent from "../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
|
||||
import {ApiEvent, LIST_CHANGE, PerformanceEvent, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
import MsJarConfig from "../api/test/components/jar/JarConfig";
|
||||
|
||||
export default {
|
||||
name: "MsProject",
|
||||
components: {
|
||||
MsJarConfig,
|
||||
TemplateComponent,
|
||||
ApiEnvironmentConfig,
|
||||
MsTableOperatorButton,
|
||||
|
@ -275,6 +280,9 @@ export default {
|
|||
},
|
||||
openEnvironmentConfig(project) {
|
||||
this.$refs.environmentConfig.open(project.id);
|
||||
},
|
||||
openJarConfig(project) {
|
||||
this.$refs.jarConfig.open(project.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -423,6 +423,12 @@ export default {
|
|||
export_config: "Export",
|
||||
enable_validate_tip: "No request available",
|
||||
copy: "Copy Test",
|
||||
jar_config: {
|
||||
title: "The Jar Package Management",
|
||||
jar_file: "Jar package",
|
||||
file_exist: "The name already exists in the project",
|
||||
upload_limit_size: "Upload file size cannot exceed 30MB!",
|
||||
},
|
||||
environment: {
|
||||
name: "Environment Name",
|
||||
socket: "Socket",
|
||||
|
|
|
@ -424,6 +424,12 @@ export default {
|
|||
export_config: "导出",
|
||||
enable_validate_tip: "没有可用请求",
|
||||
copy: "复制测试",
|
||||
jar_config: {
|
||||
title: "jar包管理",
|
||||
jar_file: "jar包",
|
||||
file_exist: "该项目下已存在改jar包",
|
||||
upload_limit_size: "上传文件大小不能超过 30MB!",
|
||||
},
|
||||
environment: {
|
||||
name: "环境名称",
|
||||
socket: "环境域名",
|
||||
|
|
|
@ -424,6 +424,12 @@ export default {
|
|||
export_config: "導出",
|
||||
enable_validate_tip: "沒有可用請求",
|
||||
copy: "復制測試",
|
||||
jar_config: {
|
||||
title: "jar包管理",
|
||||
jar_file: "jar包",
|
||||
file_exist: "該項目下已存在改jar包",
|
||||
upload_limit_size: "上傳文件大小不能超過 30MB!",
|
||||
},
|
||||
environment: {
|
||||
name: "環境名稱",
|
||||
socket: "環境域名",
|
||||
|
@ -575,24 +581,24 @@ export default {
|
|||
dataSource_cannot_be_empty: "SQL請求數據源不能為空",
|
||||
result_variable: "存儲結果",
|
||||
variable_names: "按列存儲",
|
||||
},
|
||||
tcp: {
|
||||
server: "服務器名或IP",
|
||||
port: "端口",
|
||||
connect: "連接(ms)",
|
||||
response: "響應(ms)",
|
||||
re_use_connection: "Re-use connection",
|
||||
no_delay: "設置無延遲",
|
||||
close_connection: "關閉連接",
|
||||
so_linger: "SO LINGER",
|
||||
eol_byte: "行尾(EOL)字節值",
|
||||
request: "要發送的文本",
|
||||
username: "用戶名",
|
||||
password: "密碼",
|
||||
login: "登錄設置",
|
||||
server_cannot_be_empty: "服務器名或IP不能為空",
|
||||
}
|
||||
},
|
||||
tcp: {
|
||||
server: "服務器名或IP",
|
||||
port: "端口",
|
||||
connect: "連接(ms)",
|
||||
response: "響應(ms)",
|
||||
re_use_connection: "Re-use connection",
|
||||
no_delay: "設置無延遲",
|
||||
close_connection: "關閉連接",
|
||||
so_linger: "SO LINGER",
|
||||
eol_byte: "行尾(EOL)字節值",
|
||||
request: "要發送的文本",
|
||||
username: "用戶名",
|
||||
password: "密碼",
|
||||
login: "登錄設置",
|
||||
server_cannot_be_empty: "服務器名或IP不能為空",
|
||||
},
|
||||
api_import: {
|
||||
label: "導入",
|
||||
title: "接口測試導入",
|
||||
|
@ -796,7 +802,7 @@ export default {
|
|||
reviewed_by_me: "待我評審",
|
||||
creator: "創建人",
|
||||
done: "已評用例",
|
||||
result_distribution: "結果分佈"
|
||||
result_distribution: "結果分布"
|
||||
},
|
||||
comment: {
|
||||
no_comment: "暫無評論",
|
||||
|
@ -902,7 +908,7 @@ export default {
|
|||
close_success: "關閉成功",
|
||||
preview: "預覽",
|
||||
please_choose_current_owner: "請選擇處理人",
|
||||
tapd_current_owner: "Tapd平台處理人:",
|
||||
tapd_current_owner: "Tapd平臺處理人:",
|
||||
}
|
||||
},
|
||||
test_resource_pool: {
|
||||
|
|
Loading…
Reference in New Issue