Merge branch 'dev'

This commit is contained in:
BugKing 2021-10-21 15:10:41 +08:00
commit d13d33b33a
519 changed files with 19073 additions and 14564 deletions

View File

@ -63,7 +63,7 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -6,14 +6,11 @@ import io.metersphere.api.dto.APIReportResult;
import io.metersphere.api.dto.DeleteAPIReportRequest;
import io.metersphere.api.dto.QueryAPIReportRequest;
import io.metersphere.api.service.APIReportService;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.DashboardTestDTO;
import io.metersphere.service.CheckPermissionService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -2,10 +2,10 @@ package io.metersphere.api.controller;
import io.metersphere.api.dto.scenario.DatabaseConfig;
import io.metersphere.api.service.APIDatabaseService;
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.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

View File

@ -14,10 +14,7 @@ import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.api.service.EsbApiParamService;
import io.metersphere.api.service.EsbImportService;
import io.metersphere.base.domain.ApiDefinition;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.base.domain.Schedule;
import io.metersphere.base.domain.*;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.PermissionConstants;
@ -26,6 +23,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.RelationshipEdgeDTO;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.service.CheckPermissionService;
@ -305,4 +303,15 @@ public class ApiDefinitionController {
public void orderCase(@RequestBody ResetOrderRequest request) {
apiDefinitionService.updateOrder(request);
}
@GetMapping("/relationship/{id}/{relationshipType}")
public List<RelationshipEdgeDTO> getRelationshipApi(@PathVariable("id") String id, @PathVariable("relationshipType") String relationshipType) {
return apiDefinitionService.getRelationshipApi(id, relationshipType);
}
@PostMapping("/relationship/relate/{goPage}/{pageSize}")
public Pager< List<ApiDefinitionResult>> getRelationshipRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, apiDefinitionService.getRelationshipRelateList(request));
}
}

View File

@ -5,13 +5,10 @@ import io.metersphere.api.dto.definition.DragModuleRequest;
import io.metersphere.api.service.ApiModuleService;
import io.metersphere.base.domain.ApiModule;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.ApiDefinitionDefaultApiTypeUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -5,9 +5,6 @@ import io.metersphere.api.dto.ApiMonitorSearch;
import io.metersphere.api.dto.ApiResponseCodeMonitor;
import io.metersphere.api.dto.ApiResponseTimeMonitor;
import io.metersphere.api.service.APIMonitorService;
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;

View File

@ -5,11 +5,8 @@ import io.metersphere.api.dto.automation.DragApiScenarioModuleRequest;
import io.metersphere.api.service.ApiScenarioModuleService;
import io.metersphere.base.domain.ApiScenarioModule;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -8,14 +8,11 @@ import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.api.service.CommandService;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.EnvironmentRequest;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
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;

View File

@ -1,6 +1,6 @@
package io.metersphere.api.controller;
import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.api.dto.mock.MockApiUtils;
import io.metersphere.api.service.MockConfigService;
import io.metersphere.api.tcp.TCPPool;
import io.metersphere.base.domain.Project;
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* @author song.tianyang
@ -30,7 +31,8 @@ public class MockApiController {
@NoResultHolder
public String postRequest(@PathVariable String projectSystemId, HttpServletRequest request, HttpServletResponse response) {
Project project = projectService.findBySystemId(projectSystemId);
String returnStr = mockConfigService.checkReturnWithMockExpectByBodyParam("POST", project, request, response);
Map<String,String> requestHeaderMap = MockApiUtils.getHttpRequestHeader(request);
String returnStr = mockConfigService.checkReturnWithMockExpectByBodyParam("POST", requestHeaderMap,project, request, response);
return returnStr;
}
@ -38,7 +40,8 @@ public class MockApiController {
@NoResultHolder
public String getRequest(@PathVariable String projectSystemId, HttpServletRequest request, HttpServletResponse response) {
Project project = projectService.findBySystemId(projectSystemId);
String returnStr = mockConfigService.checkReturnWithMockExpectByUrlParam("GET", project, request, response);
Map<String,String> requestHeaderMap = MockApiUtils.getHttpRequestHeader(request);
String returnStr = mockConfigService.checkReturnWithMockExpectByUrlParam("GET", requestHeaderMap, project, request, response);
return returnStr;
}
@ -46,7 +49,8 @@ public class MockApiController {
@NoResultHolder
public String putRequest(@PathVariable String projectSystemId, HttpServletRequest request, HttpServletResponse response) {
Project project = projectService.findBySystemId(projectSystemId);
String returnStr = mockConfigService.checkReturnWithMockExpectByBodyParam("PUT", project, request, response);
Map<String,String> requestHeaderMap = MockApiUtils.getHttpRequestHeader(request);
String returnStr = mockConfigService.checkReturnWithMockExpectByBodyParam("PUT", requestHeaderMap, project, request, response);
return returnStr;
}
@ -54,7 +58,8 @@ public class MockApiController {
@NoResultHolder
public String patchRequest(@PathVariable String projectSystemId, HttpServletRequest request, HttpServletResponse response) {
Project project = projectService.findBySystemId(projectSystemId);
String returnStr = mockConfigService.checkReturnWithMockExpectByBodyParam("PATCH", project, request, response);
Map<String,String> requestHeaderMap = MockApiUtils.getHttpRequestHeader(request);
String returnStr = mockConfigService.checkReturnWithMockExpectByBodyParam("PATCH", requestHeaderMap, project, request, response);
return returnStr;
}
@ -62,7 +67,8 @@ public class MockApiController {
@NoResultHolder
public String deleteRequest(@PathVariable String projectSystemId, HttpServletRequest request, HttpServletResponse response) {
Project project = projectService.findBySystemId(projectSystemId);
String returnStr = mockConfigService.checkReturnWithMockExpectByUrlParam("DELETE", project, request, response);
Map<String,String> requestHeaderMap = MockApiUtils.getHttpRequestHeader(request);
String returnStr = mockConfigService.checkReturnWithMockExpectByUrlParam("DELETE", requestHeaderMap, project, request, response);
return returnStr;
}
@ -70,7 +76,8 @@ public class MockApiController {
@NoResultHolder
public String optionsRequest(@PathVariable String projectSystemId, HttpServletRequest request, HttpServletResponse response) {
Project project = projectService.findBySystemId(projectSystemId);
String returnStr = mockConfigService.checkReturnWithMockExpectByUrlParam("OPTIONS", project, request, response);
Map<String,String> requestHeaderMap = MockApiUtils.getHttpRequestHeader(request);
String returnStr = mockConfigService.checkReturnWithMockExpectByUrlParam("OPTIONS", requestHeaderMap, project, request, response);
return returnStr;
}
@ -78,7 +85,8 @@ public class MockApiController {
@NoResultHolder
public void headRequest(@PathVariable String projectSystemId, HttpServletRequest request, HttpServletResponse response) {
Project project = projectService.findBySystemId(projectSystemId);
mockConfigService.checkReturnWithMockExpectByUrlParam("HEAD", project, request, response);
Map<String,String> requestHeaderMap = MockApiUtils.getHttpRequestHeader(request);
mockConfigService.checkReturnWithMockExpectByUrlParam("HEAD", requestHeaderMap, project, request, response);
}
@GetMapping("/getTcpMockPortStatus/")

View File

@ -1,5 +1,6 @@
package io.metersphere.api.controller;
import io.metersphere.api.dto.mock.MockApiUtils;
import io.metersphere.api.dto.mockconfig.MockConfigRequest;
import io.metersphere.api.dto.mockconfig.MockExpectConfigRequest;
import io.metersphere.api.dto.mockconfig.response.MockConfigResponse;
@ -10,6 +11,7 @@ import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import io.metersphere.base.domain.MockExpectConfig;
import io.metersphere.base.domain.MockExpectConfigWithBLOBs;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
@ -34,11 +36,25 @@ public class MockConfigController {
return mockConfigService.genMockConfig(request);
}
@PostMapping("/updateMockExpectConfig")
public MockExpectConfig updateMockExpectConfig(@RequestBody MockExpectConfigRequest request) {
return mockConfigService.updateMockExpectConfig(request);
@PostMapping(value ="/updateMockExpectConfig", consumes = {"multipart/form-data"})
public MockExpectConfig updateMockExpectConfig(@RequestPart("request")MockExpectConfigRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
return mockConfigService.updateMockExpectConfig(request,bodyFiles);
}
@PostMapping(value ="/updateMockExpectConfigStatus")
public MockExpectConfig updateMockExpectConfig(@RequestBody MockExpectConfigRequest request) {
return mockConfigService.updateMockExpectConfigStatus(request);
}
// @PostMapping(value = "/create", consumes = {"multipart/form-data"})
// @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API)
// @MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class)
// @SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CREATE, mailTemplate = "api/DefinitionCreate", subject = "接口定义通知")
// public ApiDefinitionWithBLOBs create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
// checkPermissionService.checkProjectOwner(request.getProjectId());
// return apiDefinitionService.create(request, bodyFiles);
// }
@GetMapping("/mockExpectConfig/{id}")
public MockExpectConfigResponse selectMockExpectConfig(@PathVariable String id) {
MockExpectConfigWithBLOBs config = mockConfigService.findMockExpectConfigById(id);
@ -58,4 +74,12 @@ public class MockConfigController {
List<Map<String, String>> apiParams = mockConfigService.getApiParamsByApiDefinitionBLOBs(apiDefinitionWithBLOBs);
return apiParams;
}
@GetMapping("/getApiResponse/{id}")
public Map<String, String> getApiResponse(@PathVariable String id) {
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = apiDefinitionService.getBLOBs(id);
Map<String, String> returnMap = MockApiUtils.getApiResponse(apiDefinitionWithBLOBs.getResponse());
return returnMap;
}
}

View File

@ -33,7 +33,7 @@ public class SaveApiDefinitionRequest {
private String modulePath;
private String method;
private MsTestElement request;
private Response response;
@ -44,6 +44,8 @@ public class SaveApiDefinitionRequest {
private String followPeople;
private String remark;
private Schedule schedule;
private String triggerMode;

View File

@ -70,12 +70,16 @@ public class ApiDefinitionImportUtil {
private static void createNodeTree(NodeTree nodeTree, String pid, String projectId,
ApiModuleService apiModuleService, String path, int baseLevel) {
ApiModule apiModule = apiModuleService.get(pid);
ApiModule module = new ApiModule();
BeanUtils.copyBean(module, nodeTree);
apiModuleService.buildNewModule(module);
module.setProjectId(projectId);
module.setParentId(pid);
module.setLevel(module.getLevel() + baseLevel);
if (apiModule != null) {
module.setProtocol(apiModule.getProtocol());
}
createModule(module, SessionUtils.getUserId());
nodeTree.setNewId(module.getId());
path = path + nodeTree.getName();
@ -91,6 +95,7 @@ public class ApiDefinitionImportUtil {
/**
* 根据导出的模块树创建新的模块树
*
* @param nodeTree
* @param projectId
*/
@ -124,12 +129,14 @@ public class ApiDefinitionImportUtil {
}
public static void createModule(ApiModule module) {
createModule(module, null);
createModule(module, null);
}
public static void createModule(ApiModule module, String userId) {
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
module.setProtocol(RequestType.HTTP);
if (StringUtils.isEmpty(module.getProtocol())) {
module.setProtocol(RequestType.HTTP);
}
if (module.getName().length() > 64) {
module.setName(module.getName().substring(0, 64));
}

View File

@ -46,7 +46,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
if (StringUtils.isBlank(request.getSwaggerUrl())) {
sourceStr = getApiTestStr(source);
}
return parse(sourceStr, request);
return parse(sourceStr, request);
}
public ApiDefinitionImport parse(String sourceStr, ApiTestImportRequest request) {
@ -108,11 +108,11 @@ public class Swagger3Parser extends SwaggerAbstractParser {
Operation operation = operationsMap.get(method);
if (operation != null) {
MsHTTPSamplerProxy request = buildRequest(operation, pathName, method);
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method,importRequest);
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method, importRequest);
parseParameters(operation, request);
parseRequestBody(operation.getRequestBody(), request.getBody());
addBodyHeader(request);
if(request.getBody().getKvs().size() > 1 && request.getBody().getKvs().get(0).getName() == null) {
if (request.getBody().getKvs().size() > 1 && request.getBody().getKvs().get(0).getName() == null) {
request.getBody().getKvs().remove(0);
} // 有数据的话去掉 Kvs 里初始化的第一个全 null 的数据否则有空行
apiDefinition.setRequest(JSON.toJSONString(request));
@ -129,7 +129,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
return results;
}
private ApiDefinitionWithBLOBs buildApiDefinition(String id, Operation operation, String path, String method,ApiTestImportRequest importRequest) {
private ApiDefinitionWithBLOBs buildApiDefinition(String id, Operation operation, String path, String method, ApiTestImportRequest importRequest) {
String name = "";
if (StringUtils.isNotBlank(operation.getSummary())) {
name = operation.getSummary();
@ -138,7 +138,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
} else {
name = path;
}
return buildApiDefinition(id, name, path, method,importRequest);
return buildApiDefinition(id, name, path, method, importRequest);
}
private MsHTTPSamplerProxy buildRequest(Operation operation, String path, String method) {
@ -175,7 +175,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
private void parsePathParameters(Parameter parameter, List<KeyValue> rests) {
PathParameter pathParameter = (PathParameter) parameter;
rests.add(new KeyValue(pathParameter.getName(), "", getDefaultStringValue(parameter.getDescription())));
rests.add(new KeyValue(pathParameter.getName(), String.valueOf(pathParameter.getExample()), getDefaultStringValue(parameter.getDescription())));
}
private String getDefaultStringValue(String val) {
@ -184,12 +184,12 @@ public class Swagger3Parser extends SwaggerAbstractParser {
private void parseCookieParameters(Parameter parameter, List<KeyValue> headers) {
CookieParameter cookieParameter = (CookieParameter) parameter;
addCookie(headers, cookieParameter.getName(), "", getDefaultStringValue(cookieParameter.getDescription()), parameter.getRequired());
addCookie(headers, cookieParameter.getName(), String.valueOf(cookieParameter.getExample()), getDefaultStringValue(cookieParameter.getDescription()), parameter.getRequired());
}
private void parseHeaderParameters(Parameter parameter, List<KeyValue> headers) {
HeaderParameter headerParameter = (HeaderParameter) parameter;
addHeader(headers, headerParameter.getName(), "", getDefaultStringValue(headerParameter.getDescription()), "", parameter.getRequired());
addHeader(headers, headerParameter.getName(), String.valueOf(headerParameter.getExample()), getDefaultStringValue(headerParameter.getDescription()), "", parameter.getRequired());
}
private HttpResponse parseResponse(ApiResponses responses) {
@ -201,9 +201,9 @@ public class Swagger3Parser extends SwaggerAbstractParser {
msResponse.setStatusCode(new ArrayList<>());
if (responses != null) {
responses.forEach((responseCode, response) -> {
msResponse.getStatusCode().add(new KeyValue(responseCode, responseCode));
parseResponseHeader(response, msResponse.getHeaders());
parseResponseBody(response, msResponse.getBody());
parseResponseCode(responseCode, msResponse);
});
}
return msResponse;
@ -213,11 +213,17 @@ public class Swagger3Parser extends SwaggerAbstractParser {
Map<String, Header> headers = response.getHeaders();
if (headers != null) {
headers.forEach((k, v) -> {
msHeaders.add(new KeyValue(k, "", v.getDescription()));
msHeaders.add(new KeyValue(k, String.valueOf(v.getExample()), v.getDescription()));
});
}
}
private void parseResponseCode(String response, HttpResponse msResponse) {
if (StringUtils.isNotEmpty(response)) {
msResponse.setStatusCode(JSON.parseObject(response, List.class));
}
}
private void parseResponseBody(ApiResponse response, Body body) {
body.setRaw(response.getDescription());
Content content = response.getContent();
@ -245,7 +251,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
MediaType mediaType = content.get(contentType);
if (mediaType == null) {
Set<String> contentTypes = content.keySet();
if(contentTypes.size() == 0) { // 防止空指针
if (contentTypes.size() == 0) { // 防止空指针
return;
}
contentType = contentTypes.iterator().next();
@ -295,7 +301,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
kv.setType("file");
}
}
if(body.getKvs() == null) { // 防止空指针
if (body.getKvs() == null) { // 防止空指针
body.setKvs(new ArrayList<>());
}
body.getKvs().add(kv);
@ -359,17 +365,17 @@ public class Swagger3Parser extends SwaggerAbstractParser {
} else if (schema instanceof BinarySchema) {
return getDefaultValueByPropertyType(schema);
} else {
if(schema.getType() != null) { // 特判属性不是对象的情况直接将基本类型赋值进去
if(StringUtils.equals(schema.getType(), "string")) {
if (schema.getType() != null) { // 特判属性不是对象的情况直接将基本类型赋值进去
if (StringUtils.equals(schema.getType(), "string")) {
Object exampleObj = schema.getExample();
String example = null;
if (exampleObj != null) {
example = exampleObj.toString();
}
return example == null ? "" : example;
} else if(StringUtils.equals(schema.getType(), "boolean")) {
} else if (StringUtils.equals(schema.getType(), "boolean")) {
return schema.getExample();
} else if(StringUtils.equals(schema.getType(), "double")) {
} else if (StringUtils.equals(schema.getType(), "double")) {
return schema.getExample();
}
}
@ -388,7 +394,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
}
JSONObject jsonObject = new JSONObject(true);
properties.forEach((key, value) -> {
jsonObject.put(key, parseSchema(value, refSet, infoMap));
jsonObject.put(key, parseSchema(value, refSet, infoMap));
});
return jsonObject;
}
@ -406,45 +412,46 @@ public class Swagger3Parser extends SwaggerAbstractParser {
private void parseQueryParameters(Parameter parameter, List<KeyValue> arguments) {
QueryParameter queryParameter = (QueryParameter) parameter;
arguments.add(new KeyValue(queryParameter.getName(), "", getDefaultStringValue(queryParameter.getDescription()), parameter.getRequired()));
arguments.add(new KeyValue(queryParameter.getName(), String.valueOf(queryParameter.getExample()), getDefaultStringValue(queryParameter.getDescription()), parameter.getRequired()));
}
/* 导出的 swagger json描述文件样例
{
"openapi":"3.0.1",
"info":{},
"externalDocs":{},
"servers":{},
"tags":{},
"paths":{ // 对应 SwaggerApiExportResult 类的paths
"/lzx/test/{ball}":{ // key
"get":{ // 对应 SwaggerPath 类的 JSONObject 类型的成员get为key
"tags":[
"subModule2"
],
"summary":"API",
"parameters":[
{
"name":"ballName",
"in":"query",// path,header,query都可选
"description":"描述param",
"required":true // 是否必填参数
}
],
"requestBody":{
"content":{
"application/octet-stream":{ // type
"schema":{
"type":null,
"format":null
/* 导出的 swagger json描述文件样例
{
"openapi":"3.0.1",
"info":{},
"externalDocs":{},
"servers":{},
"tags":{},
"paths":{ // 对应 SwaggerApiExportResult 类的paths
"/lzx/test/{ball}":{ // key
"get":{ // 对应 SwaggerPath 类的 JSONObject 类型的成员get为key
"tags":[
"subModule2"
],
"summary":"API",
"parameters":[
{
"name":"ballName",
"in":"query",// path,header,query都可选
"description":"描述param",
"required":true // 是否必填参数
}
],
"requestBody":{
"content":{
"application/octet-stream":{ // type
"schema":{
"type":null,
"format":null
}
}
}
}
}
} // SwaggerApiInfo类 value
}
},
"components":{}
} */
} // SwaggerApiInfo类 value
}
},
"components":{}
} */
public SwaggerApiExportResult swagger3Export(List<ApiDefinitionWithBLOBs> apiDefinitionList) {
SwaggerApiExportResult result = new SwaggerApiExportResult();
@ -456,13 +463,13 @@ public class Swagger3Parser extends SwaggerAbstractParser {
result.setExternalDocs(new JSONObject());
JSONObject paths = new JSONObject();
for(ApiDefinitionWithBLOBs apiDefinition : apiDefinitionList) {
for (ApiDefinitionWithBLOBs apiDefinition : apiDefinitionList) {
SwaggerApiInfo swaggerApiInfo = new SwaggerApiInfo(); // {tags:, summary:, description:, parameters:}
swaggerApiInfo.setSummary(apiDefinition.getName());
// 设置导入后的模块名 根据 api moduleID 查库获得所属模块作为导出的模块名
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
String moduleName = "";
if(apiDefinition.getModuleId() != null) { // module_id 可能为空
if (apiDefinition.getModuleId() != null) { // module_id 可能为空
ApiModuleDTO node = apiModuleService.getNode(apiDefinition.getModuleId());
if (node != null) {
moduleName = node.getName();
@ -480,7 +487,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
List<JSONObject> paramsList = buildParameters(requestObject);
swaggerApiInfo.setParameters(paramsList);
JSONObject methodDetail = JSON.parseObject(JSON.toJSONString(swaggerApiInfo));
if(paths.getJSONObject(apiDefinition.getPath()) == null) {
if (paths.getJSONObject(apiDefinition.getPath()) == null) {
paths.put(apiDefinition.getPath(), new JSONObject());
} // 一个路径下有多个发方法如postget因此是一个 JSONObject 类型
paths.getJSONObject(apiDefinition.getPath()).put(apiDefinition.getMethod().toLowerCase(), methodDetail);
@ -497,12 +504,12 @@ public class Swagger3Parser extends SwaggerAbstractParser {
put("arguments", "query");
}};
Set<String> typeKeys = typeMap.keySet();
for(String type : typeKeys) {
for (String type : typeKeys) {
JSONArray params = request.getJSONArray(type); // 获得请求参数列表
if(params != null) {
for(int i = 0; i < params.size(); ++i) {
if (params != null) {
for (int i = 0; i < params.size(); ++i) {
JSONObject param = params.getJSONObject(i); // 对于每个参数:
if(param.get("name") == null || StringUtils.isEmpty(((String) param.get("name")))) {
if (param.get("name") == null || StringUtils.isEmpty(((String) param.get("name")))) {
continue;
} // 否则无参数的情况可能多出一行空行
SwaggerParams swaggerParam = new SwaggerParams();
@ -510,6 +517,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
swaggerParam.setDescription((String) param.get("description"));
swaggerParam.setName((String) param.get("name"));
swaggerParam.setRequired((boolean) param.get("required"));
swaggerParam.setExample((String) param.get("value"));
// 请求头 value 没有导出
// JSONObject schema = new JSONObject();
// swaggerParam.setSchema(schema);
@ -533,7 +541,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
// 将请求体中的一个 json 对象转换成 swagger 格式的 json 对象返回
private JSONObject buildRequestBodyJsonInfo(JSONObject requestBody) {
if(requestBody == null)
if (requestBody == null)
return null;
JSONObject schema = new JSONObject();
schema.put("type", "object");
@ -555,32 +563,31 @@ public class Swagger3Parser extends SwaggerAbstractParser {
}
} */
private JSONObject buildRequestBodyJsonInfo(JSONArray requestBody) {
if(requestBody == null)
if (requestBody == null)
return null;
JSONObject schema = new JSONObject();
schema.put("type", "array");
JSONObject items = new JSONObject();
if(requestBody.size() > 0) {
if (requestBody.size() > 0) {
Object example = requestBody.get(0);
if(example instanceof JSONObject) {
if (example instanceof JSONObject) {
items.put("type", "object");
items.put("properties", buildSchema((JSONObject) example));
} else if(example instanceof java.lang.String) {
} else if (example instanceof java.lang.String) {
items.put("type", "string");
} else if(example instanceof java.lang.Integer) {
} else if (example instanceof java.lang.Integer) {
items.put("type", "integer");
items.put("format", "int64");
} else if(example instanceof java.lang.Boolean) {
} else if (example instanceof java.lang.Boolean) {
items.put("type", "boolean");
} else if(example instanceof java.math.BigDecimal) {
} else if (example instanceof java.math.BigDecimal) {
items.put("type", "double");
}
else { // JSONOArray
} else { // JSONOArray
items.put("type", "array");
JSONObject item = new JSONObject();
if(((JSONArray) example).size() > 0) {
if(((JSONArray) example).get(0) instanceof JSONObject) {
if (((JSONArray) example).size() > 0) {
if (((JSONArray) example).get(0) instanceof JSONObject) {
item = buildRequestBodyJsonInfo((JSONObject) ((JSONArray) example).get(0));
}
}
@ -604,7 +611,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
parsedParam.put("description", requestBody.getString("description"));
}
parsedParam.put("items", item);
} else if(StringUtils.equals(type, "object")) {
} else if (StringUtils.equals(type, "object")) {
parsedParam.put("type", "object");
JSONObject properties = requestBody.getJSONObject("properties");
JSONObject swaggerProperties = new JSONObject();
@ -619,14 +626,14 @@ public class Swagger3Parser extends SwaggerAbstractParser {
parsedParam.put("description", requestBody.getString("description"));
}
parsedParam.put("properties", swaggerProperties);
} else if(StringUtils.equals(type, "integer")) {
} else if (StringUtils.equals(type, "integer")) {
parsedParam.put("type", "integer");
parsedParam.put("format", "int64");
setCommonJsonSchemaParam(parsedParam, requestBody);
} else if(StringUtils.equals(type, "boolean")) {
} else if (StringUtils.equals(type, "boolean")) {
parsedParam.put("type", "boolean");
setCommonJsonSchemaParam(parsedParam, requestBody);
} else if(StringUtils.equals(type, "number")) { // double 类型会被 fastJson 转换为 BigDecimal
} else if (StringUtils.equals(type, "number")) { // double 类型会被 fastJson 转换为 BigDecimal
parsedParam.put("type", "double");
setCommonJsonSchemaParam(parsedParam, requestBody);
} else {
@ -636,6 +643,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
}
return parsedParam;
}
public void setCommonJsonSchemaParam(JSONObject parsedParam, JSONObject requestBody) {
if (StringUtils.isNotBlank(requestBody.getString("description"))) {
parsedParam.put("description", requestBody.getString("description"));
@ -658,22 +666,22 @@ public class Swagger3Parser extends SwaggerAbstractParser {
// 设置一个 json 对象的属性在 swagger 格式中的类型
private JSONObject buildSchema(JSONObject requestBody) {
JSONObject schema = new JSONObject();
for(String key : requestBody.keySet()) {
for (String key : requestBody.keySet()) {
Object param = requestBody.get(key);
JSONObject parsedParam = new JSONObject();
if(param instanceof java.lang.String) {
if (param instanceof java.lang.String) {
parsedParam.put("type", "string");
parsedParam.put("example", param == null? "" : param);
} else if(param instanceof java.lang.Integer) {
parsedParam.put("example", param == null ? "" : param);
} else if (param instanceof java.lang.Integer) {
parsedParam.put("type", "integer");
parsedParam.put("format", "int64");
parsedParam.put("example", param);
} else if(param instanceof JSONObject) {
} else if (param instanceof JSONObject) {
parsedParam = buildRequestBodyJsonInfo((JSONObject) param);
} else if(param instanceof java.lang.Boolean) {
} else if (param instanceof java.lang.Boolean) {
parsedParam.put("type", "boolean");
parsedParam.put("example", param);
} else if(param instanceof java.math.BigDecimal) { // double 类型会被 fastJson 转换为 BigDecimal
} else if (param instanceof java.math.BigDecimal) { // double 类型会被 fastJson 转换为 BigDecimal
parsedParam.put("type", "double");
parsedParam.put("example", param);
} else { // JSONOArray
@ -682,8 +690,8 @@ public class Swagger3Parser extends SwaggerAbstractParser {
if (param == null) {
param = new JSONArray();
}
if(((JSONArray) param).size() > 0) {
if(((JSONArray) param).get(0) instanceof JSONObject) { ///
if (((JSONArray) param).size() > 0) {
if (((JSONArray) param).get(0) instanceof JSONObject) { ///
item = buildRequestBodyJsonInfo((JSONObject) ((JSONArray) param).get(0));
}
}
@ -697,7 +705,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
private JSONObject buildformDataSchema(JSONObject kvs) {
JSONObject schema = new JSONObject();
JSONObject properties = new JSONObject();
for(String key : kvs.keySet()) {
for (String key : kvs.keySet()) {
JSONObject property = new JSONObject();
property.put("type", "string");
property.put("example", kvs.getString(key));
@ -709,11 +717,11 @@ public class Swagger3Parser extends SwaggerAbstractParser {
private JSONObject getformDataProperties(JSONArray requestBody) {
JSONObject result = new JSONObject();
for(Object item : requestBody) {
if(item instanceof JSONObject) {
for (Object item : requestBody) {
if (item instanceof JSONObject) {
String name = ((JSONObject) item).getString("name");
String value = ((JSONObject) item).getString("value");
if(name != null) {
if (name != null) {
result.put(name, value);
}
}
@ -721,15 +729,15 @@ public class Swagger3Parser extends SwaggerAbstractParser {
return result;
}
/* 请求头格式
"headers":{
"headerName":{
"schema":{
"type":"string"
/* 请求头格式
"headers":{
"headerName":{
"schema":{
"type":"string"
}
}
}
}
*/
*/
private JSONObject buildResponseBody(JSONObject response) {
if (response == null) {
return new JSONObject();
@ -739,11 +747,12 @@ public class Swagger3Parser extends SwaggerAbstractParser {
// build 请求头
JSONObject headers = new JSONObject();
JSONArray headValueList = response.getJSONArray("headers");
if(headValueList != null) {
for(Object item : headValueList) {
if(item instanceof JSONObject && ((JSONObject) item).getString("name") != null) {
if (headValueList != null) {
for (Object item : headValueList) {
if (item instanceof JSONObject && ((JSONObject) item).getString("name") != null) {
JSONObject head = new JSONObject(), headSchema = new JSONObject();
head.put("description", "");
head.put("example", ((JSONObject) item).getString("value"));
headSchema.put("type", "string");
head.put("schema", headSchema);
headers.put(((JSONObject) item).getString("name"), head);
@ -752,28 +761,28 @@ public class Swagger3Parser extends SwaggerAbstractParser {
}
statusCodeInfo.put("headers", headers);
// 返回code
JSONArray statusCode = response.getJSONArray("statusCode");
// build 请求体
if (statusCode == null || statusCode.size() < 1 || statusCode.getJSONObject(0).getString("name") == null) {
return response;
}
statusCodeInfo.put("content", buildContent(response));
statusCodeInfo.put("description", "");
responseBody.put(((JSONObject) response.getJSONArray("statusCode").get(0)).getString("name"), statusCodeInfo);
responseBody.put(JSON.toJSONString(statusCode), statusCodeInfo);
return responseBody;
}
/* 请求体格式
"content":{
"application/json":{
"schema":{
"type":"xxx",
"xxx":{...}
/* 请求体格式
"content":{
"application/json":{
"schema":{
"type":"xxx",
"xxx":{...}
}
}
}
}
*/
*/
private JSONObject buildContent(JSONObject respOrReq) {
Hashtable<String, String> typeMap = new Hashtable<String, String>() {{
put("XML", org.springframework.http.MediaType.APPLICATION_XML_VALUE);
@ -786,11 +795,11 @@ public class Swagger3Parser extends SwaggerAbstractParser {
Object bodyInfo = new Object();
JSONObject body = respOrReq.getJSONObject("body");
if(body != null) { // 将请求体转换成相应的格式导出
if (body != null) { // 将请求体转换成相应的格式导出
String bodyType = body.getString("type");
if(bodyType == null) {
if (bodyType == null) {
} else if(bodyType.equals("JSON")) {
} else if (bodyType.equals("JSON")) {
try {
if (StringUtils.equals(body.getString("format"), "JSON-SCHEMA")) {
// String jsonSchema = JSONSchemaGenerator.getJson(body.getString("jsonSchema"));
@ -811,7 +820,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
bodyInfo = buildJsonSchema(jsonObject, required);
}
} else {
try{ // 若请求体是一个 object
try { // 若请求体是一个 object
bodyInfo = buildRequestBodyJsonInfo(body.getJSONArray("raw"));
} catch (Exception e) {
bodyInfo = buildRequestBodyJsonInfo(body.getJSONObject("raw"));
@ -824,11 +833,11 @@ public class Swagger3Parser extends SwaggerAbstractParser {
((JSONObject) bodyInfo).put("example", body.get("raw").toString());
}
}
} else if(bodyType.equals("XML")) {
} else if (bodyType.equals("XML")) {
String xmlText = body.getString("raw");
JSONObject xmlToJson = XMLUtils.XmlToJson(xmlText);
bodyInfo = buildRequestBodyJsonInfo(xmlToJson);
} else if(bodyType.equals("WWW_FORM") || bodyType.equals("Form Data") || bodyType.equals("BINARY")) { // key-value 类格式
} else if (bodyType.equals("WWW_FORM") || bodyType.equals("Form Data") || bodyType.equals("BINARY")) { // key-value 类格式
JSONObject formData = getformDataProperties(body.getJSONArray("kvs"));
bodyInfo = buildformDataSchema(formData);
}

View File

@ -7,6 +7,7 @@ import lombok.*;
@Setter
public class SwaggerParams {
private String name; // 对应 API 请求参数名
private String example; // 参数值
private String in; // 参数类型可选值为 path,header,query
private String description;
private boolean required; // 是否是必填参数

View File

@ -180,16 +180,6 @@ public class ElementUtil {
public static String getParentName(MsTestElement parent) {
if (parent != null) {
// if (MsTestElementConstants.TransactionController.name().equals(parent.getType())) {
// MsTransactionController transactionController = (MsTransactionController) parent;
// if (StringUtils.isNotEmpty(transactionController.getName())) {
// return transactionController.getName();
// } else if (StringUtils.isNotEmpty(transactionController.getLabelName())) {
// return transactionController.getLabelName();
// } else {
// return "TransactionController";
// }
// }
// 获取全路径以备后面使用
String fullPath = getFullPath(parent, new String());
return fullPath + DelimiterConstants.SEPARATOR.toString() + parent.getName();
@ -291,6 +281,21 @@ public class ElementUtil {
}
}
public static void relationships(JSONArray hashTree, List<String> referenceRelationships) {
for (int i = 0; i < hashTree.size(); i++) {
JSONObject element = hashTree.getJSONObject(i);
if (element != null && StringUtils.equals(element.get("type").toString(), "scenario") && StringUtils.equals(element.get("referenced").toString(), "REF")) {
if (!referenceRelationships.contains(element.get("id").toString())) {
referenceRelationships.add(element.get("id").toString());
}
}
if (element.containsKey("hashTree")) {
JSONArray elementJSONArray = element.getJSONArray("hashTree");
relationships(elementJSONArray, referenceRelationships);
}
}
}
public static void dataFormatting(JSONArray hashTree) {
for (int i = 0; i < hashTree.size(); i++) {
JSONObject element = hashTree.getJSONObject(i);

View File

@ -1,13 +1,25 @@
package io.metersphere.api.dto.definition.request;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONType;
import io.metersphere.api.dto.RunningParamKeys;
import io.metersphere.api.dto.definition.request.processors.MsJSR223Processor;
import io.metersphere.api.dto.definition.request.sampler.MsDebugSampler;
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
import io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler;
import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler;
import io.metersphere.api.dto.mockconfig.MockConfigStaticData;
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.commons.constants.RunModeConstants;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.plugin.core.MsParameter;
import io.metersphere.plugin.core.MsTestElement;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.control.LoopController;
import org.apache.jmeter.protocol.http.control.CookieManager;
import org.apache.jmeter.save.SaveService;
@ -15,7 +27,9 @@ import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.threads.ThreadGroup;
import org.apache.jorphan.collections.HashTree;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
@EqualsAndHashCode(callSuper = true)
@ -43,15 +57,157 @@ public class MsThreadGroup extends MsTestElement {
}
if (CollectionUtils.isNotEmpty(hashTree)) {
MsJSR223Processor preProcessor = null;
MsJSR223Processor postProcessor = null;
//获取projectConfig
String projectId = this.checkProjectId(hashTree);
this.checkEnviromentConfig(projectId,config,hashTree);
if (config.getConfig() != null) {
if (config.isEffective(projectId)) {
EnvironmentConfig environmentConfig = config.getConfig().get(projectId);
if (environmentConfig != null) {
preProcessor = environmentConfig.getPreProcessor();
postProcessor = environmentConfig.getPostProcessor();
}
}
}
//检查全局前后置脚本
if (preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) {
preProcessor.setType("JSR223Processor");
preProcessor.setName("PRE_PROCESSOR_ENV_"+preProcessor.isConnScenario());
preProcessor.setClazzName("io.metersphere.api.dto.definition.request.processors.MsJSR223Processor");
preProcessor.toHashTree(groupTree, preProcessor.getHashTree(), config);
}
for (MsTestElement el : hashTree) {
el.toHashTree(groupTree, el.getHashTree(), config);
}
if (postProcessor != null && StringUtils.isNotEmpty(postProcessor.getScript())) {
postProcessor.setType("JSR223Processor");
postProcessor.setName("POST_PROCESSOR_ENV_"+preProcessor.isConnScenario());
postProcessor.setClazzName("io.metersphere.api.dto.definition.request.processors.MsJSR223Processor");
postProcessor.toHashTree(groupTree, postProcessor.getHashTree(), config);
}
MsDebugSampler el = new MsDebugSampler();
el.setName(RunningParamKeys.RUNNING_DEBUG_SAMPLER_NAME);
el.toHashTree(groupTree, el.getHashTree(), config);
}
}
private String checkProjectId(List<MsTestElement> hashTree) {
String projectId = this.getProjectId();
if (StringUtils.isEmpty(projectId)) {
for (MsTestElement el : hashTree) {
if (el instanceof MsHTTPSamplerProxy) {
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) el;
projectId = httpSamplerProxy.getProjectId();
if (StringUtils.isNotEmpty(projectId)) {
break;
}
} else if (el instanceof MsJDBCSampler) {
MsJDBCSampler jdbcSampler = (MsJDBCSampler) el;
projectId = jdbcSampler.getProjectId();
if (StringUtils.isNotEmpty(projectId)) {
break;
}
} else if (el instanceof MsTCPSampler) {
MsTCPSampler tcpSampler = (MsTCPSampler) el;
projectId = tcpSampler.getProjectId();
if (StringUtils.isNotEmpty(projectId)) {
break;
}
} else if (el instanceof MsScenario) {
MsScenario scenario = (MsScenario)el;
if(scenario.getHashTree() != null){
for (MsTestElement itemEl : scenario.getHashTree()) {
if (itemEl instanceof MsHTTPSamplerProxy) {
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) itemEl;
projectId = httpSamplerProxy.getProjectId();
if (StringUtils.isNotEmpty(projectId)) {
break;
}
} else if (itemEl instanceof MsJDBCSampler) {
MsJDBCSampler jdbcSampler = (MsJDBCSampler) itemEl;
projectId = jdbcSampler.getProjectId();
if (StringUtils.isNotEmpty(projectId)) {
break;
}
} else if (itemEl instanceof MsTCPSampler) {
MsTCPSampler tcpSampler = (MsTCPSampler) itemEl;
projectId = tcpSampler.getProjectId();
if (StringUtils.isNotEmpty(projectId)) {
break;
}
}
}
}
}
}
}
return projectId;
}
private void checkEnviromentConfig(String projectId, ParameterConfig config, List<MsTestElement> hashTree) {
//检查全局前后置脚本
if (config.getConfig() == null) {
// 单独接口执行
this.setProjectId(projectId);
String environmentId = null;
for (MsTestElement el : hashTree) {
if (el instanceof MsHTTPSamplerProxy) {
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) el;
environmentId = httpSamplerProxy.getUseEnvironment();
if (StringUtils.isNotEmpty(environmentId)) {
break;
}
} else if (el instanceof MsJDBCSampler) {
MsJDBCSampler jdbcSampler = (MsJDBCSampler) el;
environmentId = jdbcSampler.getEnvironmentId();
if (StringUtils.isNotEmpty(environmentId)) {
break;
}
} else if (el instanceof MsTCPSampler) {
MsTCPSampler tcpSampler = (MsTCPSampler) el;
environmentId = tcpSampler.getUseEnvironment();
if (StringUtils.isNotEmpty(environmentId)) {
break;
}
} else if (el instanceof MsScenario) {
Map<String, EnvironmentConfig> envConfig = new HashMap<>(16);
MsScenario scenario = (MsScenario)el;
// 兼容历史数据
if (scenario.getEnvironmentMap() == null || scenario.getEnvironmentMap().isEmpty()) {
scenario.setEnvironmentMap(new HashMap<>(16));
if (StringUtils.isNotBlank(environmentId)) {
// 兼容1.8之前 没有environmentMap但有environmentId的数据
scenario.getEnvironmentMap().put(RunModeConstants.HIS_PRO_ID.toString(), environmentId);
}
}
if (scenario.getEnvironmentMap() != null && !scenario.getEnvironmentMap().isEmpty()) {
scenario.getEnvironmentMap().keySet().forEach(itemProjectId -> {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
ApiTestEnvironmentWithBLOBs environment = environmentService.get(scenario.getEnvironmentMap().get(itemProjectId));
if (environment != null && environment.getConfig() != null) {
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
env.setApiEnvironmentid(environment.getId());
envConfig.put(itemProjectId, env);
if (StringUtils.equals(environment.getName(), MockConfigStaticData.MOCK_EVN_NAME)) {
this.setMockEnvironment(true);
}
}
});
config.setConfig(envConfig);
}
}
}
if (StringUtils.isNotEmpty(environmentId)) {
config.setConfig(ElementUtil.getEnvironmentConfig(environmentId, projectId, this.isMockEnvironment()));
}
}
}
public ThreadGroup getThreadGroup() {
LoopController loopController = new LoopController();
loopController.setName("LoopController");

View File

@ -36,6 +36,9 @@ public class MsJSR223Processor extends MsTestElement {
@JSONField(ordinal = 21)
private String scriptLanguage;
@JSONField(ordinal = 22)
private boolean connScenario = true;
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, MsParameter msParameter) {
ParameterConfig config = (ParameterConfig) msParameter;

View File

@ -175,7 +175,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
if (StringUtils.isEmpty(this.getEnvironmentId())) {
this.setEnvironmentId(this.useEnvironment);
}
// 非导出操作且不是启用状态则跳过执行
// 非导出操作且不是启用状态则跳过执行Ms
if (!config.isOperating() && !this.isEnable()) {
return;
}
@ -270,10 +270,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
addCertificate(config, httpSamplerTree);
//增加全局前后至脚本
if (httpConfig != null) {
this.setScript(httpConfig, httpSamplerTree, config);
}
if (CollectionUtils.isNotEmpty(hashTree)) {
for (MsTestElement el : hashTree) {
if (el.getEnvironmentId() == null) {
@ -288,32 +284,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
}
private void setScript(HttpConfig httpConfig, HashTree httpSamplerTree, ParameterConfig config) {
MsJSR223PreProcessor preProcessor = httpConfig.getPreProcessor();
MsJSR223PostProcessor postProcessor = httpConfig.getPostProcessor();
if (preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) {
if (preProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
preProcessor.setEnvironmentId(useEnvironment);
} else {
preProcessor.setEnvironmentId(this.getEnvironmentId());
}
}
preProcessor.toHashTree(httpSamplerTree, preProcessor.getHashTree(), config);
}
if (postProcessor != null && StringUtils.isNotEmpty(postProcessor.getScript())) {
if (postProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
postProcessor.setEnvironmentId(useEnvironment);
} else {
postProcessor.setEnvironmentId(this.getEnvironmentId());
}
}
postProcessor.toHashTree(httpSamplerTree, postProcessor.getHashTree(), config);
}
}
private void initConnectAndResponseTimeout(ParameterConfig config) {
if (config.isEffective(this.getProjectId())) {
String useEvnId = config.getConfig().get(this.getProjectId()).getApiEnvironmentid();
@ -358,8 +328,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
this.setEnvironmentId(useEvnId);
}
HttpConfig httpConfig = matchConfig(config);
httpConfig.setPreProcessor(environmentConfig.getPreProcessor());
httpConfig.setPostProcessor(environmentConfig.getPostProcessor());
return httpConfig;
}
}
@ -388,7 +356,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
if (isUrl()) {
if (this.isCustomizeReq()) {
url = this.getUrl();
sampler.setPath(url);
sampler.setProperty("HTTPSampler.path", url);
}
if (StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
url = url.replace(this.getPort(), "10990");
@ -403,7 +371,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setPort(urlObject.getPort());
}
sampler.setProtocol(urlObject.getProtocol());
sampler.setPath(URLDecoder.decode(URLEncoder.encode(urlObject.getFile(), "UTF-8"), "UTF-8"));
sampler.setProperty("HTTPSampler.path", URLDecoder.decode(URLEncoder.encode(urlObject.getFile(), "UTF-8"), "UTF-8"));
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
}
@ -433,13 +401,13 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), "UTF-8"));
sampler.setProtocol(urlObject.getProtocol());
}
sampler.setPath(URLDecoder.decode(URLEncoder.encode(envPath, "UTF-8"), "UTF-8"));
sampler.setProperty("HTTPSampler.path", URLDecoder.decode(URLEncoder.encode(envPath, "UTF-8"), "UTF-8"));
}
}
String envPath = sampler.getPath();
if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) {
envPath = getRestParameters(envPath);
sampler.setPath(envPath);
sampler.setProperty("HTTPSampler.path", envPath);
}
if (CollectionUtils.isNotEmpty(this.getArguments())) {
String path = getPostQueryParameters(envPath);
@ -477,13 +445,13 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
sampler.setProtocol(urlObject.getProtocol());
String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getFile();
sampler.setPath(envPath);
sampler.setProperty("HTTPSampler.path", envPath);
if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) {
envPath = getRestParameters(URLDecoder.decode(URLEncoder.encode(envPath, "UTF-8"), "UTF-8"));
sampler.setPath(envPath);
sampler.setProperty("HTTPSampler.path", envPath);
}
if (CollectionUtils.isNotEmpty(this.getArguments())) {
sampler.setPath(getPostQueryParameters(URLDecoder.decode(URLEncoder.encode(envPath, "UTF-8"), "UTF-8")));
sampler.setProperty("HTTPSampler.path", getPostQueryParameters(URLDecoder.decode(URLEncoder.encode(envPath, "UTF-8"), "UTF-8")));
}
}
} catch (Exception e) {
@ -757,6 +725,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
apiDefinition = apiDefinitionService.get(this.getId());
if (apiDefinition == null) {
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseService.get(this.getId());
if (apiTestCaseWithBLOBs == null) {
apiTestCaseWithBLOBs = apiTestCaseService.get(this.getName());
}
if (apiTestCaseWithBLOBs != null) {
apiDefinition = apiDefinitionService.get(apiTestCaseWithBLOBs.getApiDefinitionId());
} else {

View File

@ -149,34 +149,34 @@ public class MsJDBCSampler extends MsTestElement {
tree.add(arguments);
}
MsJSR223PreProcessor preProcessor = null;
MsJSR223PostProcessor postProcessor = null;
if(envConfig != null){
preProcessor = envConfig.getPreProcessor();
postProcessor = envConfig.getPostProcessor();
}
//增加全局前后至脚本
if(preProcessor != null){
if (preProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
preProcessor.setEnvironmentId(useEnvironment);
} else {
preProcessor.setEnvironmentId(this.getEnvironmentId());
}
}
preProcessor.toHashTree(samplerHashTree, preProcessor.getHashTree(), config);
}
if(postProcessor != null){
if (postProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
postProcessor.setEnvironmentId(useEnvironment);
} else {
postProcessor.setEnvironmentId(this.getEnvironmentId());
}
}
postProcessor.toHashTree(samplerHashTree, postProcessor.getHashTree(), config);
}
// MsJSR223PreProcessor preProcessor = null;
// MsJSR223PostProcessor postProcessor = null;
// if(envConfig != null){
// preProcessor = envConfig.getPreProcessor();
// postProcessor = envConfig.getPostProcessor();
// }
//
// //增加全局前后至脚本
// if(preProcessor != null){
// if (preProcessor.getEnvironmentId() == null) {
// if (this.getEnvironmentId() == null) {
// preProcessor.setEnvironmentId(useEnvironment);
// } else {
// preProcessor.setEnvironmentId(this.getEnvironmentId());
// }
// }
// preProcessor.toHashTree(samplerHashTree, preProcessor.getHashTree(), config);
// }
// if(postProcessor != null){
// if (postProcessor.getEnvironmentId() == null) {
// if (this.getEnvironmentId() == null) {
// postProcessor.setEnvironmentId(useEnvironment);
// } else {
// postProcessor.setEnvironmentId(this.getEnvironmentId());
// }
// }
// postProcessor.toHashTree(samplerHashTree, postProcessor.getHashTree(), config);
// }
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {

View File

@ -148,33 +148,6 @@ public class MsTCPSampler extends MsTestElement {
samplerHashTree.add(tcpPreProcessor.getJSR223PreProcessor());
}
MsJSR223PreProcessor preProcessor = null;
MsJSR223PostProcessor postProcessor = null;
if(envConfig != null){
preProcessor = envConfig.getPreProcessor();
postProcessor = envConfig.getPostProcessor();
}
//增加全局前后至脚本
if(preProcessor != null){
if (preProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
preProcessor.setEnvironmentId(useEnvironment);
} else {
preProcessor.setEnvironmentId(this.getEnvironmentId());
}
}
preProcessor.toHashTree(samplerHashTree, preProcessor.getHashTree(), config);
}
if(postProcessor != null){
if (postProcessor.getEnvironmentId() == null) {
if (this.getEnvironmentId() == null) {
postProcessor.setEnvironmentId(useEnvironment);
} else {
postProcessor.setEnvironmentId(this.getEnvironmentId());
}
}
postProcessor.toHashTree(samplerHashTree, postProcessor.getHashTree(), config);
}
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
el.toHashTree(samplerHashTree, el.getHashTree(), config);

View File

@ -0,0 +1,438 @@
package io.metersphere.api.dto.mock;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONValidator;
import io.metersphere.api.dto.mockconfig.response.JsonSchemaReturnObj;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.json.JSONSchemaGenerator;
import io.metersphere.commons.utils.XMLUtils;
import io.metersphere.jmeter.utils.ScriptEngineUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.protocol.java.sampler.JSR223Sampler;
import org.apache.jmeter.samplers.SampleResult;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
* @author song.tianyang
* @Date 2021/10/14 3:00 下午
*/
public class MockApiUtils {
public static Map<String,String> getHttpRequestHeader(HttpServletRequest request){
Map<String,String> returnMap = new HashMap<>();
Enumeration<String> headers = request.getHeaderNames();
while (headers.hasMoreElements()){
String header = headers.nextElement();
String headerValue = request.getHeader(header);
returnMap.put(header,headerValue);
}
return returnMap;
}
public static boolean matchRequestHeader(JSONArray mockExpectHeaderArray, Map<String, String> requestHeaderMap) {
Map<String,String> mockExpectHeaders = new HashMap<>();
for(int i = 0; i < mockExpectHeaderArray.size(); i++){
JSONObject obj = mockExpectHeaderArray.getJSONObject(i);
if(obj.containsKey("name") && obj.containsKey("value") && obj.containsKey("enable")){
boolean enable = obj.getBoolean("enable");
if(enable){
mockExpectHeaders.put(obj.getString("name"),obj.getString("value"));
}
}
}
if(MapUtils.isEmpty(requestHeaderMap) && MapUtils.isNotEmpty(mockExpectHeaders)){
return false;
}else {
for (Map.Entry<String, String> entry: mockExpectHeaders.entrySet()){
String key = entry.getKey();
String value = entry.getValue();
if(!requestHeaderMap.containsKey(key)){
return false;
}else {
if(!StringUtils.equals(value,requestHeaderMap.get(key))){
return false;
}
}
}
return true;
}
}
public static JSONArray getExpectBodyParams(JSONObject bodyObj) {
JSONArray returnJsonArray = new JSONArray();
try {
String type = bodyObj.getString("type");
if (StringUtils.equalsIgnoreCase(type, "JSON")) {
//判断是否是JsonSchema
boolean isJsonSchema = false;
if (bodyObj.containsKey("format")) {
String foramtValue = String.valueOf(bodyObj.get("format"));
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
isJsonSchema = true;
}
}
String jsonString = "";
if (isJsonSchema) {
if (bodyObj.containsKey("jsonSchema") && bodyObj.getJSONObject("jsonSchema").containsKey("properties")) {
String bodyRetunStr = bodyObj.getJSONObject("jsonSchema").getJSONObject("properties").toJSONString();
jsonString = JSONSchemaGenerator.getJson(bodyRetunStr);
// JSONObject bodyReturnObj = JSONObject.parseObject(bodyRetunStr);
// JSONObject returnObj = parseJsonSchema(bodyReturnObj);
// returnStr = returnObj.toJSONString();
}
} else {
if (bodyObj.containsKey("raw")) {
jsonString = bodyObj.getString("raw");
}
}
JSONValidator jsonValidator = JSONValidator.from(jsonString);
if (StringUtils.equalsIgnoreCase("Array", jsonValidator.getType().name())) {
returnJsonArray = JSONArray.parseArray(jsonString);
} else if (StringUtils.equalsIgnoreCase("Object", jsonValidator.getType().name())) {
JSONObject jsonObject = JSONObject.parseObject(jsonString);
returnJsonArray.add(jsonObject);
}
} else if (StringUtils.equalsIgnoreCase(type, "XML")) {
if (bodyObj.containsKey("raw")) {
String xmlStr = bodyObj.getString("raw");
JSONObject matchObj = XMLUtils.XmlToJson(xmlStr);
returnJsonArray.add(matchObj);
}
} else if (StringUtils.equalsIgnoreCase(type, "Raw")) {
if (bodyObj.containsKey("raw")) {
String raw = bodyObj.getString("raw");
JSONObject rawObject = new JSONObject();
rawObject.put("raw",raw);
returnJsonArray.add(rawObject);
}
} else if (StringUtils.equalsAnyIgnoreCase(type, "Form Data", "WWW_FORM")) {
if (bodyObj.containsKey("kvs")) {
JSONObject bodyParamArr = new JSONObject();
JSONArray kvsArr = bodyObj.getJSONArray("kvs");
for (int i = 0; i < kvsArr.size(); i++) {
JSONObject kv = kvsArr.getJSONObject(i);
if (kv.containsKey("name")) {
String values = kv.getString("value");
if (StringUtils.isEmpty(values)) {
values = "";
} else {
try {
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
} catch (Exception e) {
}
}
bodyParamArr.put(kv.getString("name"), values);
}
}
returnJsonArray.add(bodyParamArr);
}
}
}catch (Exception e){}
return returnJsonArray;
}
public static JSONObject parseJsonSchema(JSONObject bodyReturnObj) {
JSONObject returnObj = new JSONObject();
if (bodyReturnObj == null) {
return returnObj;
}
Set<String> keySet = bodyReturnObj.keySet();
for (String key : keySet) {
try {
JsonSchemaReturnObj obj = bodyReturnObj.getObject(key, JsonSchemaReturnObj.class);
if (StringUtils.equals("object", obj.getType())) {
JSONObject itemObj = parseJsonSchema(obj.getProperties());
if (!itemObj.isEmpty()) {
returnObj.put(key, itemObj);
}
} else if (StringUtils.equals("array", obj.getType())) {
if (obj.getItems() != null) {
JSONObject itemObj = obj.getItems();
if (itemObj.containsKey("type")) {
if (StringUtils.equals("object", itemObj.getString("type")) && itemObj.containsKey("properties")) {
JSONObject arrayObj = itemObj.getJSONObject("properties");
JSONObject parseObj = parseJsonSchema(arrayObj);
JSONArray array = new JSONArray();
array.add(parseObj);
returnObj.put(key, array);
} else if (StringUtils.equals("string", itemObj.getString("type")) && itemObj.containsKey("mock")) {
JsonSchemaReturnObj arrayObj = JSONObject.toJavaObject(itemObj, JsonSchemaReturnObj.class);
String value = getMockValues(arrayObj.getMockValue());
JSONArray array = new JSONArray();
array.add(value);
returnObj.put(key, array);
}
}
}
} else {
String values = obj.getMockValue();
if (StringUtils.isEmpty(values)) {
values = "";
} else {
try {
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
} catch (Exception e) {
}
}
returnObj.put(key, values);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return returnObj;
}
private static String getMockValues(String values) {
if (StringUtils.isEmpty(values)) {
values = "";
} else {
try {
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
} catch (Exception e) {
}
}
return values;
}
public static JSONObject getParams(JSONArray array) {
JSONObject returnObject = new JSONObject();
for(int i = 0; i < array.size();i ++){
JSONObject obj = array.getJSONObject(i);
if(obj.containsKey("name") && obj.containsKey("value") && obj.containsKey("enable")){
boolean isEnable = obj.getBoolean("enable");
if(isEnable){
returnObject.put(obj.getString("name"),obj.getString("value"));
}
}
}
return returnObject;
}
public static Map<String, String> getApiResponse(String response) {
Map<String, String> returnMap = new HashMap<>();
String returnStr = "";
if(StringUtils.isNotEmpty(response)){
try {
JSONObject respObj = JSONObject.parseObject(response);
if (respObj.containsKey("body")) {
JSONObject bodyObj = respObj.getJSONObject("body");
if (bodyObj.containsKey("type")) {
String type = bodyObj.getString("type");
if (StringUtils.equals(type, "JSON")) {
//判断是否是JsonSchema
boolean isJsonSchema = false;
if (bodyObj.containsKey("format")) {
String foramtValue = String.valueOf(bodyObj.get("format"));
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
isJsonSchema = true;
}
}
if (isJsonSchema) {
if (bodyObj.containsKey("jsonSchema") && bodyObj.getJSONObject("jsonSchema").containsKey("properties")) {
String bodyRetunStr = bodyObj.getJSONObject("jsonSchema").getJSONObject("properties").toJSONString();
JSONObject bodyReturnObj = JSONObject.parseObject(bodyRetunStr);
JSONObject returnObj = MockApiUtils.parseJsonSchema(bodyReturnObj);
returnStr = returnObj.toJSONString();
}
} else {
if (bodyObj.containsKey("raw")) {
returnStr = bodyObj.getString("raw");
}
}
} else if (StringUtils.equalsAny(type, "XML", "Raw")) {
if (bodyObj.containsKey("raw")) {
String raw = bodyObj.getString("raw");
returnStr = raw;
}
} else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) {
Map<String, String> paramMap = new LinkedHashMap<>();
if (bodyObj.containsKey("kvs")) {
JSONArray bodyParamArr = new JSONArray();
JSONArray kvsArr = bodyObj.getJSONArray("kvs");
for (int i = 0; i < kvsArr.size(); i++) {
JSONObject kv = kvsArr.getJSONObject(i);
if (kv.containsKey("name")) {
String values = kv.getString("value");
if (StringUtils.isEmpty(values)) {
values = "";
} else {
try {
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
} catch (Exception e) {
}
}
paramMap.put(kv.getString("name"), values);
}
}
}
returnStr = JSONObject.toJSONString(paramMap);
}
}
}
}catch (Exception e){
MSException.throwException(e);
}
}
returnMap.put("returnMsg",returnStr);
return returnMap;
}
public static String getResultByResponseResult(JSONObject bodyObj,String url, Map<String,String> headerMap,RequestMockParams requestMockParams) {
if(headerMap == null){
headerMap = new HashMap<>();
}
if(requestMockParams == null){
requestMockParams = new RequestMockParams();
}
if(bodyObj == null && bodyObj.isEmpty()){
return "";
}else {
String returnStr = "";
if(bodyObj.containsKey("type")){
String type = bodyObj.getString("type");
if (StringUtils.equals(type, "JSON")) {
//判断是否是JsonSchema
boolean isJsonSchema = false;
if (bodyObj.containsKey("format")) {
String foramtValue = String.valueOf(bodyObj.get("format"));
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
isJsonSchema = true;
}
}
if (isJsonSchema) {
if (bodyObj.containsKey("jsonSchema") && bodyObj.getJSONObject("jsonSchema").containsKey("properties")) {
String bodyRetunStr = bodyObj.getJSONObject("jsonSchema").getJSONObject("properties").toJSONString();
JSONObject bodyReturnObj = JSONObject.parseObject(bodyRetunStr);
JSONObject returnObj = MockApiUtils.parseJsonSchema(bodyReturnObj);
returnStr = returnObj.toJSONString();
}
} else {
if (bodyObj.containsKey("raw")) {
returnStr = bodyObj.getString("raw");
}
}
} else if(StringUtils.equalsAnyIgnoreCase(type,"Raw")){
if (bodyObj.containsKey("raw")) {
String raw = bodyObj.getString("raw");
returnStr = raw;
}
} else if(StringUtils.equalsAnyIgnoreCase(type,"XML")){
if (bodyObj.containsKey("xmlHeader")) {
String xmlHeader = bodyObj.getString("xmlHeader");
if(!StringUtils.startsWith(xmlHeader,"<?") && !StringUtils.endsWith(xmlHeader,"?>")){
returnStr = "<?"+xmlHeader+"?>\r\n";
}else {
returnStr = xmlHeader;
}
}
if (bodyObj.containsKey("xmlRaw")) {
String raw = bodyObj.getString("xmlRaw");
returnStr = returnStr + raw;
}
} else if(StringUtils.equalsAnyIgnoreCase(type,"fromApi")){
if (bodyObj.containsKey("apiRspRaw")) {
String raw = bodyObj.getString("apiRspRaw");
returnStr = raw;
}
} else if(StringUtils.equalsAnyIgnoreCase(type,"script")){
if (bodyObj.containsKey("scriptObject")) {
JSONObject scriptObj = bodyObj.getJSONObject("scriptObject");
String script = scriptObj.getString("script");
String scriptLanguage =scriptObj.getString("scriptLanguage");
Map<String,String> scrpitParseMap = parseScript(script,url,headerMap,requestMockParams);
if(scrpitParseMap.containsKey("returnMsg")){
returnStr = scrpitParseMap.get("returnMsg");
}
if(scrpitParseMap.containsKey("script")){
script = scrpitParseMap.get("script");
}
runScript(script,scriptLanguage);
}
}
}
return returnStr;
}
}
private static Map<String,String> parseScript(String script,String url,Map<String,String> headerMap,RequestMockParams requestMockParams) {
Map<String,String> returnMap = new HashMap<>();
String returnMsg = "";
String newScript = "";
if(StringUtils.isNotEmpty(script)){
String [] scriptRowArr = StringUtils.split(script,"\n");
for (String scriptItemRows : scriptRowArr) {
String [] scriptItemArr = scriptItemRows.split(";");
for (String scriptRow :scriptItemArr) {
scriptRow = scriptRow.trim();
if(StringUtils.startsWith(scriptRow,"returnMsg.add(") && StringUtils.endsWith(scriptRow,")")){
scriptRow = scriptRow.substring(14,scriptRow.length()-1).trim();
if(StringUtils.equalsIgnoreCase(scriptRow,"@address")){
returnMsg += url;
}else if(StringUtils.startsWith(scriptRow,"@header(${") && StringUtils.endsWith(scriptRow,"})")){
String paramName = scriptRow.substring(10,scriptRow.length()-2);
if(headerMap.containsKey(paramName)){
returnMsg += headerMap.get(paramName);
}
}else if(StringUtils.startsWith(scriptRow,"@body(${") && StringUtils.endsWith(scriptRow,"})")){
String paramName = scriptRow.substring(8,scriptRow.length()-2);
if(requestMockParams.getBodyParams() != null && requestMockParams.getBodyParams().size() > 0){
JSONObject bodyParamObj = requestMockParams.getBodyParams().getJSONObject(0);
if(bodyParamObj.containsKey(paramName)){
returnMsg += String.valueOf(bodyParamObj.get(paramName));
}
}
}else if(StringUtils.equalsIgnoreCase(scriptRow,"@bodyRaw")){
if(requestMockParams.getBodyParams() != null && requestMockParams.getBodyParams().size() > 0){
JSONObject bodyParamObj = requestMockParams.getBodyParams().getJSONObject(0);
if(bodyParamObj.containsKey("raw")){
returnMsg += String.valueOf(bodyParamObj.get("raw"));
}
}
}else if(StringUtils.startsWith(scriptRow,"@query(${") && StringUtils.endsWith(scriptRow,"})")){
String paramName = scriptRow.substring(9,scriptRow.length()-2);
if(requestMockParams.getQueryParamsObj() != null && requestMockParams.getQueryParamsObj().containsKey(paramName)){
returnMsg += String.valueOf(requestMockParams.getQueryParamsObj().get(paramName));
}
}else if(StringUtils.startsWith(scriptRow,"@rest(${") && StringUtils.endsWith(scriptRow,"})")){
String paramName = scriptRow.substring(8,scriptRow.length()-2);
if(requestMockParams.getRestParamsObj() != null && requestMockParams.getRestParamsObj().containsKey(paramName)){
returnMsg += String.valueOf(requestMockParams.getRestParamsObj().get(paramName));
}
}else {
returnMsg += scriptRow;
}
}else {
newScript += scriptRow +";";
}
}
if(StringUtils.isNotEmpty(newScript)){
newScript += "\n";
}
}
}
returnMap.put("script",newScript);
returnMap.put("returnMsg",returnMsg);
return returnMap;
}
private static void runScript(String script, String scriptLanguage) {
JSR223Sampler jmeterScriptSampler = new JSR223Sampler();
jmeterScriptSampler.setScriptLanguage(scriptLanguage);
jmeterScriptSampler.setScript(script);
SampleResult result = jmeterScriptSampler.sample(null);
System.out.println(result.getResponseData());
}
}

View File

@ -0,0 +1,42 @@
package io.metersphere.api.dto.mock;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
/**
* @author song.tianyang
* @Date 2021/10/14 4:32 下午
*/
@Getter
@Setter
public class RequestMockParams {
private JSONObject restParamsObj;
private JSONObject queryParamsObj;
private JSONArray bodyParams;
public JSONObject getParamsObj(){
JSONObject returnObj = new JSONObject();
if(restParamsObj != null){
for (String key : restParamsObj.keySet()) {
Object value = restParamsObj.get(key);
returnObj.put(key,value);
}
}
if(queryParamsObj != null){
for (String key : queryParamsObj.keySet()) {
Object value = queryParamsObj.get(key);
returnObj.put(key,value);
}
}
return returnObj;
}
public boolean isEmpty() {
return (restParamsObj == null || restParamsObj.isEmpty()) &&
(queryParamsObj == null || queryParamsObj.isEmpty())&&
(bodyParams == null || bodyParams.isEmpty());
}
}

View File

@ -27,4 +27,6 @@ public class MockExpectConfigRequest {
private Object response;
private String status;
private String copyId;
}

View File

@ -1,7 +1,5 @@
package io.metersphere.api.dto.scenario;
import io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor;
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
import io.metersphere.base.domain.ApiModule;
import io.metersphere.base.domain.ApiModuleExample;
import io.metersphere.base.mapper.ApiModuleMapper;
@ -11,7 +9,6 @@ import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -26,9 +23,6 @@ public class HttpConfig {
private List<HttpConfigCondition> conditions;
private List<KeyValue> headers;
private MsJSR223PreProcessor preProcessor;
private MsJSR223PostProcessor postProcessor;
private ApiModuleMapper apiModuleMapper;
public HttpConfig initHttpConfig(HttpConfigCondition configCondition) {

View File

@ -1,6 +1,7 @@
package io.metersphere.api.dto.scenario.environment;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.definition.request.processors.MsJSR223Processor;
import io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor;
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
import io.metersphere.api.dto.scenario.DatabaseConfig;
@ -20,8 +21,8 @@ public class EnvironmentConfig {
private List<DatabaseConfig> databaseConfigs;
private TCPConfig tcpConfig;
private KeyStoreConfig sslConfig;
private MsJSR223PostProcessor postProcessor;
private MsJSR223PreProcessor preProcessor;
private MsJSR223Processor postProcessor;
private MsJSR223Processor preProcessor;
private JSONObject authManager;
public EnvironmentConfig() {

View File

@ -16,7 +16,6 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.config.JmeterProperties;
import io.metersphere.config.KafkaConfig;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.dto.NodeDTO;
import io.metersphere.i18n.Translator;
@ -33,7 +32,6 @@ import org.apache.jorphan.collections.HashTree;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.http.ResponseEntity;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.SendResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
@ -157,7 +155,7 @@ public class JMeterService {
if (baseInfo != null) {
platformUrl = baseInfo.getUrl();
}
platformUrl += "/api/jmeter/download?testId=" + testId + "&reportId=" + reportId + "&testPlanScenarioId" + "&runMode=" + runMode;
platformUrl += "/api/jmeter/download?testId=" + testId + "&reportId=" + reportId + "&runMode=" + runMode + "&testPlanScenarioId";
if (StringUtils.isNotEmpty(testPlanScenarioId)) {
platformUrl += "=" + testPlanScenarioId;
}
@ -176,12 +174,12 @@ public class JMeterService {
}
} else {
try {
SendResult result = kafkaTemplate.send(KafkaConfig.EXEC_TOPIC, JSON.toJSONString(runRequest)).get();
if (result != null) {
LogUtil.debug("获取ack 结果:" + result.getRecordMetadata());
}
kafkaTemplate.flush();
// this.send(runRequest,config,reportId);
// SendResult result = kafkaTemplate.send(KafkaConfig.EXEC_TOPIC, JSON.toJSONString(runRequest)).get();
// if (result != null) {
// LogUtil.debug("获取ack 结果:" + result.getRecordMetadata());
// }
// kafkaTemplate.flush();
this.send(runRequest, config, reportId);
} catch (Exception e) {
e.printStackTrace();
if (MessageCache.cache.get(config.getAmassReport()) != null
@ -192,7 +190,7 @@ public class JMeterService {
}
}
public void send(RunRequest runRequest, RunModeConfig config, String reportId) {
public synchronized void send(RunRequest runRequest, RunModeConfig config, String reportId) {
try {
int index = (int) (Math.random() * config.getTestResources().size());
JvmInfoDTO jvmInfoDTO = config.getTestResources().get(index);
@ -201,21 +199,17 @@ public class JMeterService {
NodeDTO node = JSON.parseObject(configuration, NodeDTO.class);
String nodeIp = node.getIp();
Integer port = node.getPort();
try {
String uri = String.format(BASE_URL + "/jmeter/api/start", nodeIp, port);
ResponseEntity<String> result = restTemplate.postForEntity(uri, runRequest, String.class);
if (result == null || !StringUtils.equals("SUCCESS", result.getBody())) {
// 清理零时报告
ApiScenarioReportService apiScenarioReportService = CommonBeanFactory.getBean(ApiScenarioReportService.class);
apiScenarioReportService.delete(reportId);
MSException.throwException("执行失败:" + result);
if (MessageCache.cache.get(config.getAmassReport()) != null
&& MessageCache.cache.get(config.getAmassReport()).getReportIds() != null) {
MessageCache.cache.get(config.getAmassReport()).getReportIds().remove(reportId);
}
String uri = String.format(BASE_URL + "/jmeter/api/start", nodeIp, port);
ResponseEntity<String> result = restTemplate.postForEntity(uri, runRequest, String.class);
if (result == null || !StringUtils.equals("SUCCESS", result.getBody())) {
// 清理零时报告
ApiScenarioReportService apiScenarioReportService = CommonBeanFactory.getBean(ApiScenarioReportService.class);
apiScenarioReportService.delete(reportId);
MSException.throwException("执行失败:" + result);
if (MessageCache.cache.get(config.getAmassReport()) != null
&& MessageCache.cache.get(config.getAmassReport()).getReportIds() != null) {
MessageCache.cache.get(config.getAmassReport()).getReportIds().remove(reportId);
}
} catch (Exception e) {
MSException.throwException(e.getMessage());
}
} catch (Exception e) {
if (MessageCache.cache.get(config.getAmassReport()) != null

View File

@ -58,6 +58,10 @@ public class MsKafkaListener {
private void save(String execResult) {
TestResult testResult = this.formatResult(execResult);
String testId = testResult.getTestId();
testResultService.saveResult(testResult, testResult.getRunMode(), null, testResult.getTestId());
if (StringUtils.isNotEmpty(testId)) {
MessageCache.executionQueue.remove(testId);
}
}
}

View File

@ -33,7 +33,11 @@ public class ResourcePoolCalculation {
private static final String BASE_URL = "http://%s:%d";
private JvmInfoDTO getNodeJvmInfo(String uri) {
return restTemplate.getForObject(uri, JvmInfoDTO.class);
try {
return restTemplate.getForObject(uri, JvmInfoDTO.class);
} catch (Exception e) {
return null;
}
}
public TestResource getPool(String resourcePoolId) {

View File

@ -100,6 +100,34 @@ public class TestResult {
* 场景里的第一层视为步骤不考虑深层情况
*/
if (result != null && CollectionUtils.isNotEmpty(result.getRequestResults())) {
//如果有全局前后置脚本会出现前后置的测试步骤影响统计此处略过不处理
// 同时jmeter会将前后置脚本步骤作为一个请求来计算当检测到有前后置脚本步骤执行时请求数也要做处理
List<RequestResult> formatedResult = new ArrayList<>();
int successStep = 0;
int errorStep = 0;
for (RequestResult item :result.getRequestResults()) {
if(!StringUtils.startsWithAny(item.getName(),"PRE_PROCESSOR_ENV_","POST_PROCESSOR_ENV_")){
formatedResult.add(item);
}else {
if(StringUtils.equalsAnyIgnoreCase(item.getName(),"PRE_PROCESSOR_ENV_false","POST_PROCESSOR_ENV_false")){
if(item.isSuccess()){
successStep++;
}else {
errorStep++;
}
}
}
}
result.setSuccess(result.getSuccess() - successStep);
result.setError(result.getError()-errorStep);
this.success = this.success - successStep;
this.error = this.error-errorStep;
this.total = this.total - successStep - errorStep;
result.setRequestResults(formatedResult);
result.getRequestResults().forEach(item -> {
String itemAndScenarioName = "";
if (StringUtils.isNotEmpty(item.getScenario())) {

View File

@ -520,6 +520,9 @@ public class APITestService {
//HTTPSamplerProxy 进行附件转化 1.elementProp里去掉路径 2elementProp->filePath获取路径并读出来
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(element));
}
//如果存在证书文件也要匹配出来
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(innerHashTreeElement));
}
jmxString = root.asXML();
} catch (Exception e) {
@ -585,20 +588,40 @@ public class APITestService {
try {
String filePath = elementProp.attributeValue("name");
File file = new File(filePath);
if(file.exists() && file.isFile()){
if (file.exists() && file.isFile()) {
attachmentFilePathList.add(filePath);
String fileName = file.getName();
elementProp.attribute("name").setText(fileName);
}
}catch (Exception e){
} catch (Exception e) {
}
}
}
}
}
}
}else if (StringUtils.equals(qname, "KeystoreConfig")) {
List<Element> stringPropList = parentElement.elements("stringProp");
for (Element element : stringPropList) {
if (StringUtils.equals(element.attributeValue("name"), "MS-KEYSTORE-FILE-PATH")) {
try {
String filePath = element.getStringValue();
File file = new File(filePath);
if(file.exists() && file.isFile()){
attachmentFilePathList.add(filePath);
String fileName = file.getName();
element.setText(fileName);
}
}catch (Exception e){
}
}
}
} else if (StringUtils.equals(qname, "hashTree")) {
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(parentElement));
}
}
return attachmentFilePathList;
}

View File

@ -0,0 +1,8 @@
package io.metersphere.api.service;
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
public interface ApiAutomationRelationshipEdgeService {
// 初始化引用关系
void initRelationshipEdge(ApiScenarioWithBLOBs before, ApiScenarioWithBLOBs now);
}

View File

@ -44,6 +44,7 @@ import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.api.AutomationReference;
import io.metersphere.plugin.core.MsTestElement;
import io.metersphere.service.RelationshipEdgeService;
import io.metersphere.service.ScheduleService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.track.dto.TestPlanDTO;
@ -139,6 +140,8 @@ public class ApiAutomationService {
private NodeKafkaService nodeKafkaService;
@Resource
private ExtTestPlanScenarioCaseMapper extTestPlanScenarioCaseMapper;
@Resource
private RelationshipEdgeService relationshipEdgeService;
private ThreadLocal<Long> currentScenarioOrder = new ThreadLocal<>();
@ -172,7 +175,7 @@ public class ApiAutomationService {
public List<ApiScenarioWithBLOBs> listAll(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<ApiScenarioWithBLOBs> list = extApiScenarioMapper.selectIds(request.getIds());
return list;
}
@ -183,7 +186,7 @@ public class ApiAutomationService {
public List<String> idAll(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
return request.getIds();
}
@ -256,7 +259,11 @@ public class ApiAutomationService {
apiScenarioMapper.insert(scenario);
apiScenarioReferenceIdService.saveByApiScenario(scenario);
// 存储依赖关系
ApiAutomationRelationshipEdgeService relationshipEdgeService = CommonBeanFactory.getBean(ApiAutomationRelationshipEdgeService.class);
if (relationshipEdgeService != null) {
relationshipEdgeService.initRelationshipEdge(null, scenario);
}
uploadFiles(request, bodyFiles, scenarioFiles);
return scenario;
@ -340,7 +347,8 @@ public class ApiAutomationService {
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
Integer version = apiScenarioMapper.selectByPrimaryKey(request.getId()).getVersion();
ApiScenarioWithBLOBs beforeScenario = apiScenarioMapper.selectByPrimaryKey(request.getId());
Integer version = beforeScenario.getVersion();
if (version == null) {
scenario.setVersion(0);
} else {
@ -354,6 +362,12 @@ public class ApiAutomationService {
apiScenarioReferenceIdService.saveByApiScenario(scenario);
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name同步到修改首页定时任务
uploadFiles(request, bodyFiles, scenarioFiles);
// 存储依赖关系
ApiAutomationRelationshipEdgeService relationshipEdgeService = CommonBeanFactory.getBean(ApiAutomationRelationshipEdgeService.class);
if (relationshipEdgeService != null) {
relationshipEdgeService.initRelationshipEdge(beforeScenario, scenario);
}
return scenario;
}
@ -463,7 +477,8 @@ public class ApiAutomationService {
example.createCriteria().andIdIn(idList);
testPlanApiScenarioMapper.deleteByExample(example);
}
// 删除引用关系
relationshipEdgeService.delete(scenarioId);
deleteBodyFileByScenarioId(scenarioId);
}
@ -528,6 +543,8 @@ public class ApiAutomationService {
example.createCriteria().andIdIn(testPlanApiScenarioIdList);
testPlanApiScenarioMapper.deleteByExample(example);
}
// 删除引用关系
relationshipEdgeService.delete(scenarioIds);
deleteBodyFileByScenarioIds(scenarioIds);
}
@ -993,7 +1010,7 @@ public class ApiAutomationService {
*/
public String modeRun(RunScenarioRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<String> ids = request.getIds();
// 生成集成报告
@ -1191,9 +1208,10 @@ public class ApiAutomationService {
executeQueue.get(key).setHashTree(hashTree);
}
Future<ApiScenarioReport> future = executorService.submit(new SerialScenarioExecTask(jMeterService, apiScenarioReportMapper, executeQueue.get(key), request));
ApiScenarioReport scenarioReport = future.get();
future.get();
// 如果开启失败结束执行则判断返回结果状态
if (request.getConfig().isOnSampleError()) {
ApiScenarioReport scenarioReport = apiScenarioReportMapper.selectByPrimaryKey(key);
if (scenarioReport == null || !scenarioReport.getStatus().equals("Success")) {
reportIds.remove(key);
break;
@ -1237,15 +1255,28 @@ public class ApiAutomationService {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiScenarioReportMapper batchMapper = sqlSession.getMapper(ApiScenarioReportMapper.class);
// 开始并发执行
for (String reportId : executeQueue.keySet()) {
//存储报告
APIScenarioReportResult report = executeQueue.get(reportId).getReport();
batchMapper.insert(report);
}
sqlSession.flushStatements();
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
for (String reportId : executeQueue.keySet()) {
//存储报告
APIScenarioReportResult report = executeQueue.get(reportId).getReport();
batchMapper.insert(report);
}
sqlSession.flushStatements();
}
});
thread.start();
for (String reportId : executeQueue.keySet()) {
if (request.getConfig() != null && StringUtils.isNotEmpty(request.getConfig().getResourcePoolId())) {
jMeterService.runTest(executeQueue.get(reportId).getTestId(), reportId, request.getRunMode(), request.getPlanScenarioId(), request.getConfig());
String testPlanScenarioId = "";
if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(executeQueue.get(reportId).getTestId())) {
testPlanScenarioId = request.getScenarioTestPlanIdMap().get(executeQueue.get(reportId).getTestId());
} else {
testPlanScenarioId = request.getPlanScenarioId();
}
jMeterService.runTest(executeQueue.get(reportId).getTestId(), reportId, request.getRunMode(), testPlanScenarioId, request.getConfig());
} else {
jMeterService.runLocal(reportId, executeQueue.get(reportId).getHashTree(),
TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode());
@ -1429,7 +1460,7 @@ public class ApiAutomationService {
*/
public String execute(RunScenarioRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<String> ids = request.getIds();
//检查是否有正在执行中的情景
// this.checkScenarioIsRunning(ids);
@ -1745,7 +1776,7 @@ public class ApiAutomationService {
public void bathEdit(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
if (StringUtils.isNotBlank(request.getEnvironmentId())) {
bathEditEnv(request);
@ -1874,6 +1905,12 @@ public class ApiAutomationService {
scenarioWithBLOBs.setOrder(getImportNextOrder(request.getProjectId()));
scenarioWithBLOBs.setId(UUID.randomUUID().toString());
batchMapper.insert(scenarioWithBLOBs);
// 存储依赖关系
ApiAutomationRelationshipEdgeService relationshipEdgeService = CommonBeanFactory.getBean(ApiAutomationRelationshipEdgeService.class);
if (relationshipEdgeService != null) {
relationshipEdgeService.initRelationshipEdge(null, scenarioWithBLOBs);
}
apiScenarioReferenceIdService.saveByApiScenario(scenarioWithBLOBs);
}
@ -1996,7 +2033,7 @@ public class ApiAutomationService {
private List<ApiScenarioWithBLOBs> getExportResult(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(request.getIds());
List<ApiScenarioWithBLOBs> apiScenarioWithBLOBs = apiScenarioMapper.selectByExampleWithBLOBs(example);
@ -2114,15 +2151,14 @@ public class ApiAutomationService {
public void removeToGcByBatch(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
this.removeToGc(request.getIds());
}
public void deleteBatchByCondition(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
this.deleteBatch(request.getIds());
}
@ -2139,7 +2175,6 @@ public class ApiAutomationService {
* @return
*/
public float countInterfaceCoverage(List<ApiScenarioWithBLOBs> allScenarioInfoList, List<ApiDefinition> allEffectiveApiList) {
float intetfaceCoverage = 0;
if (allEffectiveApiList == null || allEffectiveApiList.isEmpty()) {
return 100;
}
@ -2175,7 +2210,6 @@ public class ApiAutomationService {
}
}
}
useUrl = null;
}
List<String> containsApiIdList = new ArrayList<>();
@ -2214,8 +2248,8 @@ public class ApiAutomationService {
List<ApiMethodUrlDTO> urlList = new ArrayList<>();
try {
String scenarioDefiniton = scenario.getScenarioDefinition();
JSONObject scenarioObj = JSONObject.parseObject(scenarioDefiniton);
String scenarioDefinition = scenario.getScenarioDefinition();
JSONObject scenarioObj = JSONObject.parseObject(scenarioDefinition);
List<ApiMethodUrlDTO> stepUrlList = this.getMethodUrlDTOByHashTreeJsonObj(scenarioObj);
if (CollectionUtils.isNotEmpty(stepUrlList)) {
Collection unionList = CollectionUtils.union(urlList, stepUrlList);
@ -2336,7 +2370,7 @@ public class ApiAutomationService {
request.setIds(new ArrayList<>(0));
}
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
if (!request.getIds().isEmpty()) {
ApiScenarioExample example = new ApiScenarioExample();
@ -2369,7 +2403,7 @@ public class ApiAutomationService {
public List<ApiScenarioWithBLOBs> listWithIds(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<ApiScenarioWithBLOBs> list = extApiScenarioMapper.listWithIds(request.getIds());
return list;
}
@ -2439,7 +2473,7 @@ public class ApiAutomationService {
public List<JmxInfoDTO> batchGenPerformanceTestJmx(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<JmxInfoDTO> returnList = new ArrayList<>();
List<String> ids = request.getIds();
@ -2464,7 +2498,7 @@ public class ApiAutomationService {
public BatchOperaResponse batchCopy(ApiScenarioBatchRequest batchRequest) {
ServiceUtils.getSelectAllIds(batchRequest, batchRequest.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<ApiScenarioWithBLOBs> apiScenarioList = extApiScenarioMapper.selectIds(batchRequest.getIds());
StringBuffer stringBuffer = new StringBuffer();
for (ApiScenarioWithBLOBs apiModel : apiScenarioList) {
@ -2524,7 +2558,7 @@ public class ApiAutomationService {
public DeleteCheckResult checkBeforeDelete(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<String> deleteIds = request.getIds();
DeleteCheckResult result = new DeleteCheckResult();
List<String> checkMsgList = new ArrayList<>();

View File

@ -33,6 +33,7 @@ import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.ScheduleRequest;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.dto.RelationshipEdgeDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.SwaggerUrlImportJob;
import io.metersphere.log.utils.ReflexObjectUtil;
@ -43,6 +44,7 @@ import io.metersphere.log.vo.api.DefinitionReference;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.FileService;
import io.metersphere.service.RelationshipEdgeService;
import io.metersphere.service.ScheduleService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
@ -115,6 +117,8 @@ public class ApiDefinitionService {
private NoticeSendService noticeSendService;
@Resource
private ExtApiTestCaseMapper extApiTestCaseMapper;
@Resource
private RelationshipEdgeService relationshipEdgeService;
private static Cache cache = Cache.newHardMemoryCache(0, 3600);
@ -128,6 +132,53 @@ public class ApiDefinitionService {
return resList;
}
public void initDefaultModuleId(){
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andModuleIdIsNull();
List<ApiDefinition> updateApiList = apiDefinitionMapper.selectByExample(example);
Map<String, Map<String,List<ApiDefinition>>> projectIdMap = new HashMap<>();
for (ApiDefinition api : updateApiList) {
String projectId = api.getProjectId();
String protocal = api.getProtocol();
if (projectIdMap.containsKey(projectId)) {
if(projectIdMap.get(projectId).containsKey(protocal)){
projectIdMap.get(projectId).get(protocal).add(api);
}else {
List<ApiDefinition> list = new ArrayList<>();
list.add(api);
projectIdMap.get(projectId).put(protocal,list);
}
} else {
List<ApiDefinition> list = new ArrayList<>();
list.add(api);
Map<String,List<ApiDefinition>> map = new HashMap<>();
map.put(protocal,list);
projectIdMap.put(projectId, map);
}
}
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
for (Map.Entry<String, Map<String,List<ApiDefinition>>> entry : projectIdMap.entrySet()) {
String projectId = entry.getKey();
Map<String,List<ApiDefinition>> map = entry.getValue();
for (Map.Entry<String,List<ApiDefinition>> itemEntry : map.entrySet()) {
String protocal = itemEntry.getKey();
ApiModule node = apiModuleService.getDefaultNodeUnCreateNew(projectId, protocal);
if(node != null){
List<ApiDefinition> testCaseList = itemEntry.getValue();
for (ApiDefinition apiDefinition : testCaseList) {
ApiDefinitionWithBLOBs updateCase = new ApiDefinitionWithBLOBs();
updateCase.setId(apiDefinition.getId());
updateCase.setModuleId(node.getId());
updateCase.setModulePath("/" + node.getName());
apiDefinitionMapper.updateByPrimaryKeySelective(updateCase);
}
}
}
}
}
public List<ApiDefinitionResult> listBatch(ApiBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiDefinitionMapper.selectIds(query));
@ -213,6 +264,7 @@ public class ApiDefinitionService {
esbApiParamService.deleteByResourceId(apiId);
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
mockConfigService.deleteMockConfigByApiId(apiId);
relationshipEdgeService.delete(apiId); // 删除关系图
FileUtils.deleteBodyFiles(apiId);
}
@ -223,6 +275,7 @@ public class ApiDefinitionService {
apiDefinitionMapper.deleteByExample(example);
apiTestCaseService.deleteBatchByDefinitionId(apiIds);
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
relationshipEdgeService.delete(apiIds); // 删除关系图
for (String apiId : apiIds) {
mockConfigService.deleteMockConfigByApiId(apiId);
}
@ -397,6 +450,7 @@ public class ApiDefinitionService {
test.setResponse(JSONObject.toJSONString(request.getResponse()));
test.setEnvironmentId(request.getEnvironmentId());
test.setUserId(request.getUserId());
test.setRemark(request.getRemark());
test.setFollowPeople(request.getFollowPeople());
if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) {
test.setTags(request.getTags());
@ -435,6 +489,7 @@ public class ApiDefinitionService {
test.setModulePath(request.getModulePath());
test.setModuleId(request.getModuleId());
test.setFollowPeople(request.getFollowPeople());
test.setRemark(request.getRemark());
test.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extApiDefinitionMapper::getLastOrder));
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
@ -505,9 +560,9 @@ public class ApiDefinitionService {
if (CollectionUtils.isEmpty(sameRequest)) {
//postman 可能含有前置脚本接口定义去掉脚本
apiDefinition.setOrder(getImportNextOrder(apiTestImportRequest.getProjectId()));
batchMapper.insert(apiDefinition);
String originId = apiDefinition.getId();
apiDefinition.setId(UUID.randomUUID().toString());
batchMapper.insert(apiDefinition);
String requestStr = setImportHashTree(apiDefinition);
reSetImportCasesApiId(cases, originId, apiDefinition.getId());
apiDefinition.setRequest(requestStr);
@ -561,6 +616,9 @@ public class ApiDefinitionService {
}
} else {
apiDefinition.setStatus(sameRequest.get(0).getStatus());
apiDefinition.setOriginalState(sameRequest.get(0).getOriginalState());
apiDefinition.setCaseStatus(sameRequest.get(0).getCaseStatus());
if (StringUtils.equalsIgnoreCase(apiDefinition.getProtocol(), RequestType.HTTP)) {
//如果存在则修改
apiDefinition.setId(sameRequest.get(0).getId());
@ -739,13 +797,15 @@ public class ApiDefinitionService {
Map<String, EnvironmentConfig> envConfig = new HashMap<>();
Map<String, String> map = request.getEnvironmentMap();
if (map != null && map.size() > 0) {
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(request.getProjectId()));
if (environment != null) {
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
env.setApiEnvironmentid(environment.getId());
envConfig.put(request.getProjectId(), env);
config.setConfig(envConfig);
for (String key : map.keySet()) {
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(key));
if (environment != null) {
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
env.setApiEnvironmentid(environment.getId());
envConfig.put(key, env);
}
}
config.setConfig(envConfig);
}
if (CollectionUtils.isNotEmpty(bodyFiles)) {
@ -954,6 +1014,7 @@ public class ApiDefinitionService {
if (apiImport.getEsbApiParamsMap() != null) {
String apiId = item.getId();
EsbApiParamsWithBLOBs model = apiImport.getEsbApiParamsMap().get(apiId);
request.setModeId("fullCoverage");//标准版ESB数据导入不区分是否覆盖默认都为覆盖
importCreate(item, batchMapper, apiTestCaseMapper, request, apiImport.getCases(), apiImport.getMocks(), project.getRepeatable());
if (model != null) {
apiImport.getEsbApiParamsMap().remove(apiId);
@ -1293,9 +1354,7 @@ public class ApiDefinitionService {
}
} else { // 导出为 Swagger 格式
Swagger3Parser swagger3Parser = new Swagger3Parser();
System.out.println(apiDefinitionMapper.selectByExampleWithBLOBs(example));
apiExportResult = swagger3Parser.swagger3Export(apiDefinitionMapper.selectByExampleWithBLOBs(example));
}
return apiExportResult;
@ -1510,4 +1569,41 @@ public class ApiDefinitionService {
public long countQuotedApiByProjectId(String projectId) {
return extApiDefinitionMapper.countQuotedApiByProjectId(projectId);
}
public List<RelationshipEdgeDTO> getRelationshipApi(String id, String relationshipType) {
List<RelationshipEdge> relationshipEdges= relationshipEdgeService.getRelationshipEdgeByType(id, relationshipType);
List<String> ids = relationshipEdgeService.getRelationIdsByType(relationshipType, relationshipEdges);
if (CollectionUtils.isNotEmpty(ids)) {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andIdIn(ids);
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
Map<String, ApiDefinition> apiMap = apiDefinitions.stream().collect(Collectors.toMap(ApiDefinition::getId, i -> i));
List<RelationshipEdgeDTO> results = new ArrayList<>();
for (RelationshipEdge relationshipEdge : relationshipEdges) {
RelationshipEdgeDTO relationshipEdgeDTO = new RelationshipEdgeDTO();
BeanUtils.copyBean(relationshipEdgeDTO, relationshipEdge);
ApiDefinition apiDefinition;
if (StringUtils.equals(relationshipType, "PRE")) {
apiDefinition = apiMap.get(relationshipEdge.getTargetId());
} else {
apiDefinition = apiMap.get(relationshipEdge.getSourceId());
}
relationshipEdgeDTO.setTargetName(apiDefinition.getName());
relationshipEdgeDTO.setCreator(apiDefinition.getCreateUser());
relationshipEdgeDTO.setTargetNum(apiDefinition.getNum());
results.add(relationshipEdgeDTO);
}
return results;
}
return new ArrayList<>();
}
public List<ApiDefinitionResult> getRelationshipRelateList(ApiDefinitionRequest request) {
request = this.initRequest(request, true, true);
List<String> relationshipIds = relationshipEdgeService.getRelationshipIds(request.getId());
request.setNotInIds(relationshipIds);
request.setId(null); // 去掉id的查询条件
return extApiDefinitionMapper.list(request);
}
}

View File

@ -60,6 +60,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
super(ApiModuleDTO.class);
}
public ApiModule get(String id) {
return apiModuleMapper.selectByPrimaryKey(id);
}
public List<ApiModuleDTO> getNodeTreeByProjectId(String projectId, String protocol) {
// 判断当前项目下是否有默认模块没有添加默认模块
this.getDefaultNode(projectId,protocol);
@ -292,6 +295,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
if(StringUtils.isNotEmpty(node.getProtocol())){
criteria.andProtocolEqualTo(node.getProtocol());
}
return apiModuleMapper.selectByExample(example);
}
@ -522,4 +528,15 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
return list.get(0);
}
}
public ApiModule getDefaultNodeUnCreateNew(String projectId,String protocol) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol).andNameEqualTo("未规划接口").andParentIdIsNull();;
List<ApiModule> list = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
return null;
}else {
return list.get(0);
}
}
}

View File

@ -20,16 +20,15 @@ import io.metersphere.api.jmeter.ReportCounter;
import io.metersphere.api.jmeter.ScenarioResult;
import io.metersphere.api.jmeter.TestResult;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiScenarioReportDetailMapper;
import io.metersphere.base.mapper.ApiScenarioReportMapper;
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtApiScenarioReportDetailMapper;
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.ApiReportCountDTO;
import io.metersphere.dto.NodeDTO;
import io.metersphere.dto.UserDTO;
@ -84,7 +83,7 @@ public class ApiScenarioReportService {
@Resource
private UserService userService;
@Resource
private ExtProjectMapper extProjectMapper;
private ProjectMapper projectMapper;
public ApiScenarioReport complete(TestResult result, String runMode) {
// 更新场景
@ -648,8 +647,8 @@ public class ApiScenarioReportService {
.event(event)
.build();
Organization organization = extProjectMapper.getOrganizationByProjectId(scenario.getProjectId());
noticeSendService.send(organization, NoticeConstants.TaskType.API_AUTOMATION_TASK, noticeModel);
Project project = projectMapper.selectByPrimaryKey(scenario.getProjectId());
noticeSendService.send(project, NoticeConstants.TaskType.API_AUTOMATION_TASK, noticeModel);
}
public String update(APIScenarioReportResult test) {

View File

@ -328,25 +328,30 @@ public class ApiTestCaseService {
request = esbApiParamService.handleEsbRequest(request);
}
final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs();
test.setId(request.getId());
test.setName(request.getName());
test.setApiDefinitionId(request.getApiDefinitionId());
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
test.setProjectId(request.getProjectId());
test.setRequest(JSONObject.toJSONString(request.getRequest()));
test.setPriority(request.getPriority());
test.setUpdateTime(System.currentTimeMillis());
test.setDescription(request.getDescription());
test.setVersion(request.getVersion() == null ? 0 : request.getVersion() + 1);
test.setFollowPeople(request.getFollowPeople());
if (StringUtils.equals("[]", request.getTags())) {
test.setTags("");
} else {
test.setTags(request.getTags());
final ApiTestCaseWithBLOBs test = apiTestCaseMapper.selectByPrimaryKey(request.getId());
if (test != null) {
test.setName(request.getName());
test.setCaseStatus(request.getCaseStatus());
if (StringUtils.isEmpty(request.getCaseStatus())) {
test.setCaseStatus(APITestStatus.Underway.name());
}
test.setApiDefinitionId(request.getApiDefinitionId());
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
test.setProjectId(request.getProjectId());
test.setRequest(JSONObject.toJSONString(request.getRequest()));
test.setPriority(request.getPriority());
test.setUpdateTime(System.currentTimeMillis());
test.setDescription(request.getDescription());
test.setVersion(request.getVersion() == null ? 0 : request.getVersion() + 1);
test.setFollowPeople(request.getFollowPeople());
if (StringUtils.equals("[]", request.getTags())) {
test.setTags("");
} else {
test.setTags(request.getTags());
}
apiTestCaseMapper.updateByPrimaryKeySelective(test);
}
apiTestCaseMapper.updateByPrimaryKeySelective(test);
return apiTestCaseMapper.selectByPrimaryKey(request.getId());
return test;
}
private ApiTestCase createTest(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
@ -362,6 +367,10 @@ public class ApiTestCaseService {
test.setId(request.getId());
test.setName(request.getName());
test.setStatus("");
test.setCaseStatus(request.getCaseStatus());
if (StringUtils.isEmpty(request.getCaseStatus())) {
test.setCaseStatus(APITestStatus.Underway.name());
}
test.setApiDefinitionId(request.getApiDefinitionId());
test.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());

View File

@ -0,0 +1,61 @@
package io.metersphere.api.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiDefinitionMapper;
import io.metersphere.base.mapper.ApiModuleMapper;
import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiScenarioModuleMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Transactional
/**
* 接口测试所有级联删除资源
*/
public class ApiTestDelService {
@Resource
private ApiDefinitionService apiDefinitionService;
@Resource
private ApiAutomationService apiAutomationService;
@Resource
private ApiScenarioMapper apiScenarioMapper;
@Resource
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private ApiModuleMapper apiModuleMapper;
@Resource
private ApiScenarioModuleMapper apiScenarioModuleMapper;
public void delete(String projectId) {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andProjectIdEqualTo(projectId);
// api and case
List<String> apiIds = apiDefinitionMapper.selectByExample(example).stream().map(ApiDefinition::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(apiIds)) {
apiDefinitionService.deleteBatch(apiIds);
}
// scenario
ApiScenarioExample scenarioExample = new ApiScenarioExample();
scenarioExample.createCriteria().andProjectIdEqualTo(projectId);
List<String> scenarios = apiScenarioMapper.selectByExample(scenarioExample).stream().map(ApiScenario::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(scenarios)) {
apiAutomationService.deleteBatch(scenarios);
}
// api module
ApiModuleExample moduleExample = new ApiModuleExample();
moduleExample.createCriteria().andProjectIdEqualTo(projectId);
apiModuleMapper.deleteByExample(moduleExample);
// scenario module
ApiScenarioModuleExample scenarioModuleExample = new ApiScenarioModuleExample();
scenarioModuleExample.createCriteria().andProjectIdEqualTo(projectId);
apiScenarioModuleMapper.deleteByExample(scenarioModuleExample);
}
}

View File

@ -54,18 +54,14 @@ public class EsbImportService {
}
data.setUserIsAdmin(Translator.get("options_no"));
data.setUserIsTester(Translator.get("options_no"));
data.setUserIsOrgMember(Translator.get("options_no"));
data.setUserIsViewer(Translator.get("options_no"));
data.setUserIsTestManager(Translator.get("options_no"));
data.setUserIsOrgAdmin(Translator.get("options_yes"));
data.setOrgAdminOrganization(workspace);
list.add(data);
}
list.add(new UserExcelData());
UserExcelData explain = new UserExcelData();
explain.setName(Translator.get("do_not_modify_header_order"));
explain.setOrgAdminOrganization("多个工作空间请换行展示");
list.add(explain);
return list;
}

View File

@ -9,6 +9,8 @@ import io.metersphere.api.dto.automation.EsbDataStruct;
import io.metersphere.api.dto.automation.TcpTreeTableDataStruct;
import io.metersphere.api.dto.automation.parse.TcpTreeTableDataParser;
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
import io.metersphere.api.dto.mock.MockApiUtils;
import io.metersphere.api.dto.mock.RequestMockParams;
import io.metersphere.api.dto.mockconfig.MockConfigImportDTO;
import io.metersphere.api.dto.mockconfig.MockConfigRequest;
import io.metersphere.api.dto.mockconfig.MockExpectConfigRequest;
@ -30,6 +32,7 @@ import org.apache.ibatis.session.SqlSession;
import org.json.XML;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.xml.sax.InputSource;
import javax.annotation.Resource;
@ -69,12 +72,12 @@ public class MockConfigService {
return this.assemblyMockConfingResponse(configList);
}
public List<MockExpectConfigWithBLOBs> selectMockExpectConfigByApiId(String apiId){
public List<MockExpectConfigWithBLOBs> selectMockExpectConfigByApiId(String apiId) {
return extMockExpectConfigMapper.selectByApiId(apiId);
}
public List<MockConfigImportDTO> selectMockExpectConfigByApiIdIn(List<String> apiIds){
if(CollectionUtils.isNotEmpty(apiIds)){
public List<MockConfigImportDTO> selectMockExpectConfigByApiIdIn(List<String> apiIds) {
if (CollectionUtils.isNotEmpty(apiIds)) {
List<MockConfigImportDTO> returnDTO = new ArrayList<>();
for (String apiId : apiIds) {
List<MockExpectConfigWithBLOBs> mockExpectConfigWithBLOBsList = extMockExpectConfigMapper.selectByApiId(apiId);
@ -86,7 +89,7 @@ public class MockConfigService {
}
}
return returnDTO;
}else {
} else {
return new ArrayList<>();
}
}
@ -139,7 +142,7 @@ public class MockConfigService {
config.setCreateUserId(SessionUtils.getUserId());
config.setCreateTime(createTimeStmp);
config.setUpdateTime(createTimeStmp);
if(request.getApiId() != null){
if (request.getApiId() != null) {
config.setApiId(request.getApiId());
mockConfigMapper.insert(config);
}
@ -165,7 +168,21 @@ public class MockConfigService {
return returnRsp;
}
public MockExpectConfig updateMockExpectConfig(MockExpectConfigRequest request) {
public MockExpectConfig updateMockExpectConfigStatus(MockExpectConfigRequest request) {
if (StringUtils.isNotEmpty(request.getId()) && StringUtils.isNotEmpty(request.getStatus())) {
MockExpectConfigWithBLOBs model = new MockExpectConfigWithBLOBs();
long timeStmp = System.currentTimeMillis();
model.setId(request.getId());
model.setUpdateTime(timeStmp);
model.setStatus(request.getStatus());
mockExpectConfigMapper.updateByPrimaryKeySelective(model);
return model;
} else {
return null;
}
}
public MockExpectConfig updateMockExpectConfig(MockExpectConfigRequest request, List<MultipartFile> bodyFiles) {
boolean isSave = false;
if (StringUtils.isEmpty(request.getId())) {
isSave = true;
@ -200,6 +217,10 @@ public class MockConfigService {
} else {
mockExpectConfigMapper.updateByPrimaryKeySelective(model);
}
if (StringUtils.isNotEmpty(request.getCopyId())) {
FileUtils.copyBdyFile(request.getCopyId(), model.getId());
}
FileUtils.createBodyFiles(model.getId(), bodyFiles);
return model;
}
@ -212,40 +233,24 @@ public class MockConfigService {
}
}
public MockExpectConfigResponse findExpectConfig(List<MockExpectConfigResponse> mockExpectConfigList, JSONObject reqJsonObj) {
public MockExpectConfigResponse findExpectConfig(Map<String, String> requestHeaderMap, List<MockExpectConfigResponse> mockExpectConfigList, RequestMockParams requestMockParams) {
MockExpectConfigResponse returnModel = null;
if (reqJsonObj == null || reqJsonObj.isEmpty()) {
if (requestMockParams == null || requestMockParams.isEmpty()) {
//如果参数为空则匹配请求为空的期望
for (MockExpectConfigResponse model : mockExpectConfigList) {
if (!model.isStatus()) {
continue;
}
JSONObject requestObj = model.getRequest();
boolean isJsonParam = requestObj.getBoolean("jsonParam");
if (isJsonParam) {
if (StringUtils.isEmpty(requestObj.getString("jsonData"))) {
return model;
}
MockExpectConfigResponse resultModel = null;
if (requestObj.containsKey("params")) {
resultModel = this.getEmptyRequestMockExpectByParams(requestHeaderMap, model);
} else {
JSONObject mockExpectJson = new JSONObject();
JSONArray jsonArray = requestObj.getJSONArray("variables");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String name = "";
String value = "";
if (object.containsKey("name")) {
name = String.valueOf(object.get("name")).trim();
}
if (object.containsKey("value")) {
value = String.valueOf(object.get("value")).trim();
}
if (StringUtils.isNotEmpty(name)) {
mockExpectJson.put(name, value);
}
}
if (mockExpectJson.isEmpty()) {
return model;
}
resultModel = this.getEmptyRequestMockExpect(model);
}
if (resultModel != null) {
return resultModel;
}
}
}
@ -254,41 +259,14 @@ public class MockConfigService {
if (!model.isStatus()) {
continue;
}
JSONObject requestObj = model.getRequest();
boolean isJsonParam = requestObj.getBoolean("jsonParam");
JSONObject mockExpectJson = new JSONObject();
if (isJsonParam) {
String jsonParams = requestObj.getString("jsonData");
JSONValidator jsonValidator = JSONValidator.from(jsonParams);
if (StringUtils.equalsIgnoreCase("Array", jsonValidator.getType().name())) {
JSONArray mockExpectArr = JSONArray.parseArray(jsonParams);
for (int expectIndex = 0; expectIndex < mockExpectArr.size(); expectIndex++) {
JSONObject itemObj = mockExpectArr.getJSONObject(expectIndex);
mockExpectJson = itemObj;
}
} else if (StringUtils.equalsIgnoreCase("Object", jsonValidator.getType().name())) {
JSONObject mockExpectJsonItem = JSONObject.parseObject(jsonParams);
mockExpectJson = mockExpectJsonItem;
}
JSONObject mockExpectRequestObj = model.getRequest();
boolean mathing = false;
if (mockExpectRequestObj.containsKey("params")) {
mathing = this.isRequestMockExpectMatchingByParams(requestHeaderMap, mockExpectRequestObj, requestMockParams);
} else {
JSONArray jsonArray = requestObj.getJSONArray("variables");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String name = "";
String value = "";
if (object.containsKey("name")) {
name = String.valueOf(object.get("name")).trim();
}
if (object.containsKey("value")) {
value = String.valueOf(object.get("value")).trim();
}
if (StringUtils.isNotEmpty(name)) {
mockExpectJson.put(name, value);
}
}
mathing = this.isRequestMockExpectMatching(mockExpectRequestObj, requestMockParams.getQueryParamsObj());
}
boolean mathing = JsonStructUtils.checkJsonObjCompliance(reqJsonObj, mockExpectJson);
if (mathing) {
returnModel = model;
break;
@ -300,7 +278,254 @@ public class MockConfigService {
return returnModel;
}
public MockExpectConfigResponse findExpectConfig(List<MockExpectConfigResponse> mockExpectConfigList, JSONArray reqJsonArray) {
private boolean isRequestMockExpectMatchingByParams(Map<String, String> requestHeaderMap, JSONObject mockExpectRequestObj, RequestMockParams requestMockParams) {
JSONObject expectParamsObj = mockExpectRequestObj.getJSONObject("params");
if (expectParamsObj.containsKey("headers")) {
//检测headers
JSONArray headerArr = expectParamsObj.getJSONArray("headers");
for (int i = 0; i < headerArr.size(); i++) {
JSONObject jsonObject = headerArr.getJSONObject(i);
if (jsonObject.containsKey("enable") && jsonObject.containsKey("name") && jsonObject.containsKey("value")) {
boolean isEnable = jsonObject.getBoolean("enable");
if (isEnable) {
String headerName = jsonObject.getString("name");
String headerValue = jsonObject.getString("value");
if (!requestHeaderMap.containsKey(headerName) || !StringUtils.equals(requestHeaderMap.get(headerName), headerValue)) {
return false;
}
}
}
}
}
JSONArray jsonArray = requestMockParams.getBodyParams();
if (jsonArray == null) {
//url or get 参数
JSONArray argumentsArray = expectParamsObj.getJSONArray("arguments");
JSONArray restArray = expectParamsObj.getJSONArray("rest");
JSONObject urlRequestParamObj = MockApiUtils.getParams(argumentsArray);
JSONObject restRequestParamObj = MockApiUtils.getParams(restArray);
if (requestMockParams.getQueryParamsObj() == null || requestMockParams.getQueryParamsObj().isEmpty()) {
return JsonStructUtils.checkJsonObjCompliance(requestMockParams.getRestParamsObj(), restRequestParamObj);
} else if (requestMockParams.getRestParamsObj() == null || requestMockParams.getRestParamsObj().isEmpty()) {
return JsonStructUtils.checkJsonObjCompliance(requestMockParams.getQueryParamsObj(), urlRequestParamObj);
} else {
return JsonStructUtils.checkJsonObjCompliance(requestMockParams.getQueryParamsObj(), urlRequestParamObj)
&& JsonStructUtils.checkJsonObjCompliance(requestMockParams.getRestParamsObj(), restRequestParamObj);
}
} else {
// body参数
JSONObject expectBodyObject = expectParamsObj.getJSONObject("body");
JSONArray mockExpectJsonArray = MockApiUtils.getExpectBodyParams(expectBodyObject);
return JsonStructUtils.checkJsonArrayCompliance(jsonArray, mockExpectJsonArray);
}
// JSONObject mockExpectJson = new JSONObject();
// if (isJsonParam) {
// String jsonParams = mockExpectRequestObj.getString("jsonData");
// JSONValidator jsonValidator = JSONValidator.from(jsonParams);
// if (StringUtils.equalsIgnoreCase("Array", jsonValidator.getType().name())) {
// JSONArray mockExpectArr = JSONArray.parseArray(jsonParams);
// for (int expectIndex = 0; expectIndex < mockExpectArr.size(); expectIndex++) {
// JSONObject itemObj = mockExpectArr.getJSONObject(expectIndex);
// mockExpectJson = itemObj;
// }
// } else if (StringUtils.equalsIgnoreCase("Object", jsonValidator.getType().name())) {
// JSONObject mockExpectJsonItem = JSONObject.parseObject(jsonParams);
// mockExpectJson = mockExpectJsonItem;
// }
// } else {
// JSONArray jsonArray = mockExpectRequestObj.getJSONArray("variables");
// for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject object = jsonArray.getJSONObject(i);
// String name = "";
// String value = "";
// if (object.containsKey("name")) {
// name = String.valueOf(object.get("name")).trim();
// }
// if (object.containsKey("value")) {
// value = String.valueOf(object.get("value")).trim();
// }
// if (StringUtils.isNotEmpty(name)) {
// mockExpectJson.put(name, value);
// }
// }
// }
// boolean isMatching = JsonStructUtils.checkJsonObjCompliance(mockExpectRequestObj, mockExpectJson);
// return isMatching;
}
private boolean isRequestMockExpectMatching(JSONObject mockExpectRequestObj, JSONObject reqJsonObj) {
boolean isJsonParam = mockExpectRequestObj.getBoolean("jsonParam");
JSONObject mockExpectJson = new JSONObject();
if (isJsonParam) {
String jsonParams = mockExpectRequestObj.getString("jsonData");
JSONValidator jsonValidator = JSONValidator.from(jsonParams);
if (StringUtils.equalsIgnoreCase("Array", jsonValidator.getType().name())) {
JSONArray mockExpectArr = JSONArray.parseArray(jsonParams);
for (int expectIndex = 0; expectIndex < mockExpectArr.size(); expectIndex++) {
JSONObject itemObj = mockExpectArr.getJSONObject(expectIndex);
mockExpectJson = itemObj;
}
} else if (StringUtils.equalsIgnoreCase("Object", jsonValidator.getType().name())) {
JSONObject mockExpectJsonItem = JSONObject.parseObject(jsonParams);
mockExpectJson = mockExpectJsonItem;
}
} else {
JSONArray jsonArray = mockExpectRequestObj.getJSONArray("variables");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String name = "";
String value = "";
if (object.containsKey("name")) {
name = String.valueOf(object.get("name")).trim();
}
if (object.containsKey("value")) {
value = String.valueOf(object.get("value")).trim();
}
if (StringUtils.isNotEmpty(name)) {
mockExpectJson.put(name, value);
}
}
}
boolean isMatching = JsonStructUtils.checkJsonObjCompliance(reqJsonObj, mockExpectJson);
return isMatching;
}
private MockExpectConfigResponse getEmptyRequestMockExpectByParams(Map<String, String> requestHeaderMap, MockExpectConfigResponse model) {
JSONObject requestObj = model.getRequest();
if (requestObj.containsKey("params")) {
JSONObject paramsObj = requestObj.getJSONObject("params");
if (paramsObj.containsKey("headers")) {
JSONArray headArray = paramsObj.getJSONArray("headers");
boolean isHeadMatch = MockApiUtils.matchRequestHeader(headArray, requestHeaderMap);
if (!isHeadMatch) {
return null;
}
//判断rest为空
if (paramsObj.containsKey("rest")) {
JSONArray restArray = paramsObj.getJSONArray("rest");
for (int i = 0; i < restArray.size(); i++) {
JSONObject restObj = restArray.getJSONObject(i);
if (restObj.containsKey("enable") && restObj.containsKey("name") && restObj.containsKey("value")) {
boolean isEnable = restObj.getBoolean("enable");
if (isEnable) {
return null;
}
}
}
}
//判断arguments为空
if (paramsObj.containsKey("arguments")) {
JSONArray argumentsArray = paramsObj.getJSONArray("arguments");
for (int i = 0; i < argumentsArray.size(); i++) {
JSONObject argumentsObj = argumentsArray.getJSONObject(i);
if (argumentsObj.containsKey("enable") && argumentsObj.containsKey("name") && argumentsObj.containsKey("value")) {
boolean isEnable = argumentsObj.getBoolean("enable");
if (isEnable) {
return null;
}
}
}
}
//判断请求体为空
if (paramsObj.containsKey("body")) {
JSONObject bodyObj = paramsObj.getJSONObject("body");
if (bodyObj.containsKey("type")) {
String type = bodyObj.getString("type");
if (StringUtils.equalsIgnoreCase(type, "json")) {
if (bodyObj.containsKey("format") && StringUtils.equalsIgnoreCase(bodyObj.getString("format"), "json-schema") && bodyObj.containsKey("jsonSchema") && bodyObj.get("jsonSchema") != null) {
return null;
} else {
if (bodyObj.containsKey("raw")) {
String raw = bodyObj.getString("raw");
if (StringUtils.isNotEmpty(raw)) {
return null;
}
}
}
//Binary的先不处理
// }else if(StringUtils.equalsIgnoreCase(type,"binary")){
// if(bodyObj.containsKey("binary")){
// JSONArray binaryArray = bodyObj.getJSONArray("binary");
// for(int i = 0; i < binaryArray.size(); i ++){
// JSONObject binarObj = binaryArray.getJSONObject(i);
// if(binarObj.containsKey("enable") && binarObj.containsKey("description")){
// boolean isEnable = binarObj.getBoolean("enable");
// if(isEnable){
// return null;
// }
// }
// }
// }
} else if (StringUtils.equalsAnyIgnoreCase(type, "KeyValue", "Form Data", "WWW_FORM")) {
if (bodyObj.containsKey("kvs")) {
JSONArray kvsArray = bodyObj.getJSONArray("kvs");
for (int i = 0; i < kvsArray.size(); i++) {
JSONObject kvsObj = kvsArray.getJSONObject(i);
if (kvsObj.containsKey("enable") && kvsObj.containsKey("name") && kvsObj.containsKey("value")) {
boolean isEnable = kvsObj.getBoolean("enable");
if (isEnable) {
return null;
}
}
}
}
} else if (StringUtils.equalsAnyIgnoreCase(type, "XML", "Raw")) {
String raw = bodyObj.getString("raw");
if (StringUtils.isNotEmpty(raw)) {
return null;
}
}
}
}
return model;
} else {
return null;
}
} else {
return null;
}
}
private MockExpectConfigResponse getEmptyRequestMockExpect(MockExpectConfigResponse model) {
JSONObject requestObj = model.getRequest();
boolean isJsonParam = requestObj.getBoolean("jsonParam");
if (isJsonParam) {
if (StringUtils.isEmpty(requestObj.getString("jsonData"))) {
return model;
}
} else {
JSONObject mockExpectJson = new JSONObject();
JSONArray jsonArray = requestObj.getJSONArray("variables");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String name = "";
String value = "";
if (object.containsKey("name")) {
name = String.valueOf(object.get("name")).trim();
}
if (object.containsKey("value")) {
value = String.valueOf(object.get("value")).trim();
}
if (StringUtils.isNotEmpty(name)) {
mockExpectJson.put(name, value);
}
}
if (mockExpectJson.isEmpty()) {
return model;
}
}
return null;
}
public MockExpectConfigResponse findExpectConfigByArrayJson(Map<String, String> requestHeaderMap, List<MockExpectConfigResponse> mockExpectConfigList, JSONArray reqJsonArray) {
MockExpectConfigResponse returnModel = null;
if (reqJsonArray == null || reqJsonArray.isEmpty()) {
@ -393,34 +618,73 @@ public class MockConfigService {
return returnModel;
}
public String updateHttpServletResponse(MockExpectConfigResponse finalExpectConfig, HttpServletResponse response) {
public String updateHttpServletResponse(MockExpectConfigResponse finalExpectConfig, String url, Map<String, String> headerMap, RequestMockParams requestMockParams, HttpServletResponse response) {
String returnStr = "";
try {
//设置响应头和响应码
JSONObject responseObj = finalExpectConfig.getResponse();
String httpCode = responseObj.getString("httpCode");
JSONArray jsonArray = responseObj.getJSONArray("httpHeads");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String name = null;
String value = "";
if (object.containsKey("name")) {
name = String.valueOf(object.get("name")).trim();
}
if (object.containsKey("value")) {
value = String.valueOf(object.get("value")).trim();
}
if (StringUtils.isNotEmpty(name)) {
response.setHeader(name, value);
}
if (StringUtils.isEmpty(httpCode)) {
httpCode = "500";
}
response.setStatus(Integer.parseInt(httpCode));
returnStr = String.valueOf(responseObj.get("body"));
if (responseObj.containsKey("delayed")) {
long sleepTime = 0;
if (responseObj.containsKey("responseResult")) {
JSONObject responseJsonObj = responseObj.getJSONObject("responseResult");
if (responseJsonObj.containsKey("headers")) {
JSONArray jsonArray = responseJsonObj.getJSONArray("headers");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
if (object.containsKey("name") && object.containsKey("enable") && object.containsKey("value")) {
boolean isEnable = object.getBoolean("enable");
if (isEnable) {
String name = String.valueOf(object.get("name")).trim();
String value = String.valueOf(object.get("value")).trim();
if (StringUtils.isNotEmpty(name)) {
response.setHeader(name, value);
}
}
}
}
}
if (responseJsonObj.containsKey("body")) {
returnStr = MockApiUtils.getResultByResponseResult(responseJsonObj.getJSONObject("body"), url, headerMap, requestMockParams);
}
if (responseJsonObj.containsKey("httpCode")) {
response.setStatus(Integer.parseInt(responseJsonObj.getString("httpCode")));
}
if (responseJsonObj.containsKey("delayed")) {
try {
sleepTime = Long.parseLong(String.valueOf(responseJsonObj.get("delayed")));
} catch (Exception e) {
}
}
} else {
JSONArray jsonArray = responseObj.getJSONArray("httpHeads");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String name = null;
String value = "";
if (object.containsKey("name")) {
name = String.valueOf(object.get("name")).trim();
}
if (object.containsKey("value")) {
value = String.valueOf(object.get("value")).trim();
}
if (StringUtils.isNotEmpty(name)) {
response.setHeader(name, value);
}
}
returnStr = String.valueOf(responseObj.get("body"));
if (responseObj.containsKey("delayed")) {
try {
sleepTime = Long.parseLong(String.valueOf(responseObj.get("delayed")));
} catch (Exception e) {
}
}
}
if (sleepTime > 0) {
try {
long sleepTime = Long.parseLong(String.valueOf(responseObj.get("delayed")));
Thread.sleep(sleepTime);
} catch (Exception e) {
}
@ -480,7 +744,7 @@ public class MockConfigService {
if (bodyObj.containsKey("jsonSchema") && bodyObj.getJSONObject("jsonSchema").containsKey("properties")) {
String bodyRetunStr = bodyObj.getJSONObject("jsonSchema").getJSONObject("properties").toJSONString();
JSONObject bodyReturnObj = JSONObject.parseObject(bodyRetunStr);
JSONObject returnObj = this.parseJsonSchema(bodyReturnObj);
JSONObject returnObj = MockApiUtils.parseJsonSchema(bodyReturnObj);
returnStr = returnObj.toJSONString();
}
} else {
@ -515,37 +779,38 @@ public class MockConfigService {
}
}
returnStr = JSONObject.toJSONString(paramMap);
} else if (StringUtils.equals(type, "BINARY")) {
Map<String, String> paramMap = new LinkedHashMap<>();
if (bodyObj.containsKey("binary")) {
JSONArray kvsArr = bodyObj.getJSONArray("kvs");
for (int i = 0; i < kvsArr.size(); i++) {
JSONObject kv = kvsArr.getJSONObject(i);
if (kv.containsKey("description") && kv.containsKey("files")) {
String name = kv.getString("description");
JSONArray fileArr = kv.getJSONArray("files");
String allValue = "";
for (int j = 0; j < fileArr.size(); j++) {
JSONObject fileObj = fileArr.getJSONObject(j);
if (fileObj.containsKey("name")) {
String values = fileObj.getString("name");
if (StringUtils.isEmpty(values)) {
values = "";
} else {
try {
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
} catch (Exception e) {
}
}
allValue += values + " ;";
}
}
paramMap.put(name, allValue);
}
}
}
returnStr = JSONObject.toJSONString(paramMap);
//Binary的先不处理
// } else if (StringUtils.equals(type, "BINARY")) {
// Map<String, String> paramMap = new LinkedHashMap<>();
// if (bodyObj.containsKey("binary")) {
// JSONArray kvsArr = bodyObj.getJSONArray("kvs");
// for (int i = 0; i < kvsArr.size(); i++) {
// JSONObject kv = kvsArr.getJSONObject(i);
// if (kv.containsKey("description") && kv.containsKey("files")) {
// String name = kv.getString("description");
// JSONArray fileArr = kv.getJSONArray("files");
// String allValue = "";
// for (int j = 0; j < fileArr.size(); j++) {
// JSONObject fileObj = fileArr.getJSONObject(j);
// if (fileObj.containsKey("name")) {
// String values = fileObj.getString("name");
// if (StringUtils.isEmpty(values)) {
// values = "";
// } else {
// try {
// values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
// } catch (Exception e) {
// }
// }
//
// allValue += values + " ;";
// }
// }
// paramMap.put(name, allValue);
// }
// }
// }
// returnStr = JSONObject.toJSONString(paramMap);
}
}
}
@ -563,80 +828,28 @@ public class MockConfigService {
return returnStr;
}
private JSONObject parseJsonSchema(JSONObject bodyReturnObj) {
JSONObject returnObj = new JSONObject();
if (bodyReturnObj == null) {
return returnObj;
}
Set<String> keySet = bodyReturnObj.keySet();
for (String key : keySet) {
try {
JsonSchemaReturnObj obj = bodyReturnObj.getObject(key, JsonSchemaReturnObj.class);
if (StringUtils.equals("object", obj.getType())) {
JSONObject itemObj = this.parseJsonSchema(obj.getProperties());
if (!itemObj.isEmpty()) {
returnObj.put(key, itemObj);
}
} else if (StringUtils.equals("array", obj.getType())) {
if (obj.getItems() != null) {
JSONObject itemObj = obj.getItems();
if (itemObj.containsKey("type")) {
if (StringUtils.equals("object", itemObj.getString("type")) && itemObj.containsKey("properties")) {
JSONObject arrayObj = itemObj.getJSONObject("properties");
JSONObject parseObj = this.parseJsonSchema(arrayObj);
JSONArray array = new JSONArray();
array.add(parseObj);
returnObj.put(key, array);
} else if (StringUtils.equals("string", itemObj.getString("type")) && itemObj.containsKey("mock")) {
JsonSchemaReturnObj arrayObj = JSONObject.toJavaObject(itemObj, JsonSchemaReturnObj.class);
String value = this.getMockValues(arrayObj.getMockValue());
JSONArray array = new JSONArray();
array.add(value);
returnObj.put(key, array);
}
}
}
} else {
String values = obj.getMockValue();
if (StringUtils.isEmpty(values)) {
values = "";
} else {
try {
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
} catch (Exception e) {
}
}
returnObj.put(key, values);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return returnObj;
}
private String getMockValues(String values) {
if (StringUtils.isEmpty(values)) {
values = "";
} else {
try {
values = values.startsWith("@") ? ScriptEngineUtils.buildFunctionCallString(values) : values;
} catch (Exception e) {
}
}
return values;
}
public MockExpectConfigWithBLOBs findMockExpectConfigById(String id) {
return mockExpectConfigMapper.selectByPrimaryKey(id);
}
public void deleteMockExpectConfig(String id) {
mockExpectConfigMapper.deleteByPrimaryKey(id);
MockExpectConfigWithBLOBs mockBlobs = mockExpectConfigMapper.selectByPrimaryKey(id);
if (mockBlobs != null) {
this.deleteMockExpectFiles(mockBlobs);
mockExpectConfigMapper.deleteByPrimaryKey(id);
}
}
public void deleteMockConfigByApiId(String apiId){
private void deleteMockExpectFiles(MockExpectConfigWithBLOBs mockExpectConfigWithBLOBs) {
if (mockExpectConfigWithBLOBs != null && StringUtils.isNotEmpty(mockExpectConfigWithBLOBs.getRequest())) {
try {
FileUtils.deleteBodyFiles(mockExpectConfigWithBLOBs.getId());
} catch (Exception e) {
}
}
}
public void deleteMockConfigByApiId(String apiId) {
MockConfigExample configExample = new MockConfigExample();
configExample.createCriteria().andApiIdEqualTo(apiId);
List<MockConfig> mockConfigList = mockConfigMapper.selectByExample(configExample);
@ -644,20 +857,31 @@ public class MockConfigService {
for (MockConfig mockConfig : mockConfigList) {
example.clear();
example.createCriteria().andMockConfigIdEqualTo(mockConfig.getId());
List<MockExpectConfigWithBLOBs> deleteBolobs = mockExpectConfigMapper.selectByExampleWithBLOBs(example);
for (MockExpectConfigWithBLOBs model : deleteBolobs) {
this.deleteMockExpectFiles(model);
}
mockExpectConfigMapper.deleteByExample(example);
}
mockConfigMapper.deleteByExample(configExample);
}
public JSONObject getGetParamMap(String urlParams, ApiDefinitionWithBLOBs api, HttpServletRequest request) {
JSONObject paramMap = this.getSendRestParamMapByIdAndUrl(api, urlParams);
public RequestMockParams getGetParamMap(String urlParams, ApiDefinitionWithBLOBs api, HttpServletRequest request) {
RequestMockParams requestMockParams = new RequestMockParams();
JSONObject urlParamsObject = this.getSendRestParamMapByIdAndUrl(api, urlParams);
JSONObject queryParamsObject = new JSONObject();
Enumeration<String> paramNameItor = request.getParameterNames();
while (paramNameItor.hasMoreElements()) {
String key = paramNameItor.nextElement();
String value = request.getParameter(key);
paramMap.put(key, value);
queryParamsObject.put(key, value);
}
return paramMap;
requestMockParams.setRestParamsObj(urlParamsObject);
requestMockParams.setQueryParamsObj(queryParamsObject);
return requestMockParams;
}
public JSON getPostParamMap(HttpServletRequest request) {
@ -699,13 +923,14 @@ public class MockConfigService {
} else {
JSONObject object = new JSONObject();
String bodyParam = this.readBody(request);
if (!StringUtils.isEmpty(bodyParam)) {
try {
object = JSONObject.parseObject(bodyParam);
} catch (Exception e) {
e.printStackTrace();
}
}
object.put("raw",bodyParam);
// if (!StringUtils.isEmpty(bodyParam)) {
// try {
// object = JSONObject.parseObject(bodyParam);
// } catch (Exception e) {
// object.put("raw",bodyParam);
// }
// }
Enumeration<String> paramNameItor = request.getParameterNames();
while (paramNameItor.hasMoreElements()) {
@ -881,29 +1106,30 @@ public class MockConfigService {
}
}
}
} else if (StringUtils.equals(type, "BINARY")) {
if (bodyObj.containsKey("binary")) {
List<Map<String, String>> bodyParamList = new ArrayList<>();
JSONArray kvsArr = bodyObj.getJSONArray("binary");
for (int i = 0; i < kvsArr.size(); i++) {
JSONObject kv = kvsArr.getJSONObject(i);
if (kv.containsKey("description") && kv.containsKey("files")) {
String name = kv.getString("description");
JSONArray fileArr = kv.getJSONArray("files");
String value = "";
for (int j = 0; j < fileArr.size(); j++) {
JSONObject fileObj = fileArr.getJSONObject(j);
if (fileObj.containsKey("name")) {
value += fileObj.getString("name") + " ;";
}
}
if (!paramNameList.contains(name)) {
paramNameList.add(name);
}
}
}
}
//Binary的先不处理
// } else if (StringUtils.equals(type, "BINARY")) {
// if (bodyObj.containsKey("binary")) {
// List<Map<String, String>> bodyParamList = new ArrayList<>();
// JSONArray kvsArr = bodyObj.getJSONArray("binary");
//
// for (int i = 0; i < kvsArr.size(); i++) {
// JSONObject kv = kvsArr.getJSONObject(i);
// if (kv.containsKey("description") && kv.containsKey("files")) {
// String name = kv.getString("description");
// JSONArray fileArr = kv.getJSONArray("files");
// String value = "";
// for (int j = 0; j < fileArr.size(); j++) {
// JSONObject fileObj = fileArr.getJSONObject(j);
// if (fileObj.containsKey("name")) {
// value += fileObj.getString("name") + " ;";
// }
// }
// if (!paramNameList.contains(name)) {
// paramNameList.add(name);
// }
// }
// }
// }
}
}
} catch (Exception e) {
@ -946,10 +1172,11 @@ public class MockConfigService {
return this.assemblyMockConfingResponse(configList);
}
public String checkReturnWithMockExpectByBodyParam(String method, Project project, HttpServletRequest
public String checkReturnWithMockExpectByBodyParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest
request, HttpServletResponse response) {
String returnStr = "";
boolean isMatch = false;
String url = request.getRequestURL().toString();
List<ApiDefinitionWithBLOBs> aualifiedApiList = new ArrayList<>();
if (project != null) {
String urlSuffix = this.getUrlSuffix(project.getSystemId(), request);
@ -960,33 +1187,40 @@ public class MockConfigService {
if (mockConfigData != null && mockConfigData.getMockExpectConfigList() != null) {
JSON paramJson = this.getPostParamMap(request);
if (paramJson instanceof JSONObject) {
JSONObject paramMap = (JSONObject) paramJson;
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(mockConfigData.getMockExpectConfigList(), paramMap);
JSONArray paramsArray = new JSONArray();
paramsArray.add(paramJson);
RequestMockParams mockParams = new RequestMockParams();
mockParams.setBodyParams(paramsArray);
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(requestHeaderMap, mockConfigData.getMockExpectConfigList(), mockParams);
if (finalExpectConfig != null) {
isMatch = true;
returnStr = this.updateHttpServletResponse(finalExpectConfig, response);
returnStr = this.updateHttpServletResponse(finalExpectConfig, url, requestHeaderMap, mockParams, response);
}
} else if (paramJson instanceof JSONArray) {
JSONArray paramArray = (JSONArray) paramJson;
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(mockConfigData.getMockExpectConfigList(), paramArray);
RequestMockParams mockParams = new RequestMockParams();
mockParams.setBodyParams(paramArray);
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(requestHeaderMap, mockConfigData.getMockExpectConfigList(), mockParams);
if (finalExpectConfig != null) {
isMatch = true;
returnStr = this.updateHttpServletResponse(finalExpectConfig, response);
returnStr = this.updateHttpServletResponse(finalExpectConfig, url, requestHeaderMap, mockParams, response);
}
}
}
}
if (!isMatch) {
returnStr = this.updateHttpServletResponse(aualifiedApiList, response);
// returnStr = this.updateHttpServletResponse(aualifiedApiList, response);
response.setStatus(404);
}
return returnStr;
}
public String checkReturnWithMockExpectByUrlParam(String method, Project project, HttpServletRequest
public String checkReturnWithMockExpectByUrlParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest
request, HttpServletResponse response) {
String returnStr = "";
boolean isMatch = false;
String url = request.getRequestURI();
List<ApiDefinitionWithBLOBs> aualifiedApiList = new ArrayList<>();
if (project != null) {
String urlSuffix = this.getUrlSuffix(project.getSystemId(), request);
@ -1001,13 +1235,13 @@ public class MockConfigService {
*/
for (ApiDefinitionWithBLOBs api : aualifiedApiList) {
JSONObject paramMap = this.getGetParamMap(urlSuffix, api, request);
RequestMockParams paramMap = this.getGetParamMap(urlSuffix, api, request);
MockConfigResponse mockConfigData = this.findByApiId(api.getId());
if (mockConfigData != null && mockConfigData.getMockExpectConfigList() != null) {
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(mockConfigData.getMockExpectConfigList(), paramMap);
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(requestHeaderMap, mockConfigData.getMockExpectConfigList(), paramMap);
if (finalExpectConfig != null) {
returnStr = this.updateHttpServletResponse(finalExpectConfig, response);
returnStr = this.updateHttpServletResponse(finalExpectConfig, url, requestHeaderMap, paramMap, response);
isMatch = true;
break;
}
@ -1016,7 +1250,8 @@ public class MockConfigService {
}
if (!isMatch) {
returnStr = this.updateHttpServletResponse(aualifiedApiList, response);
// returnStr = this.updateHttpServletResponse(aualifiedApiList, response);
response.setStatus(404);
}
return returnStr;
}
@ -1149,9 +1384,9 @@ public class MockConfigService {
JSONObject sourceObj = XMLUtils.XmlToJson(message);
String xmlStr = "";
try {
List<TcpTreeTableDataStruct> tcpDataList = JSONArray.parseArray(requestJson.getString("xmlDataStruct"),TcpTreeTableDataStruct.class);
List<TcpTreeTableDataStruct> tcpDataList = JSONArray.parseArray(requestJson.getString("xmlDataStruct"), TcpTreeTableDataStruct.class);
xmlStr = TcpTreeTableDataParser.treeTableData2Xml(tcpDataList);
}catch (Exception e){
} catch (Exception e) {
}
JSONObject matchObj = XMLUtils.XmlToJson(xmlStr);
@ -1191,12 +1426,12 @@ public class MockConfigService {
}
}
//优先返回结构匹配的数据
if(!structResult.isEmpty()){
if (!structResult.isEmpty()) {
return structResult.get(0);
}else {
if(!rawResult.isEmpty()){
} else {
if (!rawResult.isEmpty()) {
return rawResult.get(0);
}else {
} else {
return null;
}
}
@ -1228,20 +1463,20 @@ public class MockConfigService {
}
public void importMock(ApiDefinitionImport apiImport, SqlSession sqlSession, ApiTestImportRequest request) {
if(CollectionUtils.isNotEmpty(apiImport.getMocks())){
Map<String,List<MockExpectConfigWithBLOBs>> saveMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(apiImport.getMocks())) {
Map<String, List<MockExpectConfigWithBLOBs>> saveMap = new HashMap<>();
for (MockConfigImportDTO dto : apiImport.getMocks()) {
String apiId = dto.getApiId();//de33108c-26e2-4d4f-826a-a5f8e017d2f4
if(saveMap.containsKey(apiId)){
if (saveMap.containsKey(apiId)) {
saveMap.get(apiId).add(dto);
}else {
} else {
List<MockExpectConfigWithBLOBs> list = new ArrayList<>();
list.add(dto);
saveMap.put(apiId,list);
saveMap.put(apiId, list);
}
}
for (Map.Entry<String,List<MockExpectConfigWithBLOBs>> entry : saveMap.entrySet()) {
for (Map.Entry<String, List<MockExpectConfigWithBLOBs>> entry : saveMap.entrySet()) {
String apiId = entry.getKey();
this.deleteMockConfigByApiId(apiId);

View File

@ -56,8 +56,8 @@ public class NodeKafkaService {
config.getTestResources().remove(jvmInfoDTO);
}
String cUri = String.format(BASE_URL + "/consumer/create", nodeIp, port);
restTemplate.postForEntity(cUri, consumerProps, void.class);
//String cUri = String.format(BASE_URL + "/consumer/create", nodeIp, port);
//restTemplate.postForEntity(cUri, consumerProps, void.class);
}
} catch (Exception e) {
LogUtil.error(e.getMessage());

View File

@ -8,7 +8,6 @@ import io.metersphere.commons.constants.*;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.notice.sender.NoticeModel;
@ -18,6 +17,7 @@ import io.metersphere.track.request.testcase.TrackCount;
import io.metersphere.track.service.TestPlanApiCaseService;
import io.metersphere.track.service.TestPlanScenarioCaseService;
import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -150,7 +150,12 @@ public class TestResultService {
testPlanTestCaseService.updateTestCaseStates(ids, TestPlanTestCaseStatus.Failure.name());
}
}
if (reportTask != null) {
if (StringUtils.equals(ReportTriggerMode.API.name(), reportTask.getTriggerMode())
|| StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), reportTask.getTriggerMode())) {
sendTask(reportTask, testResult);
}
}
} catch (Exception e) {
e.printStackTrace();
LogUtil.error(e.getMessage(), e);
@ -189,4 +194,58 @@ public class TestResultService {
}
}
private void sendTask(ApiTestReportVariable report, TestResult testResult) {
if (report == null) {
return;
}
SystemParameterService systemParameterService = CommonBeanFactory.getBean(SystemParameterService.class);
NoticeSendService noticeSendService = CommonBeanFactory.getBean(NoticeSendService.class);
assert systemParameterService != null;
assert noticeSendService != null;
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
String reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId();
String subject = "";
String event = "";
String successContext = "${operator}执行接口测成功: ${name}" + ", 报告: ${reportUrl}";
String failedContext = "${operator}执行接口测试失败: ${name}" + ", 报告: ${reportUrl}";
if (StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())) {
subject = Translator.get("task_notification_jenkins");
}
if (StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), report.getTriggerMode())) {
subject = Translator.get("task_notification");
}
if (StringUtils.equals("Success", report.getStatus())) {
event = NoticeConstants.Event.EXECUTE_SUCCESSFUL;
}
if (StringUtils.equals("success", report.getStatus())) {
event = NoticeConstants.Event.EXECUTE_SUCCESSFUL;
}
if (StringUtils.equals("Error", report.getStatus())) {
event = NoticeConstants.Event.EXECUTE_FAILED;
}
if (StringUtils.equals("error", report.getStatus())) {
event = NoticeConstants.Event.EXECUTE_FAILED;
}
Map paramMap = new HashMap<>();
paramMap.put("type", "api");
paramMap.put("url", baseSystemConfigDTO.getUrl());
paramMap.put("reportUrl", reportUrl);
paramMap.put("operator", report.getExecutor());
paramMap.putAll(new BeanMap(report));
NoticeModel noticeModel = NoticeModel.builder()
.operator(report.getUserId())
.successContext(successContext)
.successMailTemplate("ApiSuccessfulNotification")
.failedContext(failedContext)
.failedMailTemplate("ApiFailedNotification")
.testId(testResult.getTestId())
.status(report.getStatus())
.event(event)
.subject(subject)
.paramMap(paramMap)
.build();
noticeSendService.send(report.getTriggerMode(), NoticeConstants.TaskType.API_DEFINITION_TASK, noticeModel);
}
}

View File

@ -11,7 +11,6 @@ import io.metersphere.base.domain.ApiScenarioReport;
import io.metersphere.base.mapper.ApiScenarioReportMapper;
import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.TriggerMode;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import org.apache.commons.lang3.StringUtils;
@ -38,13 +37,23 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
MessageCache.terminationOrderDeque.remove(runModeDataDTO.getReport().getId());
return null;
}
String testId;
if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) {
jMeterService.runTest(runModeDataDTO.getTestId(), runModeDataDTO.getReport().getId(), request.getRunMode(), request.getPlanScenarioId(), request.getConfig());
String testPlanScenarioId = "";
if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(runModeDataDTO.getTestId())) {
testPlanScenarioId = request.getScenarioTestPlanIdMap().get(runModeDataDTO.getTestId());
} else {
testPlanScenarioId = request.getPlanScenarioId();
}
testId = runModeDataDTO.getTestId();
jMeterService.runTest(runModeDataDTO.getTestId(), runModeDataDTO.getReport().getId(), request.getRunMode(), testPlanScenarioId, request.getConfig());
} else {
testId = runModeDataDTO.getReport().getId();
jMeterService.runLocal(runModeDataDTO.getReport().getId(), runModeDataDTO.getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode());
}
while (MessageCache.executionQueue.containsKey(runModeDataDTO.getReport().getId())) {
long currentSecond = (System.currentTimeMillis() - MessageCache.executionQueue.get(runModeDataDTO.getReport().getId())) / 1000 / 60;
while (MessageCache.executionQueue.containsKey(testId)) {
long time = MessageCache.executionQueue.get(runModeDataDTO.getReport().getId());
long currentSecond = (System.currentTimeMillis() - time) / 1000 / 60;
// 设置五分钟超时
if (currentSecond > 5) {
// 执行失败了恢复报告状态
@ -59,12 +68,11 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
MessageCache.terminationOrderDeque.remove(runModeDataDTO.getReport().getId());
break;
}
Thread.sleep(1000);
}
report = apiScenarioReportMapper.selectByPrimaryKey(runModeDataDTO.getReport().getId());
return (T) report;
return null;
} catch (Exception ex) {
LogUtil.error(ex);
MSException.throwException(ex.getMessage());
return null;
}
}

View File

@ -1,6 +1,7 @@
package io.metersphere.api.tcp.server;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.mock.MockApiUtils;
import io.metersphere.api.service.MockConfigService;
import io.metersphere.base.domain.MockExpectConfigWithBLOBs;
import io.metersphere.commons.utils.CommonBeanFactory;
@ -50,7 +51,14 @@ public class TCPServicer {
} catch (InterruptedException e) {
e.printStackTrace();
}
returnMsg = responseObj.getString("body");
if(responseObj.containsKey("responseResult")){
JSONObject respResultObj = responseObj.getJSONObject("responseResult");
if(respResultObj.containsKey("body")){
returnMsg = MockApiUtils.getResultByResponseResult(respResultObj.getJSONObject("body"),"",null,null);
}
}else {
returnMsg = responseObj.getString("body");
}
}
return returnMsg;
}

View File

@ -15,5 +15,7 @@ public class ApiDefinitionWithBLOBs extends ApiDefinition implements Serializabl
private String response;
private String remark;
private static final long serialVersionUID = 1L;
}
}

View File

@ -1,8 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiTestCase implements Serializable {
private String id;
@ -43,5 +44,7 @@ public class ApiTestCase implements Serializable {
private Long order;
private String caseStatus;
private static final long serialVersionUID = 1L;
}
}

View File

@ -1373,6 +1373,76 @@ public class ApiTestCaseExample {
addCriterion("`order` not between", value1, value2, "order");
return (Criteria) this;
}
public Criteria andCaseStatusIsNull() {
addCriterion("case_status is null");
return (Criteria) this;
}
public Criteria andCaseStatusIsNotNull() {
addCriterion("case_status is not null");
return (Criteria) this;
}
public Criteria andCaseStatusEqualTo(String value) {
addCriterion("case_status =", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusNotEqualTo(String value) {
addCriterion("case_status <>", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusGreaterThan(String value) {
addCriterion("case_status >", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusGreaterThanOrEqualTo(String value) {
addCriterion("case_status >=", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusLessThan(String value) {
addCriterion("case_status <", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusLessThanOrEqualTo(String value) {
addCriterion("case_status <=", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusLike(String value) {
addCriterion("case_status like", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusNotLike(String value) {
addCriterion("case_status not like", value, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusIn(List<String> values) {
addCriterion("case_status in", values, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusNotIn(List<String> values) {
addCriterion("case_status not in", values, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusBetween(String value1, String value2) {
addCriterion("case_status between", value1, value2, "caseStatus");
return (Criteria) this;
}
public Criteria andCaseStatusNotBetween(String value1, String value2) {
addCriterion("case_status not between", value1, value2, "caseStatus");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
@ -1467,4 +1537,4 @@ public class ApiTestCaseExample {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class MessageTask implements Serializable {
@ -22,12 +21,12 @@ public class MessageTask implements Serializable {
private Boolean isSet;
private String organizationId;
private String testId;
private Long createTime;
private String workspaceId;
private String template;
private static final long serialVersionUID = 1L;

View File

@ -654,76 +654,6 @@ public class MessageTaskExample {
return (Criteria) this;
}
public Criteria andOrganizationIdIsNull() {
addCriterion("organization_id is null");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNotNull() {
addCriterion("organization_id is not null");
return (Criteria) this;
}
public Criteria andOrganizationIdEqualTo(String value) {
addCriterion("organization_id =", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotEqualTo(String value) {
addCriterion("organization_id <>", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThan(String value) {
addCriterion("organization_id >", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
addCriterion("organization_id >=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThan(String value) {
addCriterion("organization_id <", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
addCriterion("organization_id <=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLike(String value) {
addCriterion("organization_id like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotLike(String value) {
addCriterion("organization_id not like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdIn(List<String> values) {
addCriterion("organization_id in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotIn(List<String> values) {
addCriterion("organization_id not in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdBetween(String value1, String value2) {
addCriterion("organization_id between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
addCriterion("organization_id not between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
@ -853,6 +783,76 @@ public class MessageTaskExample {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andWorkspaceIdIsNull() {
addCriterion("workspace_id is null");
return (Criteria) this;
}
public Criteria andWorkspaceIdIsNotNull() {
addCriterion("workspace_id is not null");
return (Criteria) this;
}
public Criteria andWorkspaceIdEqualTo(String value) {
addCriterion("workspace_id =", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotEqualTo(String value) {
addCriterion("workspace_id <>", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdGreaterThan(String value) {
addCriterion("workspace_id >", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdGreaterThanOrEqualTo(String value) {
addCriterion("workspace_id >=", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLessThan(String value) {
addCriterion("workspace_id <", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLessThanOrEqualTo(String value) {
addCriterion("workspace_id <=", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLike(String value) {
addCriterion("workspace_id like", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotLike(String value) {
addCriterion("workspace_id not like", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdIn(List<String> values) {
addCriterion("workspace_id in", values, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotIn(List<String> values) {
addCriterion("workspace_id not in", values, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdBetween(String value1, String value2) {
addCriterion("workspace_id between", value1, value2, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotBetween(String value1, String value2) {
addCriterion("workspace_id not between", value1, value2, "workspaceId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

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

View File

@ -1,600 +0,0 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class OrganizationExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OrganizationExample() {
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 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 Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -17,8 +17,6 @@ public class Quota implements Serializable {
private String resourcePool;
private String organizationId;
private String workspaceId;
private Boolean useDefault;

View File

@ -484,76 +484,6 @@ public class QuotaExample {
return (Criteria) this;
}
public Criteria andOrganizationIdIsNull() {
addCriterion("organization_id is null");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNotNull() {
addCriterion("organization_id is not null");
return (Criteria) this;
}
public Criteria andOrganizationIdEqualTo(String value) {
addCriterion("organization_id =", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotEqualTo(String value) {
addCriterion("organization_id <>", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThan(String value) {
addCriterion("organization_id >", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
addCriterion("organization_id >=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThan(String value) {
addCriterion("organization_id <", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
addCriterion("organization_id <=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLike(String value) {
addCriterion("organization_id like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotLike(String value) {
addCriterion("organization_id not like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdIn(List<String> values) {
addCriterion("organization_id in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotIn(List<String> values) {
addCriterion("organization_id not in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdBetween(String value1, String value2) {
addCriterion("organization_id between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
addCriterion("organization_id not between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andWorkspaceIdIsNull() {
addCriterion("workspace_id is null");
return (Criteria) this;

View File

@ -0,0 +1,21 @@
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 RelationshipEdge extends RelationshipEdgeKey implements Serializable {
private String type;
private String graphId;
private String creator;
private Long createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -3,14 +3,14 @@ package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class UserRoleExample {
public class RelationshipEdgeExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserRoleExample() {
public RelationshipEdgeExample() {
oredCriteria = new ArrayList<Criteria>();
}
@ -104,216 +104,6 @@ public class UserRoleExample {
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 andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(String value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(String value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(String value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(String value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(String value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(String value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLike(String value) {
addCriterion("role_id like", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotLike(String value) {
addCriterion("role_id not like", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<String> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<String> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(String value1, String value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(String value1, String value2) {
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
@ -384,6 +174,286 @@ public class UserRoleExample {
return (Criteria) this;
}
public Criteria andTargetIdIsNull() {
addCriterion("target_id is null");
return (Criteria) this;
}
public Criteria andTargetIdIsNotNull() {
addCriterion("target_id is not null");
return (Criteria) this;
}
public Criteria andTargetIdEqualTo(String value) {
addCriterion("target_id =", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotEqualTo(String value) {
addCriterion("target_id <>", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdGreaterThan(String value) {
addCriterion("target_id >", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdGreaterThanOrEqualTo(String value) {
addCriterion("target_id >=", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdLessThan(String value) {
addCriterion("target_id <", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdLessThanOrEqualTo(String value) {
addCriterion("target_id <=", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdLike(String value) {
addCriterion("target_id like", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotLike(String value) {
addCriterion("target_id not like", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdIn(List<String> values) {
addCriterion("target_id in", values, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotIn(List<String> values) {
addCriterion("target_id not in", values, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdBetween(String value1, String value2) {
addCriterion("target_id between", value1, value2, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotBetween(String value1, String value2) {
addCriterion("target_id not between", value1, value2, "targetId");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("`type` like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andGraphIdIsNull() {
addCriterion("graph_id is null");
return (Criteria) this;
}
public Criteria andGraphIdIsNotNull() {
addCriterion("graph_id is not null");
return (Criteria) this;
}
public Criteria andGraphIdEqualTo(String value) {
addCriterion("graph_id =", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotEqualTo(String value) {
addCriterion("graph_id <>", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdGreaterThan(String value) {
addCriterion("graph_id >", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdGreaterThanOrEqualTo(String value) {
addCriterion("graph_id >=", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdLessThan(String value) {
addCriterion("graph_id <", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdLessThanOrEqualTo(String value) {
addCriterion("graph_id <=", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdLike(String value) {
addCriterion("graph_id like", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotLike(String value) {
addCriterion("graph_id not like", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdIn(List<String> values) {
addCriterion("graph_id in", values, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotIn(List<String> values) {
addCriterion("graph_id not in", values, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdBetween(String value1, String value2) {
addCriterion("graph_id between", value1, value2, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotBetween(String value1, String value2) {
addCriterion("graph_id not between", value1, value2, "graphId");
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
}
public Criteria andCreatorIsNotNull() {
addCriterion("creator is not null");
return (Criteria) this;
}
public Criteria andCreatorEqualTo(String value) {
addCriterion("creator =", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotEqualTo(String value) {
addCriterion("creator <>", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThan(String value) {
addCriterion("creator >", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThanOrEqualTo(String value) {
addCriterion("creator >=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThan(String value) {
addCriterion("creator <", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThanOrEqualTo(String value) {
addCriterion("creator <=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLike(String value) {
addCriterion("creator like", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotLike(String value) {
addCriterion("creator not like", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorIn(List<String> values) {
addCriterion("creator in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotIn(List<String> values) {
addCriterion("creator not in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorBetween(String value1, String value2) {
addCriterion("creator between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotBetween(String value1, String value2) {
addCriterion("creator not between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
@ -443,66 +513,6 @@ public class UserRoleExample {
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 {
@ -597,4 +607,4 @@ public class UserRoleExample {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -0,0 +1,13 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class RelationshipEdgeKey implements Serializable {
private String sourceId;
private String targetId;
private static final long serialVersionUID = 1L;
}

View File

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

View File

@ -1,600 +0,0 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class RoleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public RoleExample() {
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 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 andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("type like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("type not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -7,10 +7,10 @@ import lombok.Data;
public class ServiceIntegration implements Serializable {
private String id;
private String organizationId;
private String platform;
private String workspaceId;
private String configuration;
private static final long serialVersionUID = 1L;

View File

@ -174,76 +174,6 @@ public class ServiceIntegrationExample {
return (Criteria) this;
}
public Criteria andOrganizationIdIsNull() {
addCriterion("organization_id is null");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNotNull() {
addCriterion("organization_id is not null");
return (Criteria) this;
}
public Criteria andOrganizationIdEqualTo(String value) {
addCriterion("organization_id =", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotEqualTo(String value) {
addCriterion("organization_id <>", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThan(String value) {
addCriterion("organization_id >", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
addCriterion("organization_id >=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThan(String value) {
addCriterion("organization_id <", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
addCriterion("organization_id <=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLike(String value) {
addCriterion("organization_id like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotLike(String value) {
addCriterion("organization_id not like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdIn(List<String> values) {
addCriterion("organization_id in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotIn(List<String> values) {
addCriterion("organization_id not in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdBetween(String value1, String value2) {
addCriterion("organization_id between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
addCriterion("organization_id not between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andPlatformIsNull() {
addCriterion("platform is null");
return (Criteria) this;
@ -313,6 +243,76 @@ public class ServiceIntegrationExample {
addCriterion("platform not between", value1, value2, "platform");
return (Criteria) this;
}
public Criteria andWorkspaceIdIsNull() {
addCriterion("workspace_id is null");
return (Criteria) this;
}
public Criteria andWorkspaceIdIsNotNull() {
addCriterion("workspace_id is not null");
return (Criteria) this;
}
public Criteria andWorkspaceIdEqualTo(String value) {
addCriterion("workspace_id =", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotEqualTo(String value) {
addCriterion("workspace_id <>", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdGreaterThan(String value) {
addCriterion("workspace_id >", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdGreaterThanOrEqualTo(String value) {
addCriterion("workspace_id >=", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLessThan(String value) {
addCriterion("workspace_id <", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLessThanOrEqualTo(String value) {
addCriterion("workspace_id <=", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLike(String value) {
addCriterion("workspace_id like", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotLike(String value) {
addCriterion("workspace_id not like", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdIn(List<String> values) {
addCriterion("workspace_id in", values, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotIn(List<String> values) {
addCriterion("workspace_id not in", values, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdBetween(String value1, String value2) {
addCriterion("workspace_id between", value1, value2, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotBetween(String value1, String value2) {
addCriterion("workspace_id not between", value1, value2, "workspaceId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseReview implements Serializable {
@ -26,6 +25,8 @@ public class TestCaseReview implements Serializable {
private String createUser;
private String followPeople;
private String description;
private static final long serialVersionUID = 1L;

View File

@ -773,6 +773,76 @@ public class TestCaseReviewExample {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andFollowPeopleIsNull() {
addCriterion("follow_people is null");
return (Criteria) this;
}
public Criteria andFollowPeopleIsNotNull() {
addCriterion("follow_people is not null");
return (Criteria) this;
}
public Criteria andFollowPeopleEqualTo(String value) {
addCriterion("follow_people =", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotEqualTo(String value) {
addCriterion("follow_people <>", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleGreaterThan(String value) {
addCriterion("follow_people >", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleGreaterThanOrEqualTo(String value) {
addCriterion("follow_people >=", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLessThan(String value) {
addCriterion("follow_people <", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLessThanOrEqualTo(String value) {
addCriterion("follow_people <=", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLike(String value) {
addCriterion("follow_people like", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotLike(String value) {
addCriterion("follow_people not like", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleIn(List<String> values) {
addCriterion("follow_people in", values, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotIn(List<String> values) {
addCriterion("follow_people not in", values, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleBetween(String value1, String value2) {
addCriterion("follow_people between", value1, value2, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotBetween(String value1, String value2) {
addCriterion("follow_people not between", value1, value2, "followPeople");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -19,8 +19,6 @@ public class TestPlan implements Serializable {
private String stage;
private String principal;
private String testCaseMatchRule;
private String executorMatchRule;
@ -29,14 +27,14 @@ public class TestPlan implements Serializable {
private Long updateTime;
private Long actualEndTime;
private Long plannedStartTime;
private Long plannedEndTime;
private Long actualStartTime;
private Long actualEndTime;
private String creator;
private String projectId;
@ -45,5 +43,7 @@ public class TestPlan implements Serializable {
private Boolean automaticStatusUpdate;
private String followPeople;
private static final long serialVersionUID = 1L;
}

View File

@ -594,76 +594,6 @@ public class TestPlanExample {
return (Criteria) this;
}
public Criteria andPrincipalIsNull() {
addCriterion("principal is null");
return (Criteria) this;
}
public Criteria andPrincipalIsNotNull() {
addCriterion("principal is not null");
return (Criteria) this;
}
public Criteria andPrincipalEqualTo(String value) {
addCriterion("principal =", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotEqualTo(String value) {
addCriterion("principal <>", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalGreaterThan(String value) {
addCriterion("principal >", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalGreaterThanOrEqualTo(String value) {
addCriterion("principal >=", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalLessThan(String value) {
addCriterion("principal <", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalLessThanOrEqualTo(String value) {
addCriterion("principal <=", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalLike(String value) {
addCriterion("principal like", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotLike(String value) {
addCriterion("principal not like", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalIn(List<String> values) {
addCriterion("principal in", values, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotIn(List<String> values) {
addCriterion("principal not in", values, "principal");
return (Criteria) this;
}
public Criteria andPrincipalBetween(String value1, String value2) {
addCriterion("principal between", value1, value2, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotBetween(String value1, String value2) {
addCriterion("principal not between", value1, value2, "principal");
return (Criteria) this;
}
public Criteria andTestCaseMatchRuleIsNull() {
addCriterion("test_case_match_rule is null");
return (Criteria) this;
@ -924,6 +854,66 @@ public class TestPlanExample {
return (Criteria) this;
}
public Criteria andActualEndTimeIsNull() {
addCriterion("actual_end_time is null");
return (Criteria) this;
}
public Criteria andActualEndTimeIsNotNull() {
addCriterion("actual_end_time is not null");
return (Criteria) this;
}
public Criteria andActualEndTimeEqualTo(Long value) {
addCriterion("actual_end_time =", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotEqualTo(Long value) {
addCriterion("actual_end_time <>", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThan(Long value) {
addCriterion("actual_end_time >", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("actual_end_time >=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThan(Long value) {
addCriterion("actual_end_time <", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThanOrEqualTo(Long value) {
addCriterion("actual_end_time <=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeIn(List<Long> values) {
addCriterion("actual_end_time in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotIn(List<Long> values) {
addCriterion("actual_end_time not in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeBetween(Long value1, Long value2) {
addCriterion("actual_end_time between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotBetween(Long value1, Long value2) {
addCriterion("actual_end_time not between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andPlannedStartTimeIsNull() {
addCriterion("planned_start_time is null");
return (Criteria) this;
@ -1104,66 +1094,6 @@ public class TestPlanExample {
return (Criteria) this;
}
public Criteria andActualEndTimeIsNull() {
addCriterion("actual_end_time is null");
return (Criteria) this;
}
public Criteria andActualEndTimeIsNotNull() {
addCriterion("actual_end_time is not null");
return (Criteria) this;
}
public Criteria andActualEndTimeEqualTo(Long value) {
addCriterion("actual_end_time =", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotEqualTo(Long value) {
addCriterion("actual_end_time <>", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThan(Long value) {
addCriterion("actual_end_time >", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("actual_end_time >=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThan(Long value) {
addCriterion("actual_end_time <", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThanOrEqualTo(Long value) {
addCriterion("actual_end_time <=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeIn(List<Long> values) {
addCriterion("actual_end_time in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotIn(List<Long> values) {
addCriterion("actual_end_time not in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeBetween(Long value1, Long value2) {
addCriterion("actual_end_time between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotBetween(Long value1, Long value2) {
addCriterion("actual_end_time not between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
@ -1423,6 +1353,76 @@ public class TestPlanExample {
addCriterion("automatic_status_update not between", value1, value2, "automaticStatusUpdate");
return (Criteria) this;
}
public Criteria andFollowPeopleIsNull() {
addCriterion("follow_people is null");
return (Criteria) this;
}
public Criteria andFollowPeopleIsNotNull() {
addCriterion("follow_people is not null");
return (Criteria) this;
}
public Criteria andFollowPeopleEqualTo(String value) {
addCriterion("follow_people =", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotEqualTo(String value) {
addCriterion("follow_people <>", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleGreaterThan(String value) {
addCriterion("follow_people >", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleGreaterThanOrEqualTo(String value) {
addCriterion("follow_people >=", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLessThan(String value) {
addCriterion("follow_people <", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLessThanOrEqualTo(String value) {
addCriterion("follow_people <=", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLike(String value) {
addCriterion("follow_people like", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotLike(String value) {
addCriterion("follow_people not like", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleIn(List<String> values) {
addCriterion("follow_people in", values, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotIn(List<String> values) {
addCriterion("follow_people not in", values, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleBetween(String value1, String value2) {
addCriterion("follow_people between", value1, value2, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotBetween(String value1, String value2) {
addCriterion("follow_people not between", value1, value2, "followPeople");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -23,8 +23,6 @@ public class User implements Serializable {
private String lastWorkspaceId;
private String lastOrganizationId;
private String phone;
private String source;

View File

@ -714,76 +714,6 @@ public class UserExample {
return (Criteria) this;
}
public Criteria andLastOrganizationIdIsNull() {
addCriterion("last_organization_id is null");
return (Criteria) this;
}
public Criteria andLastOrganizationIdIsNotNull() {
addCriterion("last_organization_id is not null");
return (Criteria) this;
}
public Criteria andLastOrganizationIdEqualTo(String value) {
addCriterion("last_organization_id =", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdNotEqualTo(String value) {
addCriterion("last_organization_id <>", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdGreaterThan(String value) {
addCriterion("last_organization_id >", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdGreaterThanOrEqualTo(String value) {
addCriterion("last_organization_id >=", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdLessThan(String value) {
addCriterion("last_organization_id <", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdLessThanOrEqualTo(String value) {
addCriterion("last_organization_id <=", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdLike(String value) {
addCriterion("last_organization_id like", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdNotLike(String value) {
addCriterion("last_organization_id not like", value, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdIn(List<String> values) {
addCriterion("last_organization_id in", values, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdNotIn(List<String> values) {
addCriterion("last_organization_id not in", values, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdBetween(String value1, String value2) {
addCriterion("last_organization_id between", value1, value2, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andLastOrganizationIdNotBetween(String value1, String value2) {
addCriterion("last_organization_id not between", value1, value2, "lastOrganizationId");
return (Criteria) this;
}
public Criteria andPhoneIsNull() {
addCriterion("phone is null");
return (Criteria) this;

View File

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

View File

@ -7,8 +7,6 @@ import lombok.Data;
public class Workspace implements Serializable {
private String id;
private String organizationId;
private String name;
private String description;

View File

@ -174,76 +174,6 @@ public class WorkspaceExample {
return (Criteria) this;
}
public Criteria andOrganizationIdIsNull() {
addCriterion("organization_id is null");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNotNull() {
addCriterion("organization_id is not null");
return (Criteria) this;
}
public Criteria andOrganizationIdEqualTo(String value) {
addCriterion("organization_id =", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotEqualTo(String value) {
addCriterion("organization_id <>", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThan(String value) {
addCriterion("organization_id >", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
addCriterion("organization_id >=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThan(String value) {
addCriterion("organization_id <", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
addCriterion("organization_id <=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLike(String value) {
addCriterion("organization_id like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotLike(String value) {
addCriterion("organization_id not like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdIn(List<String> values) {
addCriterion("organization_id in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotIn(List<String> values) {
addCriterion("organization_id not in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdBetween(String value1, String value2) {
addCriterion("organization_id between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
addCriterion("organization_id not between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;

View File

@ -32,6 +32,7 @@
<result column="description" jdbcType="LONGVARCHAR" property="description" />
<result column="request" jdbcType="LONGVARCHAR" property="request" />
<result column="response" jdbcType="LONGVARCHAR" property="response" />
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -92,13 +93,13 @@
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, `method`, protocol, `path`, module_path, environment_id,
schedule, `status`, module_id, user_id, create_time, update_time, num, tags, original_state,
create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id,
id, project_id, `name`, `method`, protocol, `path`, module_path, environment_id,
schedule, `status`, module_id, user_id, create_time, update_time, num, tags, original_state,
create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id,
follow_people, `order`
</sql>
<sql id="Blob_Column_List">
description, request, response
description, request, response, remark
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultMap="ResultMapWithBLOBs">
select
@ -131,7 +132,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
@ -149,26 +150,26 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition (id, project_id, `name`,
`method`, protocol, `path`,
module_path, environment_id, schedule,
`status`, module_id, user_id,
create_time, update_time, num,
tags, original_state, create_user,
case_total, case_status, case_passing_rate,
delete_time, delete_user_id, follow_people,
`order`, description, request,
response)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
#{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{schedule,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{num,jdbcType=INTEGER},
#{tags,jdbcType=VARCHAR}, #{originalState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{caseTotal,jdbcType=VARCHAR}, #{caseStatus,jdbcType=VARCHAR}, #{casePassingRate,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR},
#{order,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR},
#{response,jdbcType=LONGVARCHAR})
insert into api_definition (id, project_id, `name`,
`method`, protocol, `path`,
module_path, environment_id, schedule,
`status`, module_id, user_id,
create_time, update_time, num,
tags, original_state, create_user,
case_total, case_status, case_passing_rate,
delete_time, delete_user_id, follow_people,
`order`, description, request,
response, remark)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
#{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{schedule,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{num,jdbcType=INTEGER},
#{tags,jdbcType=VARCHAR}, #{originalState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{caseTotal,jdbcType=VARCHAR}, #{caseStatus,jdbcType=VARCHAR}, #{casePassingRate,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR},
#{order,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR},
#{response,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition
@ -257,6 +258,9 @@
<if test="response != null">
response,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -343,6 +347,9 @@
<if test="response != null">
#{response,jdbcType=LONGVARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultType="java.lang.Long">
@ -438,6 +445,9 @@
<if test="record.response != null">
response = #{record.response,jdbcType=LONGVARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -472,7 +482,8 @@
`order` = #{record.order,jdbcType=BIGINT},
description = #{record.description,jdbcType=LONGVARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR},
response = #{record.response,jdbcType=LONGVARCHAR}
response = #{record.response,jdbcType=LONGVARCHAR},
remark = #{record.remark,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -592,6 +603,9 @@
<if test="response != null">
response = #{response,jdbcType=LONGVARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -623,7 +637,8 @@
`order` = #{order,jdbcType=BIGINT},
description = #{description,jdbcType=LONGVARCHAR},
request = #{request,jdbcType=LONGVARCHAR},
response = #{response,jdbcType=LONGVARCHAR}
response = #{response,jdbcType=LONGVARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiDefinition">
@ -654,4 +669,4 @@
`order` = #{order,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
</mapper>

View File

@ -21,6 +21,7 @@
<result column="version" jdbcType="INTEGER" property="version" />
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
<result column="order" jdbcType="BIGINT" property="order" />
<result column="case_status" jdbcType="VARCHAR" property="caseStatus" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -85,9 +86,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
create_time, update_time, num, tags, last_result_id, `status`, original_status, delete_time,
delete_user_id, version, follow_people, `order`
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
create_time, update_time, num, tags, last_result_id, `status`, original_status, delete_time,
delete_user_id, version, follow_people, `order`, case_status
</sql>
<sql id="Blob_Column_List">
description, request
@ -123,7 +124,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
@ -141,22 +142,22 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
insert into api_test_case (id, project_id, `name`,
priority, api_definition_id, create_user_id,
update_user_id, create_time, update_time,
num, tags, last_result_id,
`status`, original_status, delete_time,
delete_user_id, version, follow_people,
`order`, description, request
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{lastResultId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
#{deleteUserId,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR},
#{order,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}
)
insert into api_test_case (id, project_id, `name`,
priority, api_definition_id, create_user_id,
update_user_id, create_time, update_time,
num, tags, last_result_id,
`status`, original_status, delete_time,
delete_user_id, version, follow_people,
`order`, case_status, description,
request)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{lastResultId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
#{deleteUserId,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR},
#{order,jdbcType=BIGINT}, #{caseStatus,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
#{request,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
insert into api_test_case
@ -218,6 +219,9 @@
<if test="order != null">
`order`,
</if>
<if test="caseStatus != null">
case_status,
</if>
<if test="description != null">
description,
</if>
@ -283,6 +287,9 @@
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="caseStatus != null">
#{caseStatus,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
@ -357,6 +364,9 @@
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.caseStatus != null">
case_status = #{record.caseStatus,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
@ -389,6 +399,7 @@
version = #{record.version,jdbcType=INTEGER},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
case_status = #{record.caseStatus,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -415,7 +426,8 @@
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
version = #{record.version,jdbcType=INTEGER},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}
`order` = #{record.order,jdbcType=BIGINT},
case_status = #{record.caseStatus,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -477,6 +489,9 @@
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="caseStatus != null">
case_status = #{caseStatus,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
@ -506,6 +521,7 @@
version = #{version,jdbcType=INTEGER},
follow_people = #{followPeople,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
case_status = #{caseStatus,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
request = #{request,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
@ -529,7 +545,8 @@
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
version = #{version,jdbcType=INTEGER},
follow_people = #{followPeople,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}
`order` = #{order,jdbcType=BIGINT},
case_status = #{caseStatus,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
</mapper>

View File

@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.MessageTask;
import io.metersphere.base.domain.MessageTaskExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface MessageTaskMapper {
long countByExample(MessageTaskExample example);

View File

@ -10,9 +10,9 @@
<result column="webhook" jdbcType="VARCHAR" property="webhook" />
<result column="identification" jdbcType="VARCHAR" property="identification" />
<result column="is_set" jdbcType="BIT" property="isSet" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.MessageTask">
<result column="template" jdbcType="LONGVARCHAR" property="template" />
@ -28,13 +28,13 @@
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
AND ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
AND ${criterion.condition}
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
@ -76,26 +76,26 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `type`, event, user_id, task_type, webhook, identification, is_set, organization_id,
test_id, create_time
id, `type`, event, user_id, task_type, webhook, identification, is_set, test_id,
create_time, workspace_id
</sql>
<sql id="Blob_Column_List">
`template`
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="ResultMapWithBLOBs">
SELECT
select
<if test="distinct">
DISTINCT
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
FROM message_task
from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
ORDER BY ${orderByClause}
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
@ -131,15 +131,15 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
INSERT INTO message_task (id, `type`, event,
insert into message_task (id, `type`, event,
user_id, task_type, webhook,
identification, is_set, organization_id,
test_id, create_time, `template`
identification, is_set, test_id,
create_time, workspace_id, `template`
)
VALUES (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT}, #{organizationId,jdbcType=VARCHAR},
#{testId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{template,jdbcType=LONGVARCHAR}
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT}, #{testId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{workspaceId,jdbcType=VARCHAR}, #{template,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
@ -169,15 +169,15 @@
<if test="isSet != null">
is_set,
</if>
<if test="organizationId != null">
organization_id,
</if>
<if test="testId != null">
test_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="workspaceId != null">
workspace_id,
</if>
<if test="template != null">
`template`,
</if>
@ -207,15 +207,15 @@
<if test="isSet != null">
#{isSet,jdbcType=BIT},
</if>
<if test="organizationId != null">
#{organizationId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="workspaceId != null">
#{workspaceId,jdbcType=VARCHAR},
</if>
<if test="template != null">
#{template,jdbcType=LONGVARCHAR},
</if>
@ -254,15 +254,15 @@
<if test="record.isSet != null">
is_set = #{record.isSet,jdbcType=BIT},
</if>
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=VARCHAR},
</if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.workspaceId != null">
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
</if>
<if test="record.template != null">
`template` = #{record.template,jdbcType=LONGVARCHAR},
</if>
@ -272,8 +272,8 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
UPDATE message_task
SET id = #{record.id,jdbcType=VARCHAR},
update message_task
set id = #{record.id,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
event = #{record.event,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
@ -281,9 +281,9 @@
webhook = #{record.webhook,jdbcType=VARCHAR},
identification = #{record.identification,jdbcType=VARCHAR},
is_set = #{record.isSet,jdbcType=BIT},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
`template` = #{record.template,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -299,9 +299,9 @@
webhook = #{record.webhook,jdbcType=VARCHAR},
identification = #{record.identification,jdbcType=VARCHAR},
is_set = #{record.isSet,jdbcType=BIT},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
create_time = #{record.createTime,jdbcType=BIGINT},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -330,15 +330,15 @@
<if test="isSet != null">
is_set = #{isSet,jdbcType=BIT},
</if>
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="workspaceId != null">
workspace_id = #{workspaceId,jdbcType=VARCHAR},
</if>
<if test="template != null">
`template` = #{template,jdbcType=LONGVARCHAR},
</if>
@ -346,32 +346,32 @@
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.MessageTask">
UPDATE message_task
SET `type` = #{type,jdbcType=VARCHAR},
update message_task
set `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=VARCHAR},
webhook = #{webhook,jdbcType=VARCHAR},
identification = #{identification,jdbcType=VARCHAR},
is_set = #{isSet,jdbcType=BIT},
organization_id = #{organizationId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
`template` = #{template,jdbcType=LONGVARCHAR}
WHERE id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
UPDATE message_task
SET `type` = #{type,jdbcType=VARCHAR},
update message_task
set `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=VARCHAR},
webhook = #{webhook,jdbcType=VARCHAR},
identification = #{identification,jdbcType=VARCHAR},
is_set = #{isSet,jdbcType=BIT},
organization_id = #{organizationId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
WHERE id = #{id,jdbcType=VARCHAR}
create_time = #{createTime,jdbcType=BIGINT},
workspace_id = #{workspaceId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

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

View File

@ -1,228 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.OrganizationMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.Organization">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</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`, description, create_time, update_time, create_user
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.OrganizationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from organization
<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 organization
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from organization
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.OrganizationExample">
delete from organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Organization">
insert into organization (id, `name`, description,
create_time, update_time, create_user
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Organization">
insert into organization
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
`name`,
</if>
<if test="description != null">
description,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createUser != null">
create_user,
</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="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.OrganizationExample" resultType="java.lang.Long">
select count(*) from organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update organization
<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.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>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update organization
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.Organization">
update organization
<set>
<if test="name != null">
`name` = #{name,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>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Organization">
update organization
set `name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -8,7 +8,6 @@
<result column="max_threads" jdbcType="INTEGER" property="maxThreads" />
<result column="duration" jdbcType="INTEGER" property="duration" />
<result column="resource_pool" jdbcType="VARCHAR" property="resourcePool" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="use_default" jdbcType="BIT" property="useDefault" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
@ -72,8 +71,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, api, performance, max_threads, duration, resource_pool, organization_id, workspace_id,
use_default, update_time
id, api, performance, max_threads, duration, resource_pool, workspace_id, use_default,
update_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.QuotaExample" resultMap="BaseResultMap">
select
@ -108,12 +107,12 @@
<insert id="insert" parameterType="io.metersphere.base.domain.Quota">
insert into quota (id, api, performance,
max_threads, duration, resource_pool,
organization_id, workspace_id, use_default,
update_time)
workspace_id, use_default, update_time
)
values (#{id,jdbcType=VARCHAR}, #{api,jdbcType=INTEGER}, #{performance,jdbcType=INTEGER},
#{maxThreads,jdbcType=INTEGER}, #{duration,jdbcType=INTEGER}, #{resourcePool,jdbcType=VARCHAR},
#{organizationId,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{useDefault,jdbcType=BIT},
#{updateTime,jdbcType=BIGINT})
#{workspaceId,jdbcType=VARCHAR}, #{useDefault,jdbcType=BIT}, #{updateTime,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Quota">
insert into quota
@ -136,9 +135,6 @@
<if test="resourcePool != null">
resource_pool,
</if>
<if test="organizationId != null">
organization_id,
</if>
<if test="workspaceId != null">
workspace_id,
</if>
@ -168,9 +164,6 @@
<if test="resourcePool != null">
#{resourcePool,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
#{organizationId,jdbcType=VARCHAR},
</if>
<if test="workspaceId != null">
#{workspaceId,jdbcType=VARCHAR},
</if>
@ -209,9 +202,6 @@
<if test="record.resourcePool != null">
resource_pool = #{record.resourcePool,jdbcType=VARCHAR},
</if>
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=VARCHAR},
</if>
<if test="record.workspaceId != null">
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
</if>
@ -234,7 +224,6 @@
max_threads = #{record.maxThreads,jdbcType=INTEGER},
duration = #{record.duration,jdbcType=INTEGER},
resource_pool = #{record.resourcePool,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
use_default = #{record.useDefault,jdbcType=BIT},
update_time = #{record.updateTime,jdbcType=BIGINT}
@ -260,9 +249,6 @@
<if test="resourcePool != null">
resource_pool = #{resourcePool,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=VARCHAR},
</if>
<if test="workspaceId != null">
workspace_id = #{workspaceId,jdbcType=VARCHAR},
</if>
@ -282,7 +268,6 @@
max_threads = #{maxThreads,jdbcType=INTEGER},
duration = #{duration,jdbcType=INTEGER},
resource_pool = #{resourcePool,jdbcType=VARCHAR},
organization_id = #{organizationId,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
use_default = #{useDefault,jdbcType=BIT},
update_time = #{updateTime,jdbcType=BIGINT}

View File

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

View File

@ -1,13 +1,13 @@
<?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.UserRoleMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.UserRole">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="role_id" jdbcType="VARCHAR" property="roleId" />
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<mapper namespace="io.metersphere.base.mapper.RelationshipEdgeMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.RelationshipEdge">
<id column="source_id" jdbcType="VARCHAR" property="sourceId" />
<id column="target_id" jdbcType="VARCHAR" property="targetId" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="graph_id" jdbcType="VARCHAR" property="graphId" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -68,15 +68,15 @@
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, role_id, source_id, create_time, update_time
source_id, target_id, `type`, graph_id, creator, create_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserRoleExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.base.domain.RelationshipEdgeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_role
from relationship_edge
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -84,145 +84,145 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<select id="selectByPrimaryKey" parameterType="io.metersphere.base.domain.RelationshipEdgeKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_role
where id = #{id,jdbcType=VARCHAR}
from relationship_edge
where source_id = #{sourceId,jdbcType=VARCHAR}
and target_id = #{targetId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from user_role
where id = #{id,jdbcType=VARCHAR}
<delete id="deleteByPrimaryKey" parameterType="io.metersphere.base.domain.RelationshipEdgeKey">
delete from relationship_edge
where source_id = #{sourceId,jdbcType=VARCHAR}
and target_id = #{targetId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.UserRoleExample">
delete from user_role
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.RelationshipEdgeExample">
delete from relationship_edge
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.UserRole">
insert into user_role (id, user_id, role_id,
source_id, create_time, update_time
<insert id="insert" parameterType="io.metersphere.base.domain.RelationshipEdge">
insert into relationship_edge (source_id, target_id, `type`,
graph_id, creator, create_time
)
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{roleId,jdbcType=VARCHAR},
#{sourceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
values (#{sourceId,jdbcType=VARCHAR}, #{targetId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{graphId,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UserRole">
insert into user_role
<insert id="insertSelective" parameterType="io.metersphere.base.domain.RelationshipEdge">
insert into relationship_edge
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="roleId != null">
role_id,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="targetId != null">
target_id,
</if>
<if test="type != null">
`type`,
</if>
<if test="graphId != null">
graph_id,
</if>
<if test="creator != null">
creator,
</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="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
#{roleId,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="targetId != null">
#{targetId,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="graphId != null">
#{graphId,jdbcType=VARCHAR},
</if>
<if test="creator != null">
#{creator,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.UserRoleExample" resultType="java.lang.Long">
select count(*) from user_role
<select id="countByExample" parameterType="io.metersphere.base.domain.RelationshipEdgeExample" resultType="java.lang.Long">
select count(*) from relationship_edge
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user_role
update relationship_edge
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=VARCHAR},
</if>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.targetId != null">
target_id = #{record.targetId,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.graphId != null">
graph_id = #{record.graphId,jdbcType=VARCHAR},
</if>
<if test="record.creator != null">
creator = #{record.creator,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 user_role
set id = #{record.id,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
role_id = #{record.roleId,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
update relationship_edge
set source_id = #{record.sourceId,jdbcType=VARCHAR},
target_id = #{record.targetId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
graph_id = #{record.graphId,jdbcType=VARCHAR},
creator = #{record.creator,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.UserRole">
update user_role
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.RelationshipEdge">
update relationship_edge
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
role_id = #{roleId,jdbcType=VARCHAR},
<if test="graphId != null">
graph_id = #{graphId,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR},
<if test="creator != null">
creator = #{creator,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}
where source_id = #{sourceId,jdbcType=VARCHAR}
and target_id = #{targetId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.UserRole">
update user_role
set user_id = #{userId,jdbcType=VARCHAR},
role_id = #{roleId,jdbcType=VARCHAR},
source_id = #{sourceId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.RelationshipEdge">
update relationship_edge
set `type` = #{type,jdbcType=VARCHAR},
graph_id = #{graphId,jdbcType=VARCHAR},
creator = #{creator,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where source_id = #{sourceId,jdbcType=VARCHAR}
and target_id = #{targetId,jdbcType=VARCHAR}
</update>
</mapper>
</mapper>

View File

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

View File

@ -1,228 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.RoleMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.Role">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="type" jdbcType="VARCHAR" property="type" />
<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, description, type, create_time, update_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.RoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from role
<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 role
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from role
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.RoleExample">
delete from role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Role">
insert into role (id, name, description,
type, create_time, update_time
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Role">
insert into role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="type != null">
type,
</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="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,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.RoleExample" resultType="java.lang.Long">
select count(*) from role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update role
<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.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,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 role
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
type = #{record.type,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.Role">
update role
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,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.Role">
update role
set name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -3,8 +3,8 @@
<mapper namespace="io.metersphere.base.mapper.ServiceIntegrationMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ServiceIntegration">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="platform" jdbcType="VARCHAR" property="platform" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ServiceIntegration">
<result column="configuration" jdbcType="LONGVARCHAR" property="configuration" />
@ -68,7 +68,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, organization_id, platform
id, platform, workspace_id
</sql>
<sql id="Blob_Column_List">
configuration
@ -122,9 +122,9 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ServiceIntegration">
insert into service_integration (id, organization_id, platform,
insert into service_integration (id, platform, workspace_id,
configuration)
values (#{id,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR},
#{configuration,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ServiceIntegration">
@ -133,12 +133,12 @@
<if test="id != null">
id,
</if>
<if test="organizationId != null">
organization_id,
</if>
<if test="platform != null">
platform,
</if>
<if test="workspaceId != null">
workspace_id,
</if>
<if test="configuration != null">
configuration,
</if>
@ -147,12 +147,12 @@
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
#{organizationId,jdbcType=VARCHAR},
</if>
<if test="platform != null">
#{platform,jdbcType=VARCHAR},
</if>
<if test="workspaceId != null">
#{workspaceId,jdbcType=VARCHAR},
</if>
<if test="configuration != null">
#{configuration,jdbcType=LONGVARCHAR},
</if>
@ -170,12 +170,12 @@
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=VARCHAR},
</if>
<if test="record.platform != null">
platform = #{record.platform,jdbcType=VARCHAR},
</if>
<if test="record.workspaceId != null">
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
</if>
<if test="record.configuration != null">
configuration = #{record.configuration,jdbcType=LONGVARCHAR},
</if>
@ -187,8 +187,8 @@
<update id="updateByExampleWithBLOBs" parameterType="map">
update service_integration
set id = #{record.id,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
configuration = #{record.configuration,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -197,8 +197,8 @@
<update id="updateByExample" parameterType="map">
update service_integration
set id = #{record.id,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR}
platform = #{record.platform,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -206,12 +206,12 @@
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ServiceIntegration">
update service_integration
<set>
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=VARCHAR},
</if>
<if test="platform != null">
platform = #{platform,jdbcType=VARCHAR},
</if>
<if test="workspaceId != null">
workspace_id = #{workspaceId,jdbcType=VARCHAR},
</if>
<if test="configuration != null">
configuration = #{configuration,jdbcType=LONGVARCHAR},
</if>
@ -220,15 +220,15 @@
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ServiceIntegration">
update service_integration
set organization_id = #{organizationId,jdbcType=VARCHAR},
platform = #{platform,jdbcType=VARCHAR},
set platform = #{platform,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
configuration = #{configuration,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ServiceIntegration">
update service_integration
set organization_id = #{organizationId,jdbcType=VARCHAR},
platform = #{platform,jdbcType=VARCHAR}
set platform = #{platform,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -12,6 +12,7 @@
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReview">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -76,7 +77,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, creator, `status`, create_time, update_time, end_time, project_id, tags,
create_user
create_user, follow_people
</sql>
<sql id="Blob_Column_List">
description
@ -133,11 +134,13 @@
insert into test_case_review (id, `name`, creator,
`status`, create_time, update_time,
end_time, project_id, tags,
create_user, description)
create_user, follow_people, description
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR})
#{createUser,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReview">
insert into test_case_review
@ -172,6 +175,9 @@
<if test="createUser != null">
create_user,
</if>
<if test="followPeople != null">
follow_people,
</if>
<if test="description != null">
description,
</if>
@ -207,6 +213,9 @@
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="followPeople != null">
#{followPeople,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
@ -251,6 +260,9 @@
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.followPeople != null">
follow_people = #{record.followPeople,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
@ -271,6 +283,7 @@
project_id = #{record.projectId,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -287,7 +300,8 @@
end_time = #{record.endTime,jdbcType=BIGINT},
project_id = #{record.projectId,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}
create_user = #{record.createUser,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -322,6 +336,9 @@
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="followPeople != null">
follow_people = #{followPeople,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
@ -339,6 +356,7 @@
project_id = #{projectId,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -352,7 +370,8 @@
end_time = #{endTime,jdbcType=BIGINT},
project_id = #{projectId,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}
create_user = #{createUser,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -9,19 +9,19 @@
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="stage" jdbcType="VARCHAR" property="stage" />
<result column="principal" jdbcType="VARCHAR" property="principal" />
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" />
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
<result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime" />
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime" />
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="execution_times" jdbcType="INTEGER" property="executionTimes" />
<result column="automatic_status_update" jdbcType="BIT" property="automaticStatusUpdate" />
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanWithBLOBs">
<result column="tags" jdbcType="LONGVARCHAR" property="tags" />
@ -87,9 +87,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time, planned_start_time, planned_end_time,
actual_start_time, actual_end_time, creator, project_id, execution_times, automatic_status_update
id, workspace_id, report_id, `name`, description, `status`, stage, test_case_match_rule,
executor_match_rule, create_time, update_time, actual_end_time, planned_start_time,
planned_end_time, actual_start_time, creator, project_id, execution_times, automatic_status_update,
follow_people
</sql>
<sql id="Blob_Column_List">
tags, report_summary, report_config
@ -145,19 +146,19 @@
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanWithBLOBs">
insert into test_plan (id, workspace_id, report_id,
`name`, description, `status`,
stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time,
stage, test_case_match_rule, executor_match_rule,
create_time, update_time, actual_end_time,
planned_start_time, planned_end_time, actual_start_time,
actual_end_time, creator, project_id,
execution_times, automatic_status_update, tags,
creator, project_id, execution_times,
automatic_status_update, follow_people, tags,
report_summary, report_config)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{stage,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR}, #{executorMatchRule,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{actualEndTime,jdbcType=BIGINT},
#{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT}, #{actualStartTime,jdbcType=BIGINT},
#{actualEndTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{executionTimes,jdbcType=INTEGER}, #{automaticStatusUpdate,jdbcType=BIT}, #{tags,jdbcType=LONGVARCHAR},
#{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{executionTimes,jdbcType=INTEGER},
#{automaticStatusUpdate,jdbcType=BIT}, #{followPeople,jdbcType=VARCHAR}, #{tags,jdbcType=LONGVARCHAR},
#{reportSummary,jdbcType=LONGVARCHAR}, #{reportConfig,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanWithBLOBs">
@ -184,9 +185,6 @@
<if test="stage != null">
stage,
</if>
<if test="principal != null">
principal,
</if>
<if test="testCaseMatchRule != null">
test_case_match_rule,
</if>
@ -199,6 +197,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="actualEndTime != null">
actual_end_time,
</if>
<if test="plannedStartTime != null">
planned_start_time,
</if>
@ -208,9 +209,6 @@
<if test="actualStartTime != null">
actual_start_time,
</if>
<if test="actualEndTime != null">
actual_end_time,
</if>
<if test="creator != null">
creator,
</if>
@ -223,6 +221,9 @@
<if test="automaticStatusUpdate != null">
automatic_status_update,
</if>
<if test="followPeople != null">
follow_people,
</if>
<if test="tags != null">
tags,
</if>
@ -255,9 +256,6 @@
<if test="stage != null">
#{stage,jdbcType=VARCHAR},
</if>
<if test="principal != null">
#{principal,jdbcType=VARCHAR},
</if>
<if test="testCaseMatchRule != null">
#{testCaseMatchRule,jdbcType=VARCHAR},
</if>
@ -270,6 +268,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
#{actualEndTime,jdbcType=BIGINT},
</if>
<if test="plannedStartTime != null">
#{plannedStartTime,jdbcType=BIGINT},
</if>
@ -279,9 +280,6 @@
<if test="actualStartTime != null">
#{actualStartTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
#{actualEndTime,jdbcType=BIGINT},
</if>
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
@ -294,6 +292,9 @@
<if test="automaticStatusUpdate != null">
#{automaticStatusUpdate,jdbcType=BIT},
</if>
<if test="followPeople != null">
#{followPeople,jdbcType=VARCHAR},
</if>
<if test="tags != null">
#{tags,jdbcType=LONGVARCHAR},
</if>
@ -335,9 +336,6 @@
<if test="record.stage != null">
stage = #{record.stage,jdbcType=VARCHAR},
</if>
<if test="record.principal != null">
principal = #{record.principal,jdbcType=VARCHAR},
</if>
<if test="record.testCaseMatchRule != null">
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
</if>
@ -350,6 +348,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.actualEndTime != null">
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
</if>
<if test="record.plannedStartTime != null">
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
</if>
@ -359,9 +360,6 @@
<if test="record.actualStartTime != null">
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
</if>
<if test="record.actualEndTime != null">
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=VARCHAR},
</if>
@ -374,6 +372,9 @@
<if test="record.automaticStatusUpdate != null">
automatic_status_update = #{record.automaticStatusUpdate,jdbcType=BIT},
</if>
<if test="record.followPeople != null">
follow_people = #{record.followPeople,jdbcType=VARCHAR},
</if>
<if test="record.tags != null">
tags = #{record.tags,jdbcType=LONGVARCHAR},
</if>
@ -397,19 +398,19 @@
description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER},
automatic_status_update = #{record.automaticStatusUpdate,jdbcType=BIT},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=LONGVARCHAR},
report_summary = #{record.reportSummary,jdbcType=LONGVARCHAR},
report_config = #{record.reportConfig,jdbcType=LONGVARCHAR}
@ -426,19 +427,19 @@
description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER},
automatic_status_update = #{record.automaticStatusUpdate,jdbcType=BIT}
automatic_status_update = #{record.automaticStatusUpdate,jdbcType=BIT},
follow_people = #{record.followPeople,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -464,9 +465,6 @@
<if test="stage != null">
stage = #{stage,jdbcType=VARCHAR},
</if>
<if test="principal != null">
principal = #{principal,jdbcType=VARCHAR},
</if>
<if test="testCaseMatchRule != null">
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
</if>
@ -479,6 +477,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
</if>
<if test="plannedStartTime != null">
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
</if>
@ -488,9 +489,6 @@
<if test="actualStartTime != null">
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
@ -503,6 +501,9 @@
<if test="automaticStatusUpdate != null">
automatic_status_update = #{automaticStatusUpdate,jdbcType=BIT},
</if>
<if test="followPeople != null">
follow_people = #{followPeople,jdbcType=VARCHAR},
</if>
<if test="tags != null">
tags = #{tags,jdbcType=LONGVARCHAR},
</if>
@ -523,19 +524,19 @@
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},
automatic_status_update = #{automaticStatusUpdate,jdbcType=BIT},
follow_people = #{followPeople,jdbcType=VARCHAR},
tags = #{tags,jdbcType=LONGVARCHAR},
report_summary = #{reportSummary,jdbcType=LONGVARCHAR},
report_config = #{reportConfig,jdbcType=LONGVARCHAR}
@ -549,19 +550,19 @@
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},
automatic_status_update = #{automaticStatusUpdate,jdbcType=BIT}
automatic_status_update = #{automaticStatusUpdate,jdbcType=BIT},
follow_people = #{followPeople,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -11,7 +11,6 @@
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="language" jdbcType="VARCHAR" property="language" />
<result column="last_workspace_id" jdbcType="VARCHAR" property="lastWorkspaceId" />
<result column="last_organization_id" jdbcType="VARCHAR" property="lastOrganizationId" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="last_project_id" jdbcType="VARCHAR" property="lastProjectId" />
@ -80,7 +79,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id,
last_organization_id, phone, `source`, last_project_id, create_user
phone, `source`, last_project_id, create_user
</sql>
<sql id="Blob_Column_List">
platform_info
@ -137,15 +136,13 @@
insert into user (id, `name`, email,
`password`, `status`, create_time,
update_time, `language`, last_workspace_id,
last_organization_id, phone, `source`,
last_project_id, create_user, platform_info
)
phone, `source`, last_project_id,
create_user, platform_info)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastWorkspaceId,jdbcType=VARCHAR},
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
#{lastProjectId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{platformInfo,jdbcType=LONGVARCHAR}
)
#{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{lastProjectId,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{platformInfo,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
insert into user
@ -177,9 +174,6 @@
<if test="lastWorkspaceId != null">
last_workspace_id,
</if>
<if test="lastOrganizationId != null">
last_organization_id,
</if>
<if test="phone != null">
phone,
</if>
@ -224,9 +218,6 @@
<if test="lastWorkspaceId != null">
#{lastWorkspaceId,jdbcType=VARCHAR},
</if>
<if test="lastOrganizationId != null">
#{lastOrganizationId,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
@ -280,9 +271,6 @@
<if test="record.lastWorkspaceId != null">
last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR},
</if>
<if test="record.lastOrganizationId != null">
last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR},
</if>
<if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR},
</if>
@ -314,7 +302,6 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
`language` = #{record.language,jdbcType=VARCHAR},
last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR},
last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=VARCHAR},
last_project_id = #{record.lastProjectId,jdbcType=VARCHAR},
@ -335,7 +322,6 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
`language` = #{record.language,jdbcType=VARCHAR},
last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR},
last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=VARCHAR},
last_project_id = #{record.lastProjectId,jdbcType=VARCHAR},
@ -371,9 +357,6 @@
<if test="lastWorkspaceId != null">
last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR},
</if>
<if test="lastOrganizationId != null">
last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
@ -402,7 +385,6 @@
update_time = #{updateTime,jdbcType=BIGINT},
`language` = #{language,jdbcType=VARCHAR},
last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR},
last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
`source` = #{source,jdbcType=VARCHAR},
last_project_id = #{lastProjectId,jdbcType=VARCHAR},
@ -420,7 +402,6 @@
update_time = #{updateTime,jdbcType=BIGINT},
`language` = #{language,jdbcType=VARCHAR},
last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR},
last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
`source` = #{source,jdbcType=VARCHAR},
last_project_id = #{lastProjectId,jdbcType=VARCHAR},

View File

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

View File

@ -3,7 +3,6 @@
<mapper namespace="io.metersphere.base.mapper.WorkspaceMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.Workspace">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
@ -69,7 +68,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, organization_id, `name`, description, create_time, update_time, create_user
id, `name`, description, create_time, update_time, create_user
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.WorkspaceExample" resultMap="BaseResultMap">
select
@ -102,12 +101,12 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Workspace">
insert into workspace (id, organization_id, `name`,
description, create_time, update_time,
create_user)
values (#{id,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR})
insert into workspace (id, `name`, description,
create_time, update_time, create_user
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Workspace">
insert into workspace
@ -115,9 +114,6 @@
<if test="id != null">
id,
</if>
<if test="organizationId != null">
organization_id,
</if>
<if test="name != null">
`name`,
</if>
@ -138,9 +134,6 @@
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
#{organizationId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
@ -170,9 +163,6 @@
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
@ -196,7 +186,6 @@
<update id="updateByExample" parameterType="map">
update workspace
set id = #{record.id,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
@ -209,9 +198,6 @@
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.Workspace">
update workspace
<set>
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
@ -232,8 +218,7 @@
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Workspace">
update workspace
set organization_id = #{organizationId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
set `name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},

View File

@ -6,13 +6,14 @@ import io.metersphere.api.dto.definition.ApiDefinitionRequest;
import io.metersphere.api.dto.definition.ApiDefinitionResult;
import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO;
import io.metersphere.base.domain.ApiDefinition;
import io.metersphere.base.domain.ApiDefinitionExample;
import io.metersphere.base.domain.ApiDefinitionExampleWithOperation;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.dto.RelationshipGraphData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface ExtApiDefinitionMapper {
List<ApiSwaggerUrlDTO> selectScheduleList(@Param("projectId") String projectId);
@ -68,4 +69,6 @@ public interface ExtApiDefinitionMapper {
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
long countQuotedApiByProjectId(String projectId);
List<RelationshipGraphData.Node> getForGraph(@Param("ids") Set<String> ids);
}

View File

@ -238,7 +238,7 @@
api_definition.name,api_definition.protocol,api_definition.path,api_definition.module_id,api_definition.module_path,api_definition.method,
api_definition.description,api_definition.request,api_definition.response,api_definition.environment_id,
api_definition.status, api_definition.user_id, api_definition.create_time, api_definition.update_time, project.name as
project_name, user.name as user_name,deleteUser.name AS delete_user,api_definition.delete_time
project_name, user.name as user_name,deleteUser.name AS delete_user,api_definition.delete_time, api_definition.remark
from api_definition
left join project on api_definition.project_id = project.id
left join user on api_definition.user_id = user.id
@ -602,6 +602,12 @@
<if test="request.moduleId != null">
AND api_definition.module_id = #{request.moduleId}
</if>
<if test="request.notInIds != null and request.notInIds.size() > 0">
and api_definition.id not in
<foreach collection="request.notInIds" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</if>
<choose>
<when test="request.moduleIds != null and request.moduleIds.size() > 0">
AND api_definition.module_id in
@ -667,5 +673,14 @@
)
)
</select>
<select id="getForGraph" resultType="io.metersphere.dto.RelationshipGraphData$Node">
select id,num,`name`
from api_definition
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
and api_definition.status != 'Trash';
</select>
</mapper>

View File

@ -4,13 +4,15 @@ import io.metersphere.api.dto.automation.ApiScenarioDTO;
import io.metersphere.api.dto.automation.ApiScenarioRequest;
import io.metersphere.api.dto.datacount.ApiDataCountResult;
import io.metersphere.base.domain.ApiScenario;
import io.metersphere.base.domain.ApiScenarioExample;
import io.metersphere.base.domain.ApiScenarioExampleWithOperation;
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.dto.RelationshipGraphData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface ExtApiScenarioMapper {
List<ApiScenarioDTO> list(@Param("request") ApiScenarioRequest request);
@ -51,7 +53,7 @@ public interface ExtApiScenarioMapper {
ApiScenario getNextNum(@Param("projectId") String projectId);
List<String> selectIdsByQuery(@Param("request") ApiScenarioRequest request);
List<String> selectIdsByQuery(@Param("request") BaseQueryRequest request);
void updateCustomNumByProjectId(@Param("projectId") String projectId);
@ -67,7 +69,7 @@ public interface ExtApiScenarioMapper {
List<ApiScenarioWithBLOBs> selectByNoReferenceId();
void checkOriginalStatusByIds(@Param("ids")List<String> ids);
void checkOriginalStatusByIds(@Param("ids") List<String> ids);
List<String> selectIdsByExecuteTimeIsNull();
@ -77,7 +79,9 @@ public interface ExtApiScenarioMapper {
List<String> getIdsOrderByUpdateTime(@Param("projectId") String projectId);
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
Long getPreOrder(@Param("projectId") String projectId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("projectId") String projectId, @Param("baseOrder") Long baseOrder);
List<RelationshipGraphData.Node> getTestCaseForGraph(@Param("ids") Set<String> ids);
}

View File

@ -582,5 +582,13 @@
</if>
</where>
</sql>
<select id="getTestCaseForGraph" resultType="io.metersphere.dto.RelationshipGraphData$Node">
select id,num,custom_num,`name`
from api_scenario
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
and api_scenario.status != 'Trash';
</select>
</mapper>

View File

@ -242,7 +242,7 @@
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
select
t1.id, t1.project_id, t1.name, t1.api_definition_id, t1.priority, t1.description, t1.create_user_id, t1.update_user_id, t1.create_time, t1.update_time, t1.num,
t1.id, t1.project_id, t1.name,t1.case_status, t1.api_definition_id, t1.priority, t1.description, t1.create_user_id, t1.update_user_id, t1.create_time, t1.update_time, t1.num,
a.module_id, a.path, a.protocol, t1.tags,t1.status,t1.last_result_id as lastResultId,
t1.delete_time, deleteUser.name AS deleteUser,CONCAT(FORMAT(SUM(IF (t2.`status`='success',1,0))/COUNT(t2.id)*100,2),'%') passRate
from
@ -311,6 +311,12 @@
#{value}
</foreach>
</when>
<when test="key=='caseStatus' or key=='case_status'">
and t1.case_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
<if test="key=='status' and values.size == 0">

View File

@ -8,9 +8,9 @@
(select count(distinct ug.user_id) from user_group ug join user on ug.user_id = user.id where ug.group_id =
temp.id) as memberSize
from (
select g.*, o.name as scopeName from `group` g, organization o
select g.*, w.name as scopeName from `group` g, workspace w
<where>
and g.scope_id = o.id
and g.scope_id = w.id
<if test="request.types != null and request.types.size() > 0">
AND g.type in
<foreach collection="request.types" item="type" separator="," open="(" close=")">

View File

@ -89,10 +89,17 @@
#{value}
</foreach>
</when>
<when test="key == 'creator'">
AND issues.creator IN
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
</sql>

View File

@ -1,15 +0,0 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.dto.OrganizationMemberDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtOrganizationMapper {
int checkSourceRole(@Param("sourceId") String sourceId,@Param("userId") String userId,@Param("groupId") String groupId);
List<OrganizationMemberDTO> findIdAndNameByOrganizationId(@Param("organizationId")String organizationID);
void setDefaultMessageTask(@Param("orgId") String orgId);
}

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtOrganizationMapper">
<select id="checkSourceRole" resultType="Integer">
SELECT COUNT(id)
FROM user_group ug
WHERE ug.user_id = #{userId}
AND ug.source_id = #{sourceId}
AND ug.group_id = #{groupId}
</select>
<select id="findIdAndNameByOrganizationId" resultType="io.metersphere.dto.OrganizationMemberDTO">
SELECT id, name
FROM Organization
<where>
<if test="organizationId != 'All'">
AND id = #{organizationId}
</if>
</where>
</select>
<insert id="setDefaultMessageTask">
INSERT INTO message_task (id, type, event, user_id, task_type, webhook, identification, is_set, organization_id,
test_id, create_time, template)
VALUES (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'PERFORMANCE_TEST_TASK', '',
'ce692111-166b-491a-ae69-f047c31de971', 0,
#{orgId}, NULL, 1629686472659, NULL),
(UUID(), 'IN_SITE', 'COMPLETE', 'CREATOR', 'REVIEW_TASK',
'',
'72836b2d-4c2f-4185-95aa-1894c6f0d1c3', 0, #{orgId}, NULL, 1629697096803,
NULL),
(UUID(), 'IN_SITE', 'CLOSE_SCHEDULE', 'CREATOR', 'TRACK_HOME_TASK', '',
'ceb0aeb5-f194-4183-a995-3607a769c61d',
0, #{orgId}, NULL, 1629705930753, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_AUTOMATION_TASK', '',
'e2865464-0da3-42bc-a041-7d21bd70d339', 0,
#{orgId}, NULL, 1629446356866, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'PERFORMANCE_TEST_TASK', '',
'79d7dcdc-68a2-47a2-9ef5-21fdf9bde65c', 0, #{orgId}, NULL, 1629446379928,
NULL),
(UUID(), 'IN_SITE', 'CLOSE_SCHEDULE', 'CREATOR', 'API_HOME_TASK', '',
'dbe5dfcd-927f-4065-93cf-22f33d9570ac', 0,
#{orgId}, NULL, 1629446330438, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'TRACK_TEST_CASE_TASK', '',
'3a632784-c73b-4f5f-824c-bdf4fccf6f4d', 0, #{orgId}, NULL, 1629705939795,
NULL),
(UUID(), 'IN_SITE', 'CASE_UPDATE', 'FOLLOW_PEOPLE', 'API_DEFINITION_TASK', '',
'a6a3979a-bd80-414c-a253-06f0364c434f', 0, #{orgId}, NULL, 1629446346104,
NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'API_AUTOMATION_TASK', '',
'019de091-1a19-4b30-bd5e-23b83bc820fb',
0, #{orgId}, NULL, 1629618010742, NULL),
(UUID(), 'IN_SITE', 'CASE_UPDATE', 'CREATOR', 'API_DEFINITION_TASK', '',
'a6a3979a-bd80-414c-a253-06f0364c434f',
0, #{orgId}, NULL, 1629446346104, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'DEFECT_TASK', '', '66568b56-4f9e-4bf6-8621-7402403368b9', 0,
#{orgId}, NULL, 1629446306675, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'FOLLOW_PEOPLE', 'PERFORMANCE_TEST_TASK', '',
'ce692111-166b-491a-ae69-f047c31de971', 0, #{orgId}, NULL, 1629686472659,
NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'DEFECT_TASK', '', '3a913f72-7cee-4e36-ae1d-0443c7cb5f97', 0,
#{orgId}, NULL, 1629699608062, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'API_DEFINITION_TASK', '',
'7ca324cd-7113-412b-8714-5cbe1bffa535',
0, #{orgId}, NULL, 1629706088088, NULL),
(UUID(), 'IN_SITE', 'CASE_DELETE', 'CREATOR', 'API_DEFINITION_TASK', '',
'aeb9d21a-855c-44d3-a715-dfb1bba8ad6c',
0, #{orgId}, NULL, 1629446334332, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_REPORT_TASK', '', '4d3309f3-7ab2-492e-b9c9-1127c3e005d1',
0,
#{orgId}, NULL, 1629446364391, NULL),
(UUID(), 'IN_SITE', 'COMMENT', 'CREATOR', 'TRACK_TEST_CASE_TASK', '',
'2e8db54f-2d39-42a6-9832-43bb3384e7d5', 0,
#{orgId}, NULL, 1629446247833, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_DEFINITION_TASK', '',
'90f2be5d-0a71-44f0-a750-f16bf39d690b', 0,
#{orgId}, NULL, 1629446338557, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'PERFORMANCE_REPORT_TASK', '',
'4c1bfa4a-b02b-4e8e-bc09-b13613723a11',
0, #{orgId}, NULL, 1629446384995, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'API_AUTOMATION_TASK', '',
'019de091-1a19-4b30-bd5e-23b83bc820fb', 0,
#{orgId}, NULL, 1629618010742, NULL),
(UUID(), 'IN_SITE', 'COMPLETE', 'CREATOR', 'TEST_PLAN_TASK', '', '86b42beb-a86f-4ff3-a73c-d25112c2f104',
0,
#{orgId}, NULL, 1629446286106, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'PERFORMANCE_TEST_TASK', '',
'79d7dcdc-68a2-47a2-9ef5-21fdf9bde65c', 0,
#{orgId}, NULL, 1629446379928, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'TRACK_TEST_CASE_TASK', '',
'3a632784-c73b-4f5f-824c-bdf4fccf6f4d', 0,
#{orgId}, NULL, 1629705939795, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'API_DEFINITION_TASK', '',
'7ca324cd-7113-412b-8714-5cbe1bffa535', 0,
#{orgId}, NULL, 1629706088088, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TEST_PLAN_TASK', '', '04ea4fbd-a392-4f80-a61c-51d31a302cac', 0,
#{orgId}, NULL, 1629446289522, NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'REVIEW_TASK', '', 'db515209-f864-46d3-a2e5-63db6d1339c3', 0,
#{orgId}, NULL, 1629446276516, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TRACK_REPORT_TASK', '', 'ea2fee85-8a44-413a-a128-16bfa01ada0d',
0,
#{orgId}, NULL, 1629283758941, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'REVIEW_TASK', '', 'f9b1f60b-6dee-48af-8217-0428b27dcbab', 0,
#{orgId}, NULL, 1629446272477, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TRACK_TEST_CASE_TASK', '',
'7c26254e-85e9-4269-be13-a2ffcfe0b9f5', 0,
#{orgId}, NULL, 1629446251939, NULL),
(UUID(), 'IN_SITE', 'DELETE', 'FOLLOW_PEOPLE', 'TRACK_TEST_CASE_TASK', '',
'7c26254e-85e9-4269-be13-a2ffcfe0b9f5', 0, #{orgId}, NULL, 1629446251939,
NULL),
(UUID(), 'IN_SITE', 'EXECUTE_SUCCESSFUL', 'CREATOR', 'API_DEFINITION_TASK', '',
'7efddbdb-2b6c-4425-96a4-0bc2aa9e2cd2', 0, #{orgId}, NULL, 1629775183917,
NULL),
(UUID(), 'IN_SITE', 'EXECUTE_FAILED', 'CREATOR', 'API_DEFINITION_TASK', '',
'e508035c-1318-40ea-9457-0bbe9865f4ce', 0, #{orgId}, NULL, 1629775194857,
NULL),
(UUID(), 'IN_SITE', 'EXECUTE_COMPLETED', 'CREATOR', 'PERFORMANCE_TEST_TASK', '',
'e3db90c6-fb49-4e89-bc25-1d14b5ce94d0', 0, #{orgId}, NULL, 1629790602744,
NULL),
(UUID(), 'IN_SITE', 'EXECUTE_FAILED', 'CREATOR', 'API_AUTOMATION_TASK', '',
'c25930e8-b617-45f7-af5e-cc94adc14192', 0, #{orgId}, NULL, 1629780485724,
NULL),
(UUID(), 'IN_SITE', 'EXECUTE_SUCCESSFUL', 'CREATOR', 'API_AUTOMATION_TASK', '',
'9f91e5e5-1744-4160-bfc6-3851bfd59e05', 0, #{orgId}, NULL, 1629780475764,
NULL),
(UUID(), 'IN_SITE', 'UPDATE', 'PROCESSOR', 'DEFECT_TASK', '',
'6cad944e-db8d-4786-9ef3-7d6370940325', 0, #{orgId}, NULL, 1629791388405,
NULL),
(UUID(), 'IN_SITE', 'CREATE', 'PROCESSOR', 'DEFECT_TASK', '',
'4a890e41-e755-44fc-b734-d6a0ca25a65c', 0, #{orgId}, NULL, 1629790487682,
NULL)
</insert>
</mapper>

View File

@ -1,6 +1,5 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.Organization;
import io.metersphere.base.domain.Project;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.dto.ProjectDTO;
@ -16,7 +15,7 @@ public interface ExtProjectMapper {
List<String> getProjectIdByWorkspaceId(String workspaceId);
int removeIssuePlatform(@Param("platform") String platform, @Param("orgId") String orgId);
int removeIssuePlatform(@Param("platform") String platform, @Param("workspaceId") String workspaceId);
List<ProjectDTO> getUserProject(@Param("proRequest") ProjectRequest request);
@ -29,9 +28,9 @@ public interface ExtProjectMapper {
@MapKey("id")
Map<String, Project> queryNameByIds(@Param("ids") List<String> ids);
Organization getOrganizationByProjectId(@Param("projectId") String projectId);
List<Integer> selectTcpPorts();
Project selectProjectByResourceId(@Param("resourceId") String resourceId);
long getProjectMemberSize(@Param("projectId") String projectId);
}

View File

@ -172,20 +172,9 @@
</set>
WHERE project.id IN (SELECT id FROM (SELECT id
FROM project
WHERE workspace_id IN
(SELECT workspace.id
FROM workspace
WHERE organization_id = #{orgId})) AS a)
WHERE workspace_id = #{workspaceId}) AS a)
</update>
<select id="getOrganizationByProjectId" resultType="io.metersphere.base.domain.Organization">
SELECT organization.*
FROM organization
JOIN workspace ON organization.id = organization_id
JOIN project ON workspace.id = workspace_id
WHERE project.id = #{projectId, jdbcType=VARCHAR}
</select>
<select id="selectTcpPorts" resultType="java.lang.Integer">
SELECT mock_tcp_port
FROM project
@ -247,4 +236,9 @@
WHERE id = #{resourceId})
LIMIT 1
</select>
<select id="getProjectMemberSize" resultType="java.lang.Long">
SELECT count(distinct (`user`.id)) FROM user_group JOIN `user` ON user_group.user_id = `user`.id
WHERE user_group.source_id = #{projectId}
</select>
</mapper>

View File

@ -0,0 +1,10 @@
package io.metersphere.base.mapper.ext;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtRelationshipEdgeMapper {
List<String> getGraphIdsByNodeIds(@Param("ids") List<String> ids);
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtRelationshipEdgeMapper">
<select id="getGraphIdsByNodeIds" resultType="java.lang.String">
select distinct graph_id
from relationship_edge
where source_id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
or target_id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper>

View File

@ -1,11 +0,0 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.Role;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtRoleMapper {
List<Role> getRoleList(@Param("sign") String sign);
}

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtRoleMapper">
<select id="getRoleList" resultType="io.metersphere.base.domain.Role">
select * from role where id like CONCAT('%', #{sign},'%')
</select>
</mapper>

Some files were not shown because too many files have changed in this diff Show More