Переглянути джерело

store、admin 模块接口改用具体 HTTP 方法注解

- store 148 个、admin 21 个接口的 @RequestMapping(method={GET,POST}/POST) 改为 @GetMapping/@PostMapping
- HTTP 方法取自商家后台 F:/shop/yoshop2.0-store/src/api 的 axios method,
  与平台后台 F:/shop/yoshop2.0-admin/src/api/api.config.js 里各调用的 method
- 前端不调用的两个 initialize 空实现(/store/controller/initialize、/store/statistics.data/initialize)
  按浏览器访问方式只保留 GET,并在注释中说明
- 保留 setApis/set_apis 等下划线与驼峰双路径别名
- 新增 tools/migrate_store_admin_mapping.py,tidy_api_mapping_annotations.py 扩展到三个模块
- 回归:admin 45 项、store 登录态 20 项、商家驼峰冒烟、api 54 项 + uniapp 契约 9 项全通过
tanlie 1 тиждень тому
батько
коміт
2871f1d513
51 змінених файлів з 434 додано та 227 видалено
  1. 164 0
      tools/migrate_store_admin_mapping.py
  2. 18 9
      tools/tidy_api_mapping_annotations.py
  3. 2 2
      yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminCacheController.java
  4. 2 2
      yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminScienceController.java
  5. 6 5
      yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminStoreApiController.java
  6. 8 7
      yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminStoreController.java
  7. 8 7
      yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminStoreMenuController.java
  8. 2 2
      yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminTimerController.java
  9. 4 3
      yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminUserController.java
  10. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/CategoryController.java
  11. 4 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/ClientH5SettingController.java
  12. 4 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/ClientWxappSettingController.java
  13. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/ContentArticleCategoryController.java
  14. 7 6
      yoshop-java/src/main/java/cn/yoshop/store/controller/ContentArticleController.java
  15. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/ContentHelpController.java
  16. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/FilesController.java
  17. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/FilesGroupController.java
  18. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsCommentController.java
  19. 10 9
      yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsController.java
  20. 7 6
      yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsServiceController.java
  21. 2 2
      yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsSpecController.java
  22. 2 2
      yoshop-java/src/main/java/cn/yoshop/store/controller/HomeController.java
  23. 8 7
      yoshop-java/src/main/java/cn/yoshop/store/controller/MarketCouponController.java
  24. 2 2
      yoshop-java/src/main/java/cn/yoshop/store/controller/MarketPointsController.java
  25. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/MarketRechargePlanController.java
  26. 3 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/OrderController.java
  27. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/OrderDeliveryController.java
  28. 7 7
      yoshop-java/src/main/java/cn/yoshop/store/controller/OrderEventController.java
  29. 3 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/OrderExportController.java
  30. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/OrderRefundController.java
  31. 9 8
      yoshop-java/src/main/java/cn/yoshop/store/controller/PageController.java
  32. 3 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/RegionController.java
  33. 4 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/SettingCacheController.java
  34. 4 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/SettingController.java
  35. 8 7
      yoshop-java/src/main/java/cn/yoshop/store/controller/SettingDeliveryController.java
  36. 7 6
      yoshop-java/src/main/java/cn/yoshop/store/controller/SettingExpressController.java
  37. 4 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/SettingPaymentController.java
  38. 8 7
      yoshop-java/src/main/java/cn/yoshop/store/controller/SettingPaymentTemplateController.java
  39. 7 6
      yoshop-java/src/main/java/cn/yoshop/store/controller/SettingPrinterController.java
  40. 5 4
      yoshop-java/src/main/java/cn/yoshop/store/controller/StatisticsController.java
  41. 7 6
      yoshop-java/src/main/java/cn/yoshop/store/controller/StoreAddressController.java
  42. 3 2
      yoshop-java/src/main/java/cn/yoshop/store/controller/StoreBaseController.java
  43. 4 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/StoreController.java
  44. 2 2
      yoshop-java/src/main/java/cn/yoshop/store/controller/StoreMenuController.java
  45. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/StoreRoleController.java
  46. 6 6
      yoshop-java/src/main/java/cn/yoshop/store/controller/StoreUserController.java
  47. 3 3
      yoshop-java/src/main/java/cn/yoshop/store/controller/UploadController.java
  48. 2 2
      yoshop-java/src/main/java/cn/yoshop/store/controller/UserBalanceController.java
  49. 6 5
      yoshop-java/src/main/java/cn/yoshop/store/controller/UserController.java
  50. 7 6
      yoshop-java/src/main/java/cn/yoshop/store/controller/UserGradeController.java
  51. 2 2
      yoshop-java/src/main/java/cn/yoshop/store/controller/UserRechargeController.java

+ 164 - 0
tools/migrate_store_admin_mapping.py

@@ -0,0 +1,164 @@
+# -*- coding: utf-8 -*-
+"""把 store / admin 模块控制器的 @RequestMapping(method={GET,POST}) 改成 @GetMapping / @PostMapping。
+
+HTTP 方法依据两个后台前端仓库的实际 axios 调用:
+  store: F:/shop/yoshop2.0-store/src/api/**/*.js
+  admin: F:/shop/yoshop2.0-admin/src/api/api.config.js + 各调用文件(接口少,显式列表)
+用法:python migrate_store_admin_mapping.py [--apply]
+"""
+import re
+import sys
+from pathlib import Path
+
+sys.path.insert(0, str(Path(__file__).parent))
+from _root import ROOT  # noqa: E402
+
+JAVA = ROOT / "yoshop-java/src/main/java/cn/yoshop"
+STORE_API = Path(r"F:/shop/yoshop2.0-store/src/api")
+
+APPLY = "--apply" in sys.argv
+
+# admin 前端接口 -> 方法(api.config.js 里的 key 与调用处 method 对应)
+ADMIN_METHODS = {
+    "/admin/passport/login": "Post",
+    "/admin/passport/logout": "Post",
+    "/admin/admin.user/detail": "Get",
+    "/admin/admin.user/renew": "Post",
+    "/admin/store/index": "Get",
+    "/admin/store/superLogin": "Get",
+    "/admin/store/recycle": "Get",
+    "/admin/store/add": "Post",
+    "/admin/store/edit": "Post",
+    "/admin/store/recovery": "Post",
+    "/admin/store/delete": "Post",
+    "/admin/store/move": "Post",
+    "/admin/store.api/index": "Get",
+    "/admin/store.api/add": "Post",
+    "/admin/store.api/edit": "Post",
+    "/admin/store.api/delete": "Post",
+    "/admin/store.menu/index": "Get",
+    "/admin/store.menu/info": "Get",
+    "/admin/store.menu/add": "Post",
+    "/admin/store.menu/edit": "Post",
+    "/admin/store.menu/setApis": "Post",
+    "/admin/store.menu/delete": "Post",
+    "/admin/setting.cache/clear": "Post",
+    "/admin/setting.science/info": "Get",
+    "/admin/setting.queue/test": "Post",
+    "/admin/setting.timer/test": "Post",
+}
+
+MAP_RE = re.compile(r"(\w+)\s*:\s*'([^']+)'")
+CALL_RE = re.compile(r"axios\(\{(.*?)\}\)", re.S)
+URL_RE = re.compile(r"url:\s*([A-Za-z0-9_.]+|'[^']*')")
+METHOD_RE = re.compile(r"method:\s*'(\w+)'")
+
+
+def parse_store_front():
+    table = {}
+    for f in sorted(STORE_API.rglob("*.js")):
+        text = f.read_text(encoding="utf-8", errors="ignore")
+        const = re.search(r"const\s+api\s*=\s*\{(.*?)\n\}", text, re.S)
+        local = dict(MAP_RE.findall(const.group(1))) if const else {}
+        for block in CALL_RE.findall(text):
+            um, mm = URL_RE.search(block), METHOD_RE.search(block)
+            if not um or not mm:
+                continue
+            url = um.group(1).strip("'")
+            if not url.startswith("/"):
+                parts = [p for p in url.split(".") if p != "api"]
+                if parts[-1] not in local:
+                    print(f"!! 跳过无法解析的 url: {url} ({f.name})")
+                    continue
+                url = local[parts[-1]]
+            table["/store" + url] = mm.group(1).capitalize()
+    return table
+
+
+ANN_RE = re.compile(r"@RequestMapping\((.*?)\)", re.S)
+VALUE_RE = re.compile(r'value\s*=\s*(\{[^}]*\}|"[^"]*")')
+METHOD_ATTR_RE = re.compile(r'method\s*=\s*(RequestMethod\.\w+|\{[^}]*\})')
+PRODUCES_RE = re.compile(r'produces\s*=\s*("[^"]*"|[A-Za-z0-9_.]+)')
+
+
+def norm_path(p):
+    if "_" in p:
+        head, *rest = p.split("_")
+        return head + "".join(w[:1].upper() + w[1:] for w in rest)
+    return p
+
+
+def migrate(module: str, methods: dict):
+    ctrl = JAVA / module / "controller"
+    total = 0
+    for f in sorted(ctrl.glob("*.java")):
+        src = f.read_text(encoding="utf-8")
+        cls = re.search(r'^@RequestMapping\("([^"]+)"\)', src, re.M)
+        prefix = cls.group(1) if cls else ""
+        missed = []
+
+        def repl(m):
+            nonlocal total
+            body = m.group(1)
+            vm = VALUE_RE.search(body)
+            if not vm:
+                return m.group(0)
+            value_expr = vm.group(1)
+            paths = re.findall(r'"([^"]*)"', value_expr)
+            full = prefix + paths[0]
+            key = norm_path(full)
+            if key not in methods:
+                missed.append(full)
+                return m.group(0)
+            ann = methods[key]
+            parts = [f"value = {value_expr}"]
+            pm = PRODUCES_RE.search(body)
+            if pm:
+                parts.append(f"produces = {pm.group(1)}")
+            total += 1
+            return f"@{ann}Mapping({', '.join(parts)})"
+
+        new_src = ANN_RE.sub(repl, src)
+        if missed:
+            print(f"  !! {module}/{f.name} 前端未找到: {missed}")
+        if new_src == src:
+            continue
+        if "RequestMethod." not in new_src:
+            new_src = new_src.replace(
+                "import org.springframework.web.bind.annotation.RequestMethod;\n", "")
+        for name in ("GetMapping", "PostMapping"):
+            imp = f"import org.springframework.web.bind.annotation.{name};"
+            if f"@{name}(" in new_src and imp not in new_src:
+                new_src = new_src.replace(
+                    "import org.springframework.web.bind.annotation.RequestMapping;",
+                    imp + "\nimport org.springframework.web.bind.annotation.RequestMapping;", 1)
+        # 组内排序,tools.jackson / com.baomidou 保持原有靠前位置
+        lines = new_src.split("\n")
+        out, i = [], 0
+        while i < len(lines):
+            if lines[i].startswith("import "):
+                j = i
+                while j < len(lines) and lines[j].startswith("import "):
+                    j += 1
+                grp = lines[i:j]
+                head = [x for x in grp if x.startswith(("import com.baomidou.", "import tools.jackson."))]
+                rest = sorted(x for x in grp if x not in head)
+                out.extend(sorted(head) + rest)
+                i = j
+            else:
+                out.append(lines[i])
+                i += 1
+        new_src = "\n".join(out)
+        if APPLY:
+            f.write_text(new_src, encoding="utf-8")
+    return total
+
+
+store_methods = parse_store_front()
+# 前端不调用的 PHP 生命周期钩子(无副作用、无请求体):按浏览器/探活方式用 GET
+store_methods["/store/controller/initialize"] = "Get"
+store_methods["/store/statistics.data/initialize"] = "Get"
+print("store 前端接口数:", len(store_methods))
+n1 = migrate("store", store_methods)
+n2 = migrate("admin", ADMIN_METHODS)
+print(f"{'已改写' if APPLY else '待改写'} store={n1} admin={n2}")

+ 18 - 9
tools/tidy_api_mapping_annotations.py

@@ -1,4 +1,8 @@
-"""收尾:去掉 @GetMapping/@PostMapping 里多余的 value =,并按字母重排 import。"""
+"""收尾:去掉 @GetMapping/@PostMapping 里多余的 value =,并按字母重排 import。
+
+覆盖三个模块:api / store / admin。import 分组里 com.baomidou.*、tools.jackson.*
+保持原有靠前位置,其余按字母排序。
+"""
 import re
 import sys
 from pathlib import Path
@@ -6,7 +10,7 @@ from pathlib import Path
 sys.path.insert(0, str(Path(__file__).parent))
 from _root import ROOT  # noqa: E402
 
-CTRL_DIR = ROOT / "yoshop-java" / "src/main/java/cn/yoshop/api/controller"
+MODULES = ("api", "store", "admin")
 
 
 def clean(text: str) -> str:
@@ -19,7 +23,10 @@ def clean(text: str) -> str:
             j = i
             while j < len(lines) and lines[j].startswith("import "):
                 j += 1
-            out.extend(sorted(lines[i:j]))
+            grp = lines[i:j]
+            head = [x for x in grp if x.startswith(("import com.baomidou.", "import tools.jackson."))]
+            rest = sorted(x for x in grp if x not in head)
+            out.extend(sorted(head) + rest)
             i = j
         else:
             out.append(lines[i])
@@ -28,10 +35,12 @@ def clean(text: str) -> str:
 
 
 n = 0
-for f in sorted(CTRL_DIR.glob("*.java")):
-    src = f.read_text(encoding="utf-8")
-    new = clean(src)
-    if new != src:
-        f.write_text(new, encoding="utf-8")
-        n += 1
+for mod in MODULES:
+    ctrl = ROOT / "yoshop-java" / f"src/main/java/cn/yoshop/{mod}/controller"
+    for f in sorted(ctrl.glob("*.java")):
+        src = f.read_text(encoding="utf-8")
+        new = clean(src)
+        if new != src:
+            f.write_text(new, encoding="utf-8")
+            n += 1
 print("整理文件数:", n)

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminCacheController.java

@@ -3,9 +3,9 @@ package cn.yoshop.admin.controller;
 import cn.yoshop.admin.service.AdminCacheService;
 import cn.yoshop.common.api.R;
 import cn.yoshop.common.util.Params;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -24,7 +24,7 @@ public class AdminCacheController {
         this.adminCacheService = adminCacheService;
     }
 
-    @RequestMapping(value = "/clear", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/clear")
     public R<Void> clear(@RequestBody(required = false) Map<String, Object> body) {
         Map<String, Object> form = Params.form(body);
         adminCacheService.clear(form);

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminScienceController.java

@@ -3,8 +3,8 @@ package cn.yoshop.admin.controller;
 import cn.yoshop.admin.service.AdminScienceService;
 import cn.yoshop.common.api.R;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -19,7 +19,7 @@ public class AdminScienceController {
 
     private final AdminScienceService adminScienceService;
 
-    @RequestMapping(value = "/info", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/info")
     public R<Map<String, Object>> info() {
         return R.ok(adminScienceService.info());
     }

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminStoreApiController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.exception.BizException;
 import cn.yoshop.common.util.Params;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -26,24 +27,24 @@ public class AdminStoreApiController {
     private final AdminApiService adminApiService;
 
     /** 权限树(parentId 组树,子节点为 children) */
-    @RequestMapping(value = "/index", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/index")
     public R<Map<String, List<StoreApi>>> index() {
         return R.ok(Map.of("list", adminApiService.getTree()));
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminApiService.add(Params.form(body));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminApiService.edit(requireApiId(body, request), Params.form(body));
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminApiService.remove(requireApiId(body, request));
         return R.okMsg("删除成功");

+ 8 - 7
yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminStoreController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.page.PageVO;
 import cn.yoshop.common.util.Params;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -27,7 +28,7 @@ public class AdminStoreController {
     private final AdminStoreService adminStoreService;
 
     /** 商城列表(每页 15,带 superUser) */
-    @RequestMapping(value = "/index", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/index")
     public R<Map<String, PageVO<Map<String, Object>>>> index(
             @RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         PageVO<Map<String, Object>> list = adminStoreService.getList(Params.merge(body, request), false);
@@ -35,14 +36,14 @@ public class AdminStoreController {
     }
 
     /** 新增商城:免费版固定拒绝 */
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add() {
         adminStoreService.add();
         return R.okMsg("添加成功");
     }
 
     /** 回收站列表 */
-    @RequestMapping(value = "/recycle", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/recycle")
     public R<Map<String, PageVO<Map<String, Object>>>> recycle(
             @RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         PageVO<Map<String, Object>> list = adminStoreService.getList(Params.merge(body, request), true);
@@ -50,21 +51,21 @@ public class AdminStoreController {
     }
 
     /** 移入回收站 */
-    @RequestMapping(value = "/recovery", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/recovery")
     public R<Void> recovery(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminStoreService.recycle(requireStoreId(body, request), true);
         return R.okMsg("操作成功");
     }
 
     /** 修改商家账户(商城备注/排序 + 超级管理员账号密码) */
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminStoreService.edit(requireStoreId(body, request), Params.form(body));
         return R.okMsg("操作成功");
     }
 
     /** 移出回收站 */
-    @RequestMapping(value = "/move", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/move")
     public R<Void> move(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminStoreService.recycle(requireStoreId(body, request), false);
         return R.okMsg("操作成功");

+ 8 - 7
yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminStoreMenuController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.exception.BizException;
 import cn.yoshop.common.util.Params;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.LinkedHashMap;
@@ -28,13 +29,13 @@ public class AdminStoreMenuController {
     private final AdminMenuService adminMenuService;
 
     /** 菜单树(含 apiIds) */
-    @RequestMapping(value = "/index", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/index")
     public R<Map<String, List<AdminMenu>>> index() {
         return R.ok(Map.of("list", adminMenuService.getTree()));
     }
 
     /** 菜单详情 */
-    @RequestMapping(value = "/info", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/info")
     public R<Map<String, Object>> info(@RequestBody(required = false) Map<String, Object> body,
                                        HttpServletRequest request) {
         Map<String, Object> data = new LinkedHashMap<>();
@@ -42,20 +43,20 @@ public class AdminStoreMenuController {
         return R.ok(data);
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body) {
         adminMenuService.add(Params.form(body));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminMenuService.edit(requireMenuId(body, request), Params.form(body));
         return R.okMsg("更新成功");
     }
 
     /** 设置菜单绑定的 API 权限 */
-    @RequestMapping(value = {"/setApis", "/set_apis"}, method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping({"/setApis", "/set_apis"})
     public R<Void> setApis(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> params = Params.merge(body, request);
         int menuId = requireMenuId(body, request);
@@ -64,7 +65,7 @@ public class AdminStoreMenuController {
         return R.okMsg("操作成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminMenuService.remove(requireMenuId(body, request));
         return R.okMsg("删除成功");

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminTimerController.java

@@ -3,8 +3,8 @@ package cn.yoshop.admin.controller;
 import cn.yoshop.admin.service.AdminTimerService;
 import cn.yoshop.common.api.R;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -18,7 +18,7 @@ public class AdminTimerController {
 
     private final AdminTimerService adminTimerService;
 
-    @RequestMapping(value = "/test", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/test")
     public R<Void> test() {
         return R.okMsg(adminTimerService.test());
     }

+ 4 - 3
yoshop-java/src/main/java/cn/yoshop/admin/controller/AdminUserController.java

@@ -6,9 +6,10 @@ import cn.yoshop.common.entity.AdminUser;
 import cn.yoshop.common.util.Params;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.LinkedHashMap;
@@ -25,7 +26,7 @@ public class AdminUserController {
     private final AdminUserService adminUserService;
 
     /** 当前登录管理员信息(取自 Redis 登录态,不回查数据库) */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(HttpServletRequest request) {
         AdminUser user = adminUserService.getLoginUser(request.getHeader("Access-Token"));
         Map<String, Object> data = new LinkedHashMap<>();
@@ -34,7 +35,7 @@ public class AdminUserController {
     }
 
     /** 修改账号/密码,并刷新登录态缓存 */
-    @RequestMapping(value = "/renew", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/renew")
     public R<Void> renew(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         adminUserService.renew(request.getHeader("Access-Token"), Params.form(body));
         return R.okMsg("更新成功");

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/CategoryController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.CategoryService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -27,19 +28,19 @@ public class CategoryController {
     private final CategoryService categoryService;
 
     /** 分类树状列表 */
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, List<Category>>> list(@RequestParam(required = false) Map<String, Object> params) {
         int status = Params.intVal(params == null ? Map.of() : params, "status", -1);
         return R.ok(Map.of("list", categoryService.getList(status)));
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         categoryService.add(Params.merge(body, request), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> data = Params.merge(body, request);
         Integer categoryId = Params.intOrNull(data, "categoryId");
@@ -53,7 +54,7 @@ public class CategoryController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> data = Params.merge(body, request);
         Integer categoryId = Params.intOrNull(data, "categoryId");

+ 4 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/ClientH5SettingController.java

@@ -6,9 +6,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.ClientSettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -25,7 +26,7 @@ public class ClientH5SettingController {
     private final ClientSettingService clientSettingService;
 
     /** 获取 H5 设置(指定 key) */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestParam(required = false) Map<String, Object> params,
                                          HttpServletRequest request) {
         String key = Params.strOrNull(params == null ? Map.of() : params, "key");
@@ -37,7 +38,7 @@ public class ClientH5SettingController {
     }
 
     /** 更新 H5 设置项 */
-    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @PostMapping("/update")
     public R<Void> update(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         String key = Params.strOrNull(all, "key");

+ 4 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/ClientWxappSettingController.java

@@ -5,9 +5,10 @@ import cn.yoshop.common.util.Params;
 import cn.yoshop.store.service.ClientSettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -27,7 +28,7 @@ public class ClientWxappSettingController {
     private final ClientSettingService clientSettingService;
 
     /** 获取小程序设置(指定 key) */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestParam(required = false) Map<String, Object> params,
                                          HttpServletRequest request) {
         String key = Params.strOrNull(params == null ? Map.of() : params, "key");
@@ -42,7 +43,7 @@ public class ClientWxappSettingController {
     }
 
     /** 更新小程序设置项 */
-    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @PostMapping("/update")
     public R<Void> update(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         String key = Params.strOrNull(Params.merge(body, request), "key");
         if (key == null) {

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/ContentArticleCategoryController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.ContentService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -25,18 +26,18 @@ public class ContentArticleCategoryController {
 
     private final ContentService contentService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, List<ArticleCategory>>> list() {
         return R.ok(Map.of("list", contentService.articleCategoryList()));
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         contentService.articleCategoryAdd(Params.form(body), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer categoryId = categoryId(Params.merge(body, request));
         if (categoryId == null) {
@@ -46,7 +47,7 @@ public class ContentArticleCategoryController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer categoryId = categoryId(Params.merge(body, request));
         if (categoryId == null) {

+ 7 - 6
yoshop-java/src/main/java/cn/yoshop/store/controller/ContentArticleController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.ContentService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -27,13 +28,13 @@ public class ContentArticleController {
 
     private final ContentService contentService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Article>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", contentService.articleList(params == null ? Map.of() : params)));
     }
 
     /** 文章详情:content 已做 HTML 实体解码,带 image 对象与 show_views */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestBody(required = false) Map<String, Object> body,
                                          HttpServletRequest request) {
         Integer articleId = articleId(Params.merge(body, request));
@@ -45,13 +46,13 @@ public class ContentArticleController {
         return R.ok(data);
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         contentService.articleAdd(Params.form(body), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer articleId = articleId(Params.merge(body, request));
         if (articleId == null) {
@@ -61,7 +62,7 @@ public class ContentArticleController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer articleId = articleId(Params.merge(body, request));
         if (articleId == null) {

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/ContentHelpController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.ContentService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -26,18 +27,18 @@ public class ContentHelpController {
 
     private final ContentService contentService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Help>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", contentService.helpList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         contentService.helpAdd(Params.form(body), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer helpId = Params.intOrNull(Params.merge(body, request), "helpId");
         if (helpId == null) {
@@ -50,7 +51,7 @@ public class ContentHelpController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         Integer helpId = Params.intOrNull(all, "helpId");

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/FilesController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.util.Params;
 import cn.yoshop.store.service.FilesService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -26,12 +27,12 @@ public class FilesController {
 
     private final FilesService filesService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<UploadFile>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", filesService.getList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         Integer fileId = Params.argInt(all, "fileId");
@@ -42,14 +43,14 @@ public class FilesController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         List<Integer> fileIds = readIntList(Params.merge(body, request), "fileIds");
         filesService.deleteFiles(fileIds);
         return R.okMsg("操作成功");
     }
 
-    @RequestMapping(value = "/moveGroup", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/moveGroup")
     public R<Void> moveGroup(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         Integer groupId = Params.argInt(all, "groupId");

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/FilesGroupController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.FilesService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -25,18 +26,18 @@ public class FilesGroupController {
 
     private final FilesService filesService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, List<UploadGroup>>> list() {
         return R.ok(Map.of("list", filesService.getGroupList()));
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         filesService.addGroup(Params.form(Params.merge(body, request)), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         Integer groupId = Params.argInt(all, "groupId");
@@ -47,7 +48,7 @@ public class FilesGroupController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer groupId = Params.argInt(Params.merge(body, request), "groupId");
         if (groupId == null) {

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsCommentController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.CommentService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -28,13 +29,13 @@ public class GoodsCommentController {
     private final CommentService commentService;
 
     /** 评价列表 */
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Comment>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", commentService.getList(params == null ? Map.of() : params)));
     }
 
     /** 评价详情 */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Comment>> detail(@RequestParam(required = false) Map<String, Object> params) {
         Integer commentId = Params.argInt(params == null ? Map.of() : params, "commentId");
         if (commentId == null) {
@@ -44,7 +45,7 @@ public class GoodsCommentController {
     }
 
     /** 编辑评价 */
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer commentId = Params.argInt(Params.merge(body, request), "commentId");
         if (commentId == null) {
@@ -55,7 +56,7 @@ public class GoodsCommentController {
     }
 
     /** 删除评价 */
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer commentId = Params.argInt(Params.merge(body, request), "commentId");
         if (commentId == null) {

+ 10 - 9
yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsController.java

@@ -10,9 +10,10 @@ import cn.yoshop.store.service.StoreGoodsService;
 import com.fasterxml.jackson.annotation.JsonView;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -34,14 +35,14 @@ public class GoodsController {
 
     /** 商品列表:对齐 GET/POST /store/goods/list */
     @JsonView(Views.List.class)
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Goods>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", goodsService.getList(params == null ? Map.of() : params)));
     }
 
     /** 按 ID 集获取商品列表:对齐 /store/goods/listByIds?goodsIds[]=1&goodsIds[]=2 */
     @JsonView(Views.List.class)
-    @RequestMapping(value = "/listByIds", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/listByIds")
     public R<Map<String, List<Goods>>> listByIds(HttpServletRequest request,
                                                  @RequestBody(required = false) Map<String, Object> body) {
         List<Integer> goodsIds = Params.intList(request, "goodsIds");
@@ -54,20 +55,20 @@ public class GoodsController {
 
     /** 商品详情:对齐 GET/POST /store/goods/detail?goodsId= */
     @JsonView(Views.Detail.class)
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Goods>> detail(@RequestParam int goodsId) {
         return R.ok(Map.of("goodsInfo", goodsService.getDetail(goodsId)));
     }
 
     /** 商品基础信息:对齐 /store/goods/basic?goodsId= */
     @JsonView(Views.Detail.class)
-    @RequestMapping(value = "/basic", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/basic")
     public R<Map<String, Goods>> basic(@RequestParam int goodsId) {
         return R.ok(Map.of("detail", goodsService.getBasic(goodsId)));
     }
 
     /** 添加商品:对齐 POST /store/goods/add(body: {form: {...}}) */
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body) {
         Map<String, Object> form = Params.form(body);
         if (form.isEmpty() || String.valueOf(form.get("goodsName")).isBlank()) {
@@ -78,7 +79,7 @@ public class GoodsController {
     }
 
     /** 编辑商品:对齐 POST /store/goods/edit(body: {goodsId, form: {...}}) */
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> merged = Params.merge(body, request);
         Integer goodsId = Params.argInt(merged, "goodsId");
@@ -90,7 +91,7 @@ public class GoodsController {
     }
 
     /** 上下架:对齐 POST /store/goods/state(body: {goodsIds: [], state: true}) */
-    @RequestMapping(value = "/state", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/state")
     public R<Void> state(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> merged = Params.merge(body, request);
         List<Integer> goodsIds = Params.intList(merged.get("goodsIds"));
@@ -104,7 +105,7 @@ public class GoodsController {
     }
 
     /** 删除商品:对齐 POST /store/goods/delete(body: {goodsIds: []}) */
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> merged = Params.merge(body, request);
         List<Integer> goodsIds = Params.intList(merged.get("goodsIds"));

+ 7 - 6
yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsServiceController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.GoodsServiceItemService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -28,23 +29,23 @@ public class GoodsServiceController {
 
     private final GoodsServiceItemService service;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<GoodsService>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", service.getList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, List<GoodsService>>> all(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", service.getAll(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         service.add(Params.form(Params.merge(body, request)), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> bodyAll = Params.merge(body, request);
         Integer serviceId = Params.argInt(bodyAll, "serviceId");
@@ -55,7 +56,7 @@ public class GoodsServiceController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer serviceId = Params.argInt(Params.merge(body, request), "serviceId");
         if (serviceId == null) {

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/store/controller/GoodsSpecController.java

@@ -3,8 +3,8 @@ package cn.yoshop.store.controller;
 import cn.yoshop.common.api.R;
 import cn.yoshop.store.service.StoreGoodsService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -23,7 +23,7 @@ public class GoodsSpecController {
     private final StoreGoodsService goodsService;
 
     /** 商品规格属性列表 */
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, List<Map<String, Object>>>> list(@RequestParam int goodsId) {
         return R.ok(Map.of("list", goodsService.getSpecList(goodsId)));
     }

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/store/controller/HomeController.java

@@ -2,8 +2,8 @@ package cn.yoshop.store.controller;
 
 import cn.yoshop.common.api.R;
 import cn.yoshop.store.service.HomeService;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -22,7 +22,7 @@ public class HomeController {
         this.homeService = homeService;
     }
 
-    @RequestMapping(value = "/data", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/data")
     public R<Map<String, Object>> data() {
         return R.ok(Map.of("data", homeService.getData()));
     }

+ 8 - 7
yoshop-java/src/main/java/cn/yoshop/store/controller/MarketCouponController.java

@@ -9,9 +9,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.MarketingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -28,12 +29,12 @@ public class MarketCouponController {
 
     private final MarketingService marketingService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Coupon>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", marketingService.couponList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestParam(required = false) Integer couponId,
                                          HttpServletRequest request) {
         Integer id = couponId == null ? Params.argInt(Params.merge(null, request), "couponId") : couponId;
@@ -42,13 +43,13 @@ public class MarketCouponController {
         return R.ok(data);
     }
 
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         marketingService.couponAdd(Params.form(body), storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer couponId = Params.argInt(Params.merge(body, request), "couponId");
         if (couponId == null) {
@@ -58,7 +59,7 @@ public class MarketCouponController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer couponId = Params.argInt(Params.merge(body, request), "couponId");
         if (couponId == null) {
@@ -69,7 +70,7 @@ public class MarketCouponController {
     }
 
     /** 领取记录 */
-    @RequestMapping(value = "/receive", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/receive")
     public R<Map<String, PageVO<UserCoupon>>> receive(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", marketingService.userCouponList(params == null ? Map.of() : params)));
     }

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/store/controller/MarketPointsController.java

@@ -5,8 +5,8 @@ import cn.yoshop.common.entity.UserPointsLog;
 import cn.yoshop.common.page.PageVO;
 import cn.yoshop.store.service.MarketingService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -22,7 +22,7 @@ public class MarketPointsController {
 
     private final MarketingService marketingService;
 
-    @RequestMapping(value = "/log", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/log")
     public R<Map<String, PageVO<UserPointsLog>>> log(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", marketingService.pointsLog(params == null ? Map.of() : params)));
     }

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/MarketRechargePlanController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.MarketingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -26,18 +27,18 @@ public class MarketRechargePlanController {
 
     private final MarketingService marketingService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<RechargePlan>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", marketingService.rechargePlanList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         marketingService.rechargePlanAdd(Params.form(body), storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer planId = Params.argInt(Params.merge(body, request), "planId");
         if (planId == null) {
@@ -47,7 +48,7 @@ public class MarketRechargePlanController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer planId = Params.argInt(Params.merge(body, request), "planId");
         if (planId == null) {

+ 3 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/OrderController.java

@@ -5,9 +5,9 @@ import cn.yoshop.common.util.Params;
 import cn.yoshop.store.service.OrderService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -24,7 +24,7 @@ public class OrderController {
 
     private final OrderService orderService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, Object>> list(@RequestParam(required = false) Map<String, Object> params) {
         Map<String, Object> p = params == null ? Map.of() : params;
         String dataType = Params.str(p, "dataType", null);
@@ -34,7 +34,7 @@ public class OrderController {
         return R.ok(orderService.getList(p, dataType));
     }
 
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestBody(required = false) Map<String, Object> body,
                                          HttpServletRequest request) {
         Integer orderId = Params.argInt(Params.merge(body, request), "orderId");

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/OrderDeliveryController.java

@@ -6,9 +6,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.OrderDeliveryService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -25,13 +26,13 @@ public class OrderDeliveryController {
     private final OrderDeliveryService orderDeliveryService;
 
     /** 订单发货记录 */
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, Object>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(orderDeliveryService.getList(params == null ? Map.of() : params));
     }
 
     /** 发货单详情 */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestBody(required = false) Map<String, Object> body,
                                          HttpServletRequest request) {
         Integer deliveryId = Params.argInt(Params.merge(body, request), "deliveryId");
@@ -42,7 +43,7 @@ public class OrderDeliveryController {
     }
 
     /** 确认发货(手动录入) */
-    @RequestMapping(value = "/delivery", method = RequestMethod.POST)
+    @PostMapping("/delivery")
     public R<Void> delivery(@RequestBody(required = false) Map<String, Object> body,
                             HttpServletRequest request) {
         Integer orderId = Params.argInt(Params.merge(body, request), "orderId");
@@ -54,7 +55,7 @@ public class OrderDeliveryController {
     }
 
     /** 查询指定发货单的物流跟踪信息 */
-    @RequestMapping(value = "/traces", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/traces")
     public R<Map<String, Object>> traces(@RequestBody(required = false) Map<String, Object> body,
                                          HttpServletRequest request) {
         Integer deliveryId = Params.argInt(Params.merge(body, request), "deliveryId");

+ 7 - 7
yoshop-java/src/main/java/cn/yoshop/store/controller/OrderEventController.java

@@ -7,9 +7,9 @@ import cn.yoshop.store.service.OrderEventService;
 import cn.yoshop.store.service.PrinterService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -28,7 +28,7 @@ public class OrderEventController {
     private final PrinterService printerService;
 
     /** 修改订单价格 */
-    @RequestMapping(value = {"/updatePrice", "/update_price"}, method = RequestMethod.POST)
+    @PostMapping({"/updatePrice", "/update_price"})
     public R<Void> updatePrice(@RequestBody(required = false) Map<String, Object> body,
                                HttpServletRequest request) {
         Integer orderId = orderId(body, request);
@@ -40,7 +40,7 @@ public class OrderEventController {
     }
 
     /** 修改商家备注 */
-    @RequestMapping(value = {"/updateRemark", "/update_remark"}, method = RequestMethod.POST)
+    @PostMapping({"/updateRemark", "/update_remark"})
     public R<Void> updateRemark(@RequestBody(required = false) Map<String, Object> body,
                                 HttpServletRequest request) {
         Integer orderId = orderId(body, request);
@@ -52,7 +52,7 @@ public class OrderEventController {
     }
 
     /** 修改收货地址 */
-    @RequestMapping(value = {"/updateAddress", "/update_address"}, method = RequestMethod.POST)
+    @PostMapping({"/updateAddress", "/update_address"})
     public R<Void> updateAddress(@RequestBody(required = false) Map<String, Object> body,
                                  HttpServletRequest request) {
         Integer orderId = orderId(body, request);
@@ -64,7 +64,7 @@ public class OrderEventController {
     }
 
     /** 审核:用户取消订单 */
-    @RequestMapping(value = {"/confirmCancel", "/confirm_cancel"}, method = RequestMethod.POST)
+    @PostMapping({"/confirmCancel", "/confirm_cancel"})
     public R<Void> confirmCancel(@RequestBody(required = false) Map<String, Object> body,
                                  HttpServletRequest request) {
         Integer orderId = orderId(body, request);
@@ -76,7 +76,7 @@ public class OrderEventController {
     }
 
     /** 删除订单记录 */
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body,
                           HttpServletRequest request) {
         Integer orderId = orderId(body, request);
@@ -88,7 +88,7 @@ public class OrderEventController {
     }
 
     /** 手动打印小票(PHP Order::printer) */
-    @RequestMapping(value = "/printer", method = RequestMethod.POST)
+    @PostMapping("/printer")
     public R<Void> printer(@RequestBody(required = false) Map<String, Object> body,
                            HttpServletRequest request) {
         Integer orderId = orderId(body, request);

+ 3 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/OrderExportController.java

@@ -8,8 +8,8 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.OrderExportService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -31,7 +31,7 @@ public class OrderExportController {
     private final OrderExportService orderExportService;
 
     /** 执行订单导出 */
-    @RequestMapping(value = {"/exportOrder", "/export_order"}, method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping({"/exportOrder", "/export_order"})
     public R<Void> exportOrder(@RequestParam(required = false) Map<String, Object> params,
                                HttpServletRequest request) {
         Map<String, Object> all = new LinkedHashMap<>(params == null ? Map.of() : params);
@@ -45,7 +45,7 @@ public class OrderExportController {
     }
 
     /** 订单导出记录 */
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<OrderExport>>> list(HttpServletRequest request) {
         return R.ok(Map.of("list", orderExportService.getList(baseUrl(request))));
     }

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/OrderRefundController.java

@@ -5,9 +5,10 @@ import cn.yoshop.common.util.Params;
 import cn.yoshop.store.service.OrderRefundService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -24,13 +25,13 @@ public class OrderRefundController {
     private final OrderRefundService orderRefundService;
 
     /** 售后单列表 */
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, Object>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(orderRefundService.getList(params == null ? Map.of() : params));
     }
 
     /** 售后单详情 */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestBody(required = false) Map<String, Object> body,
                                          HttpServletRequest request) {
         Integer orderRefundId = id(body, request);
@@ -45,7 +46,7 @@ public class OrderRefundController {
     }
 
     /** 商家审核 */
-    @RequestMapping(value = "/audit", method = RequestMethod.POST)
+    @PostMapping("/audit")
     public R<Void> audit(@RequestBody(required = false) Map<String, Object> body,
                          HttpServletRequest request) {
         Integer orderRefundId = id(body, request);
@@ -57,7 +58,7 @@ public class OrderRefundController {
     }
 
     /** 确认收货并退款 */
-    @RequestMapping(value = "/receipt", method = RequestMethod.POST)
+    @PostMapping("/receipt")
     public R<Void> receipt(@RequestBody(required = false) Map<String, Object> body,
                            HttpServletRequest request) {
         Integer orderRefundId = id(body, request);

+ 9 - 8
yoshop-java/src/main/java/cn/yoshop/store/controller/PageController.java

@@ -9,9 +9,10 @@ import cn.yoshop.store.service.ContentService;
 import cn.yoshop.store.service.PageDesignService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -31,18 +32,18 @@ public class PageController {
     private final ContentService contentService;
     private final PageDesignService pageDesignService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<PageEntity>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", contentService.pageList(params == null ? Map.of() : params)));
     }
 
     /** 页面装修默认组件库,出参 {page:{...}, items:{...}} */
-    @RequestMapping(value = "/defaultData", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/defaultData")
     public R<Map<String, Object>> defaultData() {
         return R.ok(pageDesignService.getDefaultData());
     }
 
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestBody(required = false) Map<String, Object> body,
                                          HttpServletRequest request) {
         Integer pageId = pageId(Params.merge(body, request));
@@ -55,13 +56,13 @@ public class PageController {
     }
 
     /** 新增页面:表单在 form 内,结构 {page:{...}, items:[...]} */
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         pageDesignService.add(Params.form(body), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         Integer pageId = pageId(all);
@@ -72,7 +73,7 @@ public class PageController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer pageId = pageId(Params.merge(body, request));
         if (pageId == null) {
@@ -82,7 +83,7 @@ public class PageController {
         return R.okMsg("删除成功");
     }
 
-    @RequestMapping(value = "/setHome", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/setHome")
     public R<Void> setHome(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer pageId = pageId(Params.merge(body, request));
         if (pageId == null) {

+ 3 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/RegionController.java

@@ -3,8 +3,8 @@ package cn.yoshop.store.controller;
 import cn.yoshop.common.api.R;
 import cn.yoshop.store.service.RegionService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -20,12 +20,12 @@ public class RegionController {
 
     private final RegionService regionService;
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, Object>> all() {
         return R.ok(Map.of("list", regionService.getAll()));
     }
 
-    @RequestMapping(value = "/tree", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/tree")
     public R<Map<String, Object>> tree() {
         return R.ok(Map.of("list", regionService.getTree()));
     }

+ 4 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/SettingCacheController.java

@@ -3,8 +3,9 @@ package cn.yoshop.store.controller;
 import cn.yoshop.common.api.R;
 import cn.yoshop.store.service.SettingService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -20,7 +21,7 @@ public class SettingCacheController {
 
     private final SettingService settingService;
 
-    @RequestMapping(value = "/items", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/items")
     public R<Map<String, List<Map<String, Object>>>> items() {
         return R.ok(Map.of("items", settingService.cacheItems()));
     }
@@ -29,7 +30,7 @@ public class SettingCacheController {
      * 清理缓存。Java 端数据直接从库里读、不走 PHP 的 File/Redis 缓存,
      * 因此只需保证接口语义成功,无需真正删除缓存键。
      */
-    @RequestMapping(value = "/clear", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/clear")
     public R<Void> clear() {
         return R.okMsg("操作成功");
     }

+ 4 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/SettingController.java

@@ -6,9 +6,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.SettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.LinkedHashMap;
@@ -25,7 +26,7 @@ public class SettingController {
     private final SettingService settingService;
 
     /** 读取设置项 → {"values": {...}};无该项时 values 为 [] */
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestBody(required = false) Map<String, Object> body,
                                          HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
@@ -39,7 +40,7 @@ public class SettingController {
     }
 
     /** 更新设置项 */
-    @RequestMapping(value = "/update", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/update")
     public R<Void> update(@RequestBody(required = false) Map<String, Object> body,
                             HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);

+ 8 - 7
yoshop-java/src/main/java/cn/yoshop/store/controller/SettingDeliveryController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.SettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -28,17 +29,17 @@ public class SettingDeliveryController {
 
     private final SettingService settingService;
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, List<Delivery>>> all() {
         return R.ok(Map.of("list", settingService.deliveryAll()));
     }
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Delivery>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", settingService.deliveryList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestParam(required = false) Integer deliveryId,
                                          HttpServletRequest request) {
         Integer id = deliveryId == null ? Params.argInt(Params.merge(null, request), "deliveryId") : deliveryId;
@@ -47,13 +48,13 @@ public class SettingDeliveryController {
         return R.ok(data);
     }
 
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         settingService.deliveryAdd(Params.form(body), storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer deliveryId = Params.argInt(Params.merge(body, request), "deliveryId");
         if (deliveryId == null) {
@@ -63,7 +64,7 @@ public class SettingDeliveryController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer deliveryId = Params.argInt(Params.merge(body, request), "deliveryId");
         if (deliveryId == null) {

+ 7 - 6
yoshop-java/src/main/java/cn/yoshop/store/controller/SettingExpressController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.SettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -27,23 +28,23 @@ public class SettingExpressController {
 
     private final SettingService settingService;
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, List<Express>>> all(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", settingService.expressAll(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Express>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", settingService.expressList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         settingService.expressAdd(Params.form(body), storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer expressId = Params.argInt(Params.merge(body, request), "expressId");
         if (expressId == null) {
@@ -53,7 +54,7 @@ public class SettingExpressController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer expressId = Params.argInt(Params.merge(body, request), "expressId");
         if (expressId == null) {

+ 4 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/SettingPaymentController.java

@@ -6,9 +6,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.PaymentSettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -23,12 +24,12 @@ public class SettingPaymentController {
 
     private final PaymentSettingService paymentSettingService;
 
-    @RequestMapping(value = "/options", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/options")
     public R<Map<String, Object>> options(HttpServletRequest request) {
         return R.ok(Map.of("options", paymentSettingService.options(storeId(request))));
     }
 
-    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @PostMapping("/update")
     public R<Void> update(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         paymentSettingService.updateOptions(Params.form(body), storeId(request));
         return R.okMsg("更新成功");

+ 8 - 7
yoshop-java/src/main/java/cn/yoshop/store/controller/SettingPaymentTemplateController.java

@@ -8,8 +8,9 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.PaymentSettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
@@ -32,18 +33,18 @@ public class SettingPaymentTemplateController {
 
     private final PaymentSettingService paymentSettingService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<PaymentTemplate>>> list(@RequestParam(required = false) Map<String, Object> params) {
         int page = params == null ? 1 : Params.intVal(params, "page", 1);
         return R.ok(Map.of("list", paymentSettingService.templateList(page)));
     }
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, List<PaymentTemplate>>> all() {
         return R.ok(Map.of("list", paymentSettingService.templateAll()));
     }
 
-    @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/detail")
     public R<Map<String, Object>> detail(@RequestParam(required = false) Integer templateId,
                                          HttpServletRequest request) {
         Integer id = templateId == null ? Params.argInt(Params.merge(null, request), "templateId") : templateId;
@@ -52,13 +53,13 @@ public class SettingPaymentTemplateController {
         return R.ok(data);
     }
 
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @PostMapping("/add")
     public R<Void> add(@RequestParam Map<String, Object> params, HttpServletRequest request) {
         paymentSettingService.templateAdd(params, files(request), storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestParam Map<String, Object> params, HttpServletRequest request) {
         Integer templateId = Params.argInt(params, "templateId");
         if (templateId == null) {
@@ -68,7 +69,7 @@ public class SettingPaymentTemplateController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestParam Map<String, Object> params, HttpServletRequest request) {
         Integer templateId = Params.argInt(params, "templateId");
         if (templateId == null) {

+ 7 - 6
yoshop-java/src/main/java/cn/yoshop/store/controller/SettingPrinterController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.SettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -27,23 +28,23 @@ public class SettingPrinterController {
 
     private final SettingService settingService;
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, List<Printer>>> all() {
         return R.ok(Map.of("list", settingService.printerAll()));
     }
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<Printer>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", settingService.printerList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         settingService.printerAdd(Params.form(body), storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer printerId = Params.argInt(Params.merge(body, request), "printerId");
         if (printerId == null) {
@@ -53,7 +54,7 @@ public class SettingPrinterController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer printerId = Params.argInt(Params.merge(body, request), "printerId");
         if (printerId == null) {

+ 5 - 4
yoshop-java/src/main/java/cn/yoshop/store/controller/StatisticsController.java

@@ -4,8 +4,8 @@ import cn.yoshop.common.api.R;
 import cn.yoshop.common.util.Params;
 import cn.yoshop.store.service.StatisticsService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -22,13 +22,13 @@ public class StatisticsController {
     private final StatisticsService statisticsService;
 
     /** 数据统计主页 */
-    @RequestMapping(value = "/data", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/data")
     public R<Map<String, Object>> data() {
         return R.ok(Map.of("data", statisticsService.data()));
     }
 
     /** 数据概况(可选 startDate / endDate,格式 yyyy-MM-dd) */
-    @RequestMapping(value = "/survey", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/survey")
     public R<Map<String, Object>> survey(@RequestParam(required = false) Map<String, Object> params) {
         Map<String, Object> safe = params == null ? Map.of() : params;
         return R.ok(statisticsService.survey(Params.strOrNull(safe, "startDate"),
@@ -38,8 +38,9 @@ public class StatisticsController {
     /**
      * PHP 侧为控制器的 initialize() 生命周期方法(无返回值),
      * 直接访问时返回 HTTP 200 + 空响应体,这里保持一致。
+     * 前端并不调用,按浏览器直接访问的方式只保留 GET。
      */
-    @RequestMapping(value = "/initialize", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/initialize")
     public void initialize() {
         // no-op:与 PHP 一致,仅做登录校验后返回空体
     }

+ 7 - 6
yoshop-java/src/main/java/cn/yoshop/store/controller/StoreAddressController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.SettingService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -27,24 +28,24 @@ public class StoreAddressController {
 
     private final SettingService settingService;
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, List<StoreAddress>>> all(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", settingService.addressAll(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<StoreAddress>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", settingService.addressList(params == null ? Map.of() : params)));
     }
 
     /** 新增地址:表单 type / name / phone / cascader[省,市,区] / detail / sort */
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         settingService.addressAdd(Params.form(body), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer addressId = addressId(Params.merge(body, request));
         if (addressId == null) {
@@ -54,7 +55,7 @@ public class StoreAddressController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer addressId = addressId(Params.merge(body, request));
         if (addressId == null) {

+ 3 - 2
yoshop-java/src/main/java/cn/yoshop/store/controller/StoreBaseController.java

@@ -1,7 +1,7 @@
 package cn.yoshop.store.controller;
 
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -9,12 +9,13 @@ import org.springframework.web.bind.annotation.RestController;
  *
  * <p>PHP 路由 /store/controller/initialize 映射到该方法,方法无返回值,
  * 因此响应为 HTTP 200 + 空响应体;登录校验由拦截器完成。
+ * 前端不调用该地址,按浏览器直接访问的方式只保留 GET。
  */
 @RestController
 @RequestMapping("/store/controller")
 public class StoreBaseController {
 
-    @RequestMapping(value = "/initialize", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/initialize")
     public void initialize() {
         // no-op
     }

+ 4 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/StoreController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.StoreInfoService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -28,13 +29,13 @@ public class StoreController {
     private final StoreInfoService storeInfoService;
 
     /** 获取当前登录的商城信息 → {"storeInfo": {...}} */
-    @RequestMapping(value = "/info", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/info")
     public R<Map<String, Store>> info(HttpServletRequest request) {
         return R.ok(Map.of("storeInfo", storeInfoService.getInfo(StoreContext.storeId(request))));
     }
 
     /** 更新商城信息,PHP 端返回 renderSuccess('更新成功'),data 为字符串 */
-    @RequestMapping(value = "/update", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/update")
     public R<Void> update(@RequestBody(required = false) Map<String, Object> body,
                             HttpServletRequest request) {
         Map<String, Object> data = Params.merge(body, request);

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/store/controller/StoreMenuController.java

@@ -4,8 +4,8 @@ import cn.yoshop.common.api.R;
 import cn.yoshop.common.entity.StoreMenu;
 import cn.yoshop.store.service.PermissionService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -21,7 +21,7 @@ public class StoreMenuController {
 
     private final PermissionService permissionService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, List<StoreMenu>>> list() {
         return R.ok(Map.of("list", permissionService.getMenuList()));
     }

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/StoreRoleController.java

@@ -7,9 +7,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.PermissionService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -25,19 +26,19 @@ public class StoreRoleController {
 
     private final PermissionService permissionService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, List<StoreRole>>> list() {
         return R.ok(Map.of("list", permissionService.getRoleList()));
     }
 
     /** 新增角色:表单含 role_name / parent_id / sort / menus */
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         permissionService.addRole(Params.form(body), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         Integer roleId = Params.intOrNull(all, "roleId");
@@ -51,7 +52,7 @@ public class StoreRoleController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> all = Params.merge(body, request);
         Integer roleId = Params.intOrNull(all, "roleId");

+ 6 - 6
yoshop-java/src/main/java/cn/yoshop/store/controller/StoreUserController.java

@@ -10,9 +10,9 @@ import cn.yoshop.store.service.PermissionService;
 import cn.yoshop.store.service.StoreUserService;
 import jakarta.servlet.http.HttpServletRequest;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -44,20 +44,20 @@ public class StoreUserController {
     }
 
     /** 管理员列表,对齐 PHP /store/store.user/list */
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<StoreUser>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", permissionService.getAdminList(params == null ? Map.of() : params)));
     }
 
     /** 新增管理员 */
-    @RequestMapping(value = "/add", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         permissionService.addAdmin(Params.form(body), StoreContext.storeId(request));
         return R.okMsg("添加成功");
     }
 
     /** 更新管理员 */
-    @RequestMapping(value = "/edit", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer userId = userId(Params.merge(body, request));
         if (userId == null) {
@@ -68,7 +68,7 @@ public class StoreUserController {
     }
 
     /** 删除管理员(软删) */
-    @RequestMapping(value = "/delete", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer userId = userId(Params.merge(body, request));
         if (userId == null) {
@@ -79,7 +79,7 @@ public class StoreUserController {
     }
 
     /** 修改当前登录管理员的资料,并同步刷新登录态缓存 */
-    @RequestMapping(value = "/renew", method = {RequestMethod.GET, RequestMethod.POST})
+    @PostMapping("/renew")
     public R<Void> renew(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         StoreUser current = currentUser(request);
         StoreUser updated = permissionService.renew(current.getStoreUserId(), Params.form(body));

+ 3 - 3
yoshop-java/src/main/java/cn/yoshop/store/controller/UploadController.java

@@ -4,8 +4,8 @@ import cn.yoshop.common.api.R;
 import cn.yoshop.common.entity.UploadFile;
 import cn.yoshop.store.service.UploadService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
@@ -24,7 +24,7 @@ public class UploadController {
     private final UploadService uploadService;
 
     /** 图片上传 */
-    @RequestMapping(value = "/image", method = {RequestMethod.POST})
+    @PostMapping("/image")
     public R<Map<String, UploadFile>> image(@RequestParam(required = false, defaultValue = "0") int groupId,
                                             @RequestParam("iFile") MultipartFile iFile) {
         UploadFile file = uploadService.uploadImage(iFile, groupId);
@@ -32,7 +32,7 @@ public class UploadController {
     }
 
     /** 视频上传 */
-    @RequestMapping(value = "/video", method = {RequestMethod.POST})
+    @PostMapping("/video")
     public R<Map<String, UploadFile>> video(@RequestParam(required = false, defaultValue = "0") int groupId,
                                             @RequestParam("iFile") MultipartFile iFile) {
         UploadFile file = uploadService.uploadVideo(iFile, groupId);

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/store/controller/UserBalanceController.java

@@ -5,8 +5,8 @@ import cn.yoshop.common.entity.UserBalanceLog;
 import cn.yoshop.common.page.PageVO;
 import cn.yoshop.store.service.MarketingService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -22,7 +22,7 @@ public class UserBalanceController {
 
     private final MarketingService marketingService;
 
-    @RequestMapping(value = "/log", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/log")
     public R<Map<String, PageVO<UserBalanceLog>>> log(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", marketingService.balanceLog(params == null ? Map.of() : params)));
     }

+ 6 - 5
yoshop-java/src/main/java/cn/yoshop/store/controller/UserController.java

@@ -10,9 +10,10 @@ import cn.yoshop.store.service.MemberService;
 import cn.yoshop.store.service.MemberWriteService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -29,12 +30,12 @@ public class UserController {
     private final MemberService memberService;
     private final MemberWriteService memberWriteService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<User>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", memberService.getList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer userId = Params.argInt(Params.merge(body, request), "userId");
         if (userId == null) {
@@ -45,7 +46,7 @@ public class UserController {
     }
 
     /** 会员充值:target = balance(余额)| points(积分) */
-    @RequestMapping(value = "/recharge", method = RequestMethod.POST)
+    @PostMapping("/recharge")
     public R<Void> recharge(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> params = Params.merge(body, request);
         Integer userId = Params.argInt(params, "userId");
@@ -62,7 +63,7 @@ public class UserController {
     }
 
     /** 修改会员等级 */
-    @RequestMapping(value = "/grade", method = RequestMethod.POST)
+    @PostMapping("/grade")
     public R<Void> grade(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer userId = Params.argInt(Params.merge(body, request), "userId");
         if (userId == null) {

+ 7 - 6
yoshop-java/src/main/java/cn/yoshop/store/controller/UserGradeController.java

@@ -8,9 +8,10 @@ import cn.yoshop.common.web.StoreContext;
 import cn.yoshop.store.service.UserGradeService;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -27,23 +28,23 @@ public class UserGradeController {
 
     private final UserGradeService userGradeService;
 
-    @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/list")
     public R<Map<String, PageVO<UserGrade>>> list(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", userGradeService.getList(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/all", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/all")
     public R<Map<String, List<UserGrade>>> all(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", userGradeService.getAll(params == null ? Map.of() : params)));
     }
 
-    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @PostMapping("/add")
     public R<Void> add(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         userGradeService.add(Params.form(body), storeId(request));
         return R.okMsg("添加成功");
     }
 
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
+    @PostMapping("/edit")
     public R<Void> edit(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer gradeId = Params.argInt(Params.merge(body, request), "gradeId");
         if (gradeId == null) {
@@ -53,7 +54,7 @@ public class UserGradeController {
         return R.okMsg("更新成功");
     }
 
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @PostMapping("/delete")
     public R<Void> delete(@RequestBody(required = false) Map<String, Object> body, HttpServletRequest request) {
         Integer gradeId = Params.argInt(Params.merge(body, request), "gradeId");
         if (gradeId == null) {

+ 2 - 2
yoshop-java/src/main/java/cn/yoshop/store/controller/UserRechargeController.java

@@ -5,8 +5,8 @@ import cn.yoshop.common.entity.RechargeOrder;
 import cn.yoshop.common.page.PageVO;
 import cn.yoshop.store.service.RechargeService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -22,7 +22,7 @@ public class UserRechargeController {
 
     private final RechargeService rechargeService;
 
-    @RequestMapping(value = "/order", method = {RequestMethod.GET, RequestMethod.POST})
+    @GetMapping("/order")
     public R<Map<String, PageVO<RechargeOrder>>> order(@RequestParam(required = false) Map<String, Object> params) {
         return R.ok(Map.of("list", rechargeService.orderList(params == null ? Map.of() : params)));
     }