diff --git a/common/common-code/src/main/java/cn/fateverse/common/code/engine/JavaCodeEngine.java b/common/common-code/src/main/java/cn/fateverse/common/code/engine/JavaCodeEngine.java index 68a17af..180e34e 100644 --- a/common/common-code/src/main/java/cn/fateverse/common/code/engine/JavaCodeEngine.java +++ b/common/common-code/src/main/java/cn/fateverse/common/code/engine/JavaCodeEngine.java @@ -228,4 +228,24 @@ public class JavaCodeEngine { throw new RuntimeException(e); } } + + /** + * 删除类 + * @param className 删除类 + * @return 删除结果 + */ + public Boolean remove(String className) { + return SegmentLock.lock(className, () -> { + classCache.remove(className); + File javaFile = new File(CLASS_PATH + className + JAVA_SUFFIX); + if (javaFile.exists()) { + javaFile.delete(); + } + File classFile = new File(CLASS_PATH + className + CLASS_SUFFIX); + if (classFile.exists()) { + classFile.delete(); + } + return true; + }); + } } diff --git a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/constant/QueryConstant.java b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/constant/QueryConstant.java index 9f79392..8c07ad9 100644 --- a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/constant/QueryConstant.java +++ b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/constant/QueryConstant.java @@ -9,4 +9,6 @@ public class QueryConstant { public static final String PERMISSIONS_KEY = "custom:query:online:"; + public static final String PORTAL_KEY = "custom:query:portal:"; + } diff --git a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/DataAdapterController.java b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/DataAdapterController.java index 3d344bf..f0a9cfd 100644 --- a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/DataAdapterController.java +++ b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/DataAdapterController.java @@ -10,7 +10,6 @@ import cn.fateverse.query.entity.query.DataAdapterQuery; import cn.fateverse.query.entity.vo.DataAdapterVo; import cn.fateverse.query.service.DataAdapterService; import cn.fateverse.common.core.result.Result; -import cn.fateverse.common.core.entity.Option; import cn.fateverse.common.core.result.page.TableDataInfo; import cn.fateverse.common.core.utils.ObjectUtils; import cn.fateverse.common.log.annotation.Log; diff --git a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/PortalController.java b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/PortalController.java index 0021c4e..4c7f9c1 100644 --- a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/PortalController.java +++ b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/PortalController.java @@ -5,6 +5,7 @@ import cn.fateverse.common.core.result.page.TableDataInfo; import cn.fateverse.common.core.utils.ObjectUtils; import cn.fateverse.common.decrypt.annotation.Encrypt; import cn.fateverse.common.decrypt.annotation.EncryptField; +import cn.fateverse.query.entity.dto.PortalDto; import cn.fateverse.query.entity.query.PortalQuery; import cn.fateverse.query.entity.vo.PortalVo; import cn.fateverse.query.entity.vo.SimplePortalVo; @@ -12,10 +13,8 @@ import cn.fateverse.query.service.PortalService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; /** * 接口管理表(portal 传送门 接口作为入口 传送到其他类型) Controller @@ -56,5 +55,22 @@ public class PortalController { return Result.ok(dataInfo); } + @ApiOperation("新增接口") + @PostMapping + @PreAuthorize("@ss.hasPermission('query:portal:add')") + public Result add(@RequestBody @Validated PortalDto portalDto) { + portalService.save(portalDto); + return Result.ok(); + } + + @ApiOperation("修改接口") + @PutMapping + @PreAuthorize("@ss.hasPermission('query:portal:edit')") + public Result edit(@RequestBody @Validated PortalDto portalDto) { + ObjectUtils.checkPk(portalDto.getPortalId()); + portalService.edit(portalDto); + return Result.ok(); + } + } diff --git a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/QueryToolController.java b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/QueryToolController.java index 66ec017..9ab6258 100644 --- a/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/QueryToolController.java +++ b/custom-query/custom-query-biz/src/main/java/cn/fateverse/query/controller/QueryToolController.java @@ -1,17 +1,25 @@ package cn.fateverse.query.controller; +import cn.fateverse.common.core.entity.Option; +import cn.fateverse.common.core.result.Result; +import cn.fateverse.query.entity.vo.UniConVo; import cn.fateverse.query.service.QueryToolService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @author Clay * @date 2024/4/16 16:10 */ @Api(tags = "自定义查询工具接口管理") @RestController -@RequestMapping("/query/tool") +@RequestMapping("/tool") public class QueryToolController { @@ -22,9 +30,26 @@ public class QueryToolController { this.queryToolService = queryToolService; } + @ApiOperation("根据查询类型获取自定义查询") + @GetMapping("/option/{type}") + public Result> option(@PathVariable Integer type) { + if (type == null) { + return Result.error("查询类型不能为空"); + } + List