bug修复

This commit is contained in:
guo 2023-08-08 18:20:42 +08:00
parent 8c6e852c4c
commit c3f6cd2ba1
3 changed files with 27 additions and 23 deletions

View File

@ -28,11 +28,24 @@ public class SwaggerConfig {
// 定义分隔符
private static final String splitor = ";";
@Bean
public Docket createZwRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("政务接口")
.apiInfo(apiInfo("政务管理API", "政务前后端联调api文档", "1.0"))
.select()
//.apis(RequestHandlerSelectors.basePackage("com.zhgd.xmgl"))
.apis(basePackage("com.zhwl.zw"))
.paths(PathSelectors.any())
//.paths(PathSelectors.regex("/zw.*"))
.build();
}
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("项目接口")
.apiInfo(apiInfo("项目管理API","项目前后端联调api文档","1.0"))
.apiInfo(apiInfo("项目管理API", "项目前后端联调api文档", "1.0"))
.select()
//.apis(RequestHandlerSelectors.basePackage("com.zhgd.xmgl"))
.apis(basePackage("com.zhgd.xmgl"))
@ -43,20 +56,7 @@ public class SwaggerConfig {
.build();
}
@Bean
public Docket createZwRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("政务接口")
.apiInfo(apiInfo("政务管理API","政务前后端联调api文档","1.0"))
.select()
//.apis(RequestHandlerSelectors.basePackage("com.zhgd.xmgl"))
.apis(basePackage("com.zhwl.zw"))
.paths(PathSelectors.any())
//.paths(PathSelectors.regex("/zw.*"))
.build();
}
private ApiInfo apiInfo(String titleName,String description,String version) {
private ApiInfo apiInfo(String titleName, String description, String version) {
return new ApiInfoBuilder()
.title(titleName)
.description(description)
@ -67,7 +67,8 @@ public class SwaggerConfig {
public static Predicate<RequestHandler> basePackage(final String basePackage) {
return input -> declaringClass(input).transform(handlerPackage(basePackage)).or(true);
}
private static Function<Class<?>, Boolean> handlerPackage(final String basePackage) {
private static Function<Class<?>, Boolean> handlerPackage(final String basePackage) {
return input -> {
// 循环判断匹配
for (String strPackage : basePackage.split(splitor)) {
@ -79,6 +80,7 @@ public class SwaggerConfig {
return false;
};
}
private static Optional<? extends Class<?>> declaringClass(RequestHandler input) {
return Optional.fromNullable(input.declaringClass());
}

View File

@ -16,6 +16,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -33,6 +35,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -137,14 +140,13 @@ public class PoisonousGasDevCurrentDataController {
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value = "删除有毒气体-数据信息", notes = "删除有毒气体-数据信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "有毒气体-数据ID", paramType = "body", required = true, dataType = "String")
@PostMapping(value = "/delete")
public Result<PoisonousGasDevCurrentData> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
public Result<PoisonousGasDevCurrentData> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
String id = MapUtils.getString(map, "id");
Result<PoisonousGasDevCurrentData> result = new Result<PoisonousGasDevCurrentData>();
PoisonousGasDevCurrentData poisonousGasDevCurrentData = poisonousGasDevCurrentDataService.getById(id);
if (poisonousGasDevCurrentData == null) {

View File

@ -121,10 +121,10 @@ public class ${entityName}Controller {
* @return
*/
@ApiOperation(value = "删除${tableVo.ftlDescription}信息", notes = "删除${tableVo.ftlDescription}信息" , httpMethod="POST")
@ApiImplicitParam(name = "id", value = "${tableVo.ftlDescription}ID", paramType = "body", required = true, dataType = "String")
@PostMapping(value = "/delete")
public Result<${entityName}> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
public Result<${entityName}> delete(@ApiIgnore @RequestBody HashMap<String ,Object> map) {
String id = MapUtils.getString(map, "id");
Result<${entityName}> result = new Result<${entityName}>();
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
if(${entityName?uncap_first}==null) {