提交 cd4bbd2c authored 作者: mry's avatar mry

perf(web): 部分代码优化

上级 ba8f9072
......@@ -2,7 +2,6 @@ package org.matrix.autotest.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.matrix.autotest.entity.Action;
import org.matrix.autotest.entity.Move;
import java.util.List;
......
......@@ -50,7 +50,7 @@ public class SwaggerController {
@GetMapping
public Object parameter(String url) {
@SuppressWarnings("all")
@SuppressWarnings(value = "all")
List<String> list = new ArrayList();
//获得json字符串
String json = loadJson(url);
......@@ -61,7 +61,7 @@ public class SwaggerController {
Object basePath = swaggerJson.get("basePath");
Object paths = swaggerJson.get("paths");
//将paths转成map集合
@SuppressWarnings("unchecked")
@SuppressWarnings(value = "unchecked")
Map<String, String> pathsMaps = (Map<String, String>) paths;
//获取key
Set<String> methodUrls = pathsMaps.keySet();
......@@ -72,21 +72,21 @@ public class SwaggerController {
//通过JSON获取到methodUrl,用来获取methodUrl内部的信息
Object objMethodUrls = objPaths.get(methodUrl);
JSONObject objUrlsJson = (JSONObject) objMethodUrls;
@SuppressWarnings("unchecked")
@SuppressWarnings(value = "unchecked")
Map<String, String> objMethodUrlsMaps = (Map<String, String>) objMethodUrls;
Set<String> requests = objMethodUrlsMaps.keySet();
for (String request : requests) {
//拿到请求内部的信息
Object objRequest = objUrlsJson.get(request);
@SuppressWarnings("unchecked")
@SuppressWarnings(value = "unchecked")
Map<String, String> objRequestMaps = (Map<String, String>) objRequest;
Object parameters = objRequestMaps.get("parameters");
List<String> parameterAllList = new ArrayList<>();
if (parameters != null) {
@SuppressWarnings("all")
@SuppressWarnings(value = "all")
List<String> parameterLists = (List<String>) parameters;
for (Object parameterList : parameterLists) {
@SuppressWarnings("unchecked")
@SuppressWarnings(value = "unchecked")
Map<String, String> parameterMaps = (Map<String, String>) parameterList;
String name = parameterMaps.get("name");
String type = parameterMaps.get("type");
......
......@@ -30,6 +30,7 @@ public class CommonResult<T> {
/**
* 成功返回结果
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> success() {
return new CommonResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), null);
}
......@@ -37,6 +38,7 @@ public class CommonResult<T> {
/**
* 失败返回结果
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> failed() {
return new CommonResult<>(ResultCode.FAILED.getCode(), ResultCode.FAILED.getMessage(), null);
}
......@@ -46,6 +48,7 @@ public class CommonResult<T> {
*
* @param message 提示信息
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> success(String message) {
return new CommonResult<>(ResultCode.SUCCESS.getCode(), message, null);
}
......@@ -55,6 +58,7 @@ public class CommonResult<T> {
*
* @param message 提示信息
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> failed(String message) {
return new CommonResult<>(ResultCode.FAILED.getCode(), message, null);
}
......@@ -64,6 +68,7 @@ public class CommonResult<T> {
*
* @param data 获取的数据
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> success(T data) {
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
}
......@@ -73,6 +78,7 @@ public class CommonResult<T> {
*
* @param data 获取的数据
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> failed(T data) {
return new CommonResult<T>(ResultCode.FAILED.getCode(), ResultCode.FAILED.getMessage(), data);
}
......@@ -83,6 +89,7 @@ public class CommonResult<T> {
* @param data 获取的数据
* @param message 提示信息
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> success(T data, String message) {
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), message, data);
}
......@@ -93,6 +100,7 @@ public class CommonResult<T> {
* @param data 获取的数据
* @param message 提示信息
*/
@SuppressWarnings(value = "all")
public static <T> CommonResult<T> failed(T data, String message) {
return new CommonResult<T>(ResultCode.FAILED.getCode(), message, data);
}
......
......@@ -3,5 +3,5 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/keystone?useSSL=false&verifyServerCertificate=false&useUnicode=true&autoReconnect=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=root
mybatis-plus.type-aliases-package=com.example.testwebdemo.entity
mybatis-plus.type-aliases-package=org.matrix.autotest.entity
mybatis-plus.configuration.map-underscore-to-camel-case=true
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论