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/ApiFunctionController.java | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 100 insertions(+), 0 deletions(-)
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/platform/ApiFunctionController.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/platform/ApiFunctionController.java
new file mode 100644
index 0000000..56eb6d9
--- /dev/null
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/platform/ApiFunctionController.java
@@ -0,0 +1,100 @@
+package com.vincent.rsf.openApi.controller.platform;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.vincent.rsf.openApi.entity.app.ApiFunction;
+import com.vincent.rsf.openApi.entity.dto.CommonResponse;
+import com.vincent.rsf.openApi.service.ApiFunctionService;
+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;
+
+/**
+ * ApiFunction绠$悊Controller
+ *
+ * @author vincent
+ * @since 2026-01-04
+ */
+@RestController
+@RequestMapping("/api/function")
+@Api(tags = "鎺ュ彛鍔熻兘绠$悊")
+public class ApiFunctionController {
+
+ @Autowired
+ private ApiFunctionService apiFunctionService;
+
+ @ApiOperation("鍒嗛〉鏌ヨ鎺ュ彛鍔熻兘鍒楄〃")
+ @GetMapping("/page")
+ public CommonResponse page(@RequestParam(defaultValue = "1") Integer current,
+ @RequestParam(defaultValue = "10") Integer size) {
+ Page<ApiFunction> page = apiFunctionService.page(new Page<>(current, size));
+ return CommonResponse.ok().setData(page);
+ }
+
+ @ApiOperation("鏌ヨ鎵�鏈夋帴鍙e姛鑳�")
+ @GetMapping("/list")
+ public CommonResponse list() {
+ List<ApiFunction> list = apiFunctionService.list();
+ return CommonResponse.ok().setData(list);
+ }
+
+ @ApiOperation("鏍规嵁ID鏌ヨ鎺ュ彛鍔熻兘")
+ @GetMapping("/{id}")
+ public CommonResponse getById(@PathVariable String id) {
+ ApiFunction function = apiFunctionService.getById(id);
+ return CommonResponse.ok().setData(function);
+ }
+
+ @ApiOperation("鏂板鎺ュ彛鍔熻兘")
+ @PostMapping
+ public CommonResponse save(@RequestBody ApiFunction function) {
+ boolean result = apiFunctionService.save(function);
+ if (result) {
+ apiFunctionService.refreshCache();
+ return CommonResponse.ok().setMsg("鏂板鎴愬姛");
+ }
+ return CommonResponse.error("鏂板澶辫触");
+ }
+
+ @ApiOperation("鏇存柊鎺ュ彛鍔熻兘")
+ @PutMapping
+ public CommonResponse update(@RequestBody ApiFunction function) {
+ boolean result = apiFunctionService.updateById(function);
+ if (result) {
+ apiFunctionService.refreshCache();
+ return CommonResponse.ok().setMsg("鏇存柊鎴愬姛");
+ }
+ return CommonResponse.error("鏇存柊澶辫触");
+ }
+
+ @ApiOperation("鍒犻櫎鎺ュ彛鍔熻兘")
+ @DeleteMapping("/{id}")
+ public CommonResponse delete(@PathVariable String id) {
+ boolean result = apiFunctionService.removeById(id);
+ if (result) {
+ apiFunctionService.refreshCache();
+ return CommonResponse.ok().setMsg("鍒犻櫎鎴愬姛");
+ }
+ return CommonResponse.error("鍒犻櫎澶辫触");
+ }
+
+ @ApiOperation("鎵归噺鍒犻櫎鎺ュ彛鍔熻兘")
+ @DeleteMapping("/batch")
+ public CommonResponse deleteBatch(@RequestBody List<String> ids) {
+ boolean result = apiFunctionService.removeByIds(ids);
+ if (result) {
+ apiFunctionService.refreshCache();
+ return CommonResponse.ok().setMsg("鎵归噺鍒犻櫎鎴愬姛");
+ }
+ return CommonResponse.error("鎵归噺鍒犻櫎澶辫触");
+ }
+
+ @ApiOperation("鍒锋柊鍔熻兘缂撳瓨")
+ @PostMapping("/refresh")
+ public CommonResponse refresh() {
+ apiFunctionService.refreshCache();
+ return CommonResponse.ok().setMsg("缂撳瓨鍒锋柊鎴愬姛");
+ }
+}
--
Gitblit v1.9.1