From 69a3c374ca3afb770e3b9ffcbdda07ce362cbf58 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期五, 09 一月 2026 19:59:29 +0800
Subject: [PATCH] #
---
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/platform/ApiMapController.java | 138 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 138 insertions(+), 0 deletions(-)
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/platform/ApiMapController.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/platform/ApiMapController.java
new file mode 100644
index 0000000..137bbe7
--- /dev/null
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/platform/ApiMapController.java
@@ -0,0 +1,138 @@
+package com.vincent.rsf.openApi.controller.platform;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.vincent.rsf.openApi.entity.app.ApiMap;
+import com.vincent.rsf.openApi.entity.dto.CommonResponse;
+import com.vincent.rsf.openApi.service.ApiMapService;
+import com.vincent.rsf.openApi.utils.ParamsMapUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * ApiMap绠$悊Controller
+ *
+ * @author vincent
+ * @since 2026-01-04
+ */
+@RestController
+@RequestMapping("/api/map")
+@Api(tags = "瀛楁鏄犲皠绠$悊")
+public class ApiMapController {
+
+ @Autowired
+ private ApiMapService apiMapService;
+
+
+ @ApiOperation("鍒嗛〉鏌ヨ瀛楁鏄犲皠鍒楄〃")
+ @GetMapping("/page")
+ public CommonResponse page(@RequestParam(defaultValue = "1") Integer current,
+ @RequestParam(defaultValue = "10") Integer size,
+ @RequestParam(required = false) String appId,
+ @RequestParam(required = false) String funcId) {
+ LambdaQueryWrapper<ApiMap> wrapper = new LambdaQueryWrapper<>();
+ if (appId != null && !appId.isEmpty()) {
+ wrapper.eq(ApiMap::getAppId, appId);
+ }
+ if (funcId != null && !funcId.isEmpty()) {
+ wrapper.eq(ApiMap::getFuncId, funcId);
+ }
+ Page<ApiMap> page = apiMapService.page(new Page<>(current, size), wrapper);
+ return CommonResponse.ok().setData(page);
+ }
+
+ @ApiOperation("鏌ヨ鎵�鏈夊瓧娈垫槧灏�")
+ @GetMapping("/list")
+ public CommonResponse list(@RequestParam(required = false) String appId,
+ @RequestParam(required = false) String funcId) {
+ LambdaQueryWrapper<ApiMap> wrapper = new LambdaQueryWrapper<>();
+ if (appId != null && !appId.isEmpty()) {
+ wrapper.eq(ApiMap::getAppId, appId);
+ }
+ if (funcId != null && !funcId.isEmpty()) {
+ wrapper.eq(ApiMap::getFuncId, funcId);
+ }
+ List<ApiMap> list = apiMapService.list(wrapper);
+ return CommonResponse.ok().setData(list);
+ }
+
+ @ApiOperation("鏍规嵁ID鏌ヨ瀛楁鏄犲皠")
+ @GetMapping("/{id}")
+ public CommonResponse getById(@PathVariable Integer id) {
+ ApiMap map = apiMapService.getById(id);
+ return CommonResponse.ok().setData(map);
+ }
+
+ @ApiOperation("鏂板瀛楁鏄犲皠")
+ @PostMapping
+ public CommonResponse save(@RequestBody ApiMap map) {
+ boolean result = apiMapService.save(map);
+ if (result) {
+ apiMapService.refreshCache();
+ return CommonResponse.ok().setMsg("鏂板鎴愬姛");
+ }
+ return CommonResponse.error("鏂板澶辫触");
+ }
+
+ @ApiOperation("鎵归噺鏂板瀛楁鏄犲皠")
+ @PostMapping("/batch")
+ public CommonResponse saveBatch(@RequestBody List<ApiMap> maps) {
+ boolean result = apiMapService.saveBatch(maps);
+ if (result) {
+ apiMapService.refreshCache();
+ return CommonResponse.ok().setMsg("鎵归噺鏂板鎴愬姛");
+ }
+ return CommonResponse.error("鎵归噺鏂板澶辫触");
+ }
+
+ @ApiOperation("鏇存柊瀛楁鏄犲皠")
+ @PutMapping
+ public CommonResponse update(@RequestBody ApiMap map) {
+ boolean result = apiMapService.updateById(map);
+ if (result) {
+ apiMapService.refreshCache();
+ return CommonResponse.ok().setMsg("鏇存柊鎴愬姛");
+ }
+ return CommonResponse.error("鏇存柊澶辫触");
+ }
+
+ @ApiOperation("鍒犻櫎瀛楁鏄犲皠")
+ @DeleteMapping("/{id}")
+ public CommonResponse delete(@PathVariable Integer id) {
+ boolean result = apiMapService.removeById(id);
+ if (result) {
+ apiMapService.refreshCache();
+ return CommonResponse.ok().setMsg("鍒犻櫎鎴愬姛");
+ }
+ return CommonResponse.error("鍒犻櫎澶辫触");
+ }
+
+ @ApiOperation("鎵归噺鍒犻櫎瀛楁鏄犲皠")
+ @DeleteMapping("/batch")
+ public CommonResponse deleteBatch(@RequestBody List<Integer> ids) {
+ boolean result = apiMapService.removeByIds(ids);
+ if (result) {
+ apiMapService.refreshCache();
+ return CommonResponse.ok().setMsg("鎵归噺鍒犻櫎鎴愬姛");
+ }
+ return CommonResponse.error("鎵归噺鍒犻櫎澶辫触");
+ }
+
+ @ApiOperation("鍒锋柊鏄犲皠缂撳瓨")
+ @PostMapping("/refresh")
+ public CommonResponse refresh() {
+ apiMapService.refreshCache();
+ return CommonResponse.ok().setMsg("缂撳瓨鍒锋柊鎴愬姛");
+ }
+
+// @ApiOperation("鍒锋柊鎵�鏈夌紦瀛�")
+// @PostMapping("/refresh/all")
+// public CommonResponse refreshAll() {
+// new ParamsMapUtils().refreshAll();
+// return CommonResponse.ok().setMsg("鎵�鏈夌紦瀛樺埛鏂版垚鍔�");
+// }
+}
--
Gitblit v1.9.1