{"id":63469,"date":"2026-01-22T00:48:48","date_gmt":"2026-01-21T16:48:48","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/63469.html"},"modified":"2026-01-22T00:48:48","modified_gmt":"2026-01-21T16:48:48","slug":"%e8%8b%8d%e7%a9%b9%e5%a4%96%e5%8d%96-%e7%bc%93%e5%ad%98%e5%95%86%e5%93%81%e3%80%81%e8%b4%ad%e7%89%a9%e8%bd%a6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/63469.html","title":{"rendered":"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"-toc\" style=\"margin-left:0px\">\n<p id=\"%E7%BC%93%E5%AD%98%E8%8F%9C%E5%93%81-toc\" style=\"margin-left:0px\">\u7f13\u5b58\u83dc\u54c1<\/p>\n<p id=\"%E9%97%AE%E9%A2%98%E8%AF%B4%E6%98%8E-toc\" style=\"margin-left:40px\">\u95ee\u9898\u8bf4\u660e<\/p>\n<p id=\"%E5%AE%9E%E7%8E%B0%E6%80%9D%E8%B7%AF-toc\" style=\"margin-left:40px\">\u5b9e\u73b0\u601d\u8def<\/p>\n<p id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91-toc\" style=\"margin-left:40px\">\u4ee3\u7801\u5f00\u53d1<\/p>\n<p id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95-toc\" style=\"margin-left:40px\">\u529f\u80fd\u6d4b\u8bd5<\/p>\n<p id=\"%E7%BC%93%E5%AD%98%E5%A5%97%E9%A4%90-toc\" style=\"margin-left:0px\">\u7f13\u5b58\u5957\u9910<\/p>\n<p id=\"Spring%20Cache-toc\" style=\"margin-left:40px\">Spring Cache<\/p>\n<p id=\"%E5%AE%9E%E7%8E%B0%E6%80%9D%E8%B7%AF-toc\" style=\"margin-left:40px\">\u5b9e\u73b0\u601d\u8def<\/p>\n<p id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91-toc\" style=\"margin-left:40px\">\u4ee3\u7801\u5f00\u53d1<\/p>\n<p id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95-toc\" style=\"margin-left:40px\">\u529f\u80fd\u6d4b\u8bd5<\/p>\n<p id=\"%E6%B7%BB%E5%8A%A0%E8%B4%AD%E7%89%A9%E8%BD%A6-toc\" style=\"margin-left:0px\">\u6dfb\u52a0\u8d2d\u7269\u8f66<\/p>\n<p id=\"%E9%9C%80%E6%B1%82%E5%88%86%E6%9E%90%E4%B8%8E%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:40px\">\u9700\u6c42\u5206\u6790\u4e0e\u8bbe\u8ba1<\/p>\n<p id=\"%E4%BA%A7%E5%93%81%E5%8E%9F%E5%9E%8B-toc\" style=\"margin-left:80px\">\u4ea7\u54c1\u539f\u578b<\/p>\n<p id=\"%E6%8E%A5%E5%8F%A3%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:80px\">\u63a5\u53e3\u8bbe\u8ba1<\/p>\n<p id=\"%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:80px\">\u6570\u636e\u5e93\u8bbe\u8ba1<\/p>\n<p id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91-toc\" style=\"margin-left:40px\">\u4ee3\u7801\u5f00\u53d1<\/p>\n<p id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95-toc\" style=\"margin-left:40px\">\u529f\u80fd\u6d4b\u8bd5<\/p>\n<p id=\"%E6%9F%A5%E7%9C%8B%E8%B4%AD%E7%89%A9%E8%BD%A6-toc\" style=\"margin-left:0px\">\u67e5\u770b\u8d2d\u7269\u8f66<\/p>\n<p id=\"%E9%9C%80%E6%B1%82%E5%88%86%E6%9E%90%E5%92%8C%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:40px\">\u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1<\/p>\n<p id=\"%E4%BA%A7%E5%93%81%E5%8E%9F%E5%9E%8B-toc\" style=\"margin-left:80px\">\u4ea7\u54c1\u539f\u578b<\/p>\n<p id=\"%E6%8E%A5%E5%8F%A3%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:80px\">\u63a5\u53e3\u8bbe\u8ba1<\/p>\n<p id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91-toc\" style=\"margin-left:40px\">\u4ee3\u7801\u5f00\u53d1<\/p>\n<p id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95-toc\" style=\"margin-left:40px\">\u529f\u80fd\u6d4b\u8bd5<\/p>\n<p id=\"%E6%B8%85%E7%A9%BA%E8%B4%AD%E7%89%A9%E8%BD%A6-toc\" style=\"margin-left:0px\">\u6e05\u7a7a\u8d2d\u7269\u8f66<\/p>\n<p id=\"%E9%9C%80%E6%B1%82%E5%88%86%E6%9E%90%E5%92%8C%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:80px\">\u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1<\/p>\n<p id=\"%E4%BA%A7%E5%93%81%E5%8E%9F%E5%9E%8B-toc\" style=\"margin-left:80px\">\u4ea7\u54c1\u539f\u578b<\/p>\n<p id=\"%E6%8E%A5%E5%8F%A3%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:80px\">\u63a5\u53e3\u8bbe\u8ba1<\/p>\n<p id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91-toc\" style=\"margin-left:80px\">\u4ee3\u7801\u5f00\u53d1<\/p>\n<p id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95-toc\" style=\"margin-left:80px\">\u529f\u80fd\u6d4b\u8bd5<\/p>\n<hr id=\"hr-toc\" \/>\n<h2 id=\"%E7%BC%93%E5%AD%98%E8%8F%9C%E5%93%81\">\u7f13\u5b58\u83dc\u54c1<\/h2>\n<h3 id=\"%E9%97%AE%E9%A2%98%E8%AF%B4%E6%98%8E\">\u95ee\u9898\u8bf4\u660e<\/h3>\n<p>\u7528\u6237\u7aef\u5c0f\u7a0b\u5e8f\u5c55\u793a\u7684\u83dc\u54c1\u6570\u636e\u90fd\u662f\u90fd\u8fc7\u67e5\u8be2\u6570\u636e\u5e93\u83b7\u5f97&#xff0c;\u5982\u679c\u8bbf\u95ee\u91cf\u6bd4\u8f83\u5927\u3002\u6570\u636e\u5e93\u8bbf\u95ee\u538b\u529b\u968f\u4e4b\u589e\u5927\u3002<\/p>\n<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"477\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164844-6971036c749c7.png\" width=\"1644\" \/><\/p>\n<h3 id=\"%E5%AE%9E%E7%8E%B0%E6%80%9D%E8%B7%AF\">\u5b9e\u73b0\u601d\u8def<\/h3>\n<p>\u901a\u8fc7Redis\u6765\u7f13\u5b58\u83dc\u54c1\u6570\u636e&#xff0c;\u51cf\u5c11\u6570\u636e\u5e93\u67e5\u8be2\u64cd\u4f5c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"489\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164844-6971036cdbde1.png\" width=\"1809\" \/><\/p>\n<p>\u7f13\u5b58\u903b\u8f91\u5206\u6790&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"890\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164845-6971036d421b8.jpg\" width=\"414\" \/><\/p>\n<ul>\n<li>\u6bcf\u4e2a\u5206\u7c7b\u4e0b\u7684\u83dc\u54c1\u4fdd\u5b58\u4e00\u4efd\u7f13\u5b58\u6570\u636e<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"141\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164845-6971036d57fc7.png\" width=\"234\" \/><\/p>\n<ul>\n<li>\u6570\u636e\u5e93\u4e2d\u83dc\u54c1\u6570\u636e\u6709\u53d8\u66f4\u65f6\u6e05\u7406\u7f13\u5b58\u6570\u636e<\/li>\n<\/ul>\n<h3 id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91\">\u4ee3\u7801\u5f00\u53d1<\/h3>\n<p>controller\u5c42\u6539\u9020\u7f13\u5b58\u83dc\u54c1\u4ee3\u7801&#xff1a;\u7528\u6237\u7aef\u67e5\u8be2\u83dc\u54c1\u6570\u636e\u65f6&#xff0c;\u82e5Redis\u4e2d\u5df2\u5b58\u5728\u83dc\u54c1\u6570\u636e\u5219\u76f4\u63a5\u8fd4\u56de&#xff0c;\u82e5\u4e0d\u5b58\u5728\u5219\u4ece\u6570\u636e\u5e93\u67e5\u8be2&#xff0c;\u5e76\u4e14\u7f13\u5b58\u5230Redis\u4e2d\u3002<\/p>\n<p>\/**<br \/>\n     * \u6839\u636e\u5206\u7c7bid\u67e5\u8be2\u83dc\u54c1<br \/>\n     *<br \/>\n     * &#064;param categoryId<br \/>\n     * &#064;return<br \/>\n     *\/<br \/>\n    &#064;GetMapping(&#034;\/list&#034;)<br \/>\n    &#064;ApiOperation(&#034;\u6839\u636e\u5206\u7c7bid\u67e5\u8be2\u83dc\u54c1&#034;)<br \/>\n    public Result&lt;List&lt;DishVO&gt;&gt; list(&#064;RequestParam Long categoryId) {<br \/>\n        \/\/\u6784\u9020redis\u4e2d\u7684key&#xff0c;\u89c4\u5219&#xff1a;dish_\u5206\u7c7bid<br \/>\n        String key &#061; &#034;dish_&#034; &#043; categoryId;<br \/>\n        \/\/\u67e5\u8be2redis\u4e2d\u662f\u5426\u5b58\u5728\u7f13\u5b58\u7684\u83dc\u54c1\u6570\u636e<br \/>\n        List&lt;DishVO&gt; list &#061; (List&lt;DishVO&gt;) redisTemplate.opsForValue().get(key);<br \/>\n        \/\/\u5982\u679c\u5b58\u5728&#xff0c;\u76f4\u63a5\u8fd4\u56de&#xff0c;\u65e0\u9700\u67e5\u8be2\u6570\u636e\u5e93<br \/>\n        if(list !&#061; null &amp;&amp; list.size() &gt; 0){<br \/>\n            return Result.success(list);<br \/>\n        }<\/p>\n<p>        Dish dish &#061; new Dish();<br \/>\n        dish.setCategoryId(categoryId);<br \/>\n        dish.setStatus(StatusConstant.ENABLE);\/\/\u67e5\u8be2\u8d77\u552e\u4e2d\u7684\u83dc\u54c1<\/p>\n<p>        \/\/\u4e0d\u5b58\u5728&#xff0c;\u6839\u636e\u5206\u7c7bid\u67e5\u8be2\u6570\u636e\u5e93&#xff0c;\u5c06\u67e5\u8be2\u5230\u7684\u83dc\u54c1\u6570\u636e\u7f13\u5b58\u5230redis\u4e2d<br \/>\n        list &#061; dishService.listWithFlavor(dish);<br \/>\n        redisTemplate.opsForValue().set(key, list);<br \/>\n        return Result.success(list);<br \/>\n    } <\/p>\n<p>\u5176\u6b21&#xff0c;\u5728\u7ba1\u7406\u7aef\u5bf9\u83dc\u54c1\u6570\u636e\u8fdb\u884c\u4fee\u6539\u3001\u5220\u9664\u548c\u8d77\u552e\u505c\u552e\u65f6&#xff0c;\u9700\u8981\u6e05\u7406\u7f13\u5b58\u6570\u636e\u3002\u56e0\u4e3a\u7ba1\u7406\u7aef\u76f4\u63a5\u64cd\u4f5c\u6570\u636e\u5e93&#xff0c;\u800c\u7528\u6237\u7aef\u67e5\u8be2\u83dc\u54c1\u6570\u636e\u65f6\u547d\u4e2d\u7f13\u5b58\u5c31\u76f4\u63a5\u8fd4\u56de&#xff0c;\u8fd9\u6837\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\u3002<\/p>\n<p>        Set keys &#061; redisTemplate.keys(&#034;dish_*&#034;);<br \/>\n        redisTemplate.delete(keys); <\/p>\n<h3 id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95\">\u529f\u80fd\u6d4b\u8bd5<\/h3>\n<p>\u901a\u8fc7\u524d\u540e\u7aef\u3001\u5c0f\u7a0b\u5e8f\u8054\u8c03\u6d4b\u8bd5\u3002<\/p>\n<h2 id=\"%E7%BC%93%E5%AD%98%E5%A5%97%E9%A4%90\">\u7f13\u5b58\u5957\u9910<\/h2>\n<h3 id=\"Spring%20Cache\">Spring Cache<\/h3>\n<p>Spring Cache\u662f\u4e00\u4e2a\u6846\u67b6&#xff0c;\u5b9e\u73b0\u4e86\u57fa\u4e8e<span style=\"color:#fe2c24\">\u6ce8\u89e3<\/span>\u7684\u7f13\u5b58\u529f\u80fd&#xff0c;\u53ea\u9700\u8981\u7b80\u5355\u5730\u52a0\u4e00\u4e2a\u6ce8\u89e3&#xff0c;\u5c31\u80fd\u5b9e\u73b0\u7f13\u5b58\u529f\u80fd\u3002 SpringCache\u63d0\u4f9b\u4e86\u4e00\u5c42\u62bd\u8c61&#xff0c;\u5e95\u5c42\u53ef\u4ee5\u5207\u6362\u4e0d\u540c\u7684\u7f13\u5b58\u5b9e\u73b0&#xff0c;\u4f8b\u5982:<\/p>\n<ul>\n<li>EHCache<\/li>\n<li>Caffeine<\/li>\n<li>Redis<\/li>\n<\/ul>\n<p>        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-cache&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt; <\/p>\n<p>\u5e38\u7528\u6ce8\u89e3&#xff1a;<\/p>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\">\n<tbody>\n<tr>\n<td>\u6ce8\u89e3<\/td>\n<td>\u8bf4\u660e<\/td>\n<\/tr>\n<tr>\n<td>&#064;EnableCaching<\/td>\n<td>\u5f00\u542f\u7f13\u5b58\u6ce8\u89e3\u529f\u80fd&#xff0c;\u901a\u5e38\u52a0\u5728\u542f\u52a8\u7c7b\u4e0a<\/td>\n<\/tr>\n<tr>\n<td>&#064;Cacheable<\/td>\n<td>\u5728\u65b9\u6cd5\u6267\u884c\u524d\u5148\u67e5\u8be2\u7f13\u5b58\u4e2d\u662f\u5426\u6709\u6570\u636e&#xff0c;\u5982\u679c\u6709\u6570\u636e&#xff0c;\u5219\u76f4\u63a5\u8fd4\u56de\u7f13\u5b58\u6570\u636e;\u5982\u679c\u6ca1\u6709\u7f13\u5b58\u6570\u636e&#xff0c;\u8c03\u7528\u65b9\u6cd5\u5e76\u5c06\u65b9\u6cd5\u8fd4\u56de\u503c\u653e\u5230\u7f13\u5b58\u4e2d&#xff08;\u65b9\u6cd5\u6267\u884c\u4e4b\u524d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&#064;CachePut<\/td>\n<td>\u5c06\u65b9\u6cd5\u7684\u8fd4\u56de\u503c\u653e\u5230\u7f13\u5b58\u4e2d&#xff08;\u65b9\u6cd5\u6267\u884c\u4e4b\u540e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&#064;CacheEvict<\/td>\n<td>\u5c06\u4e00\u6761\u6216\u591a\u6761\u6570\u636e\u4ece\u7f13\u5b58\u4e2d\u5220\u9664&#xff08;\u5148\u5220\u9664\u6570\u636e\u5e93\u3001\u518d\u5220\u9664\u7f13\u5b58&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"%E5%AE%9E%E7%8E%B0%E6%80%9D%E8%B7%AF\">\u5b9e\u73b0\u601d\u8def<\/h3>\n<p>\u5177\u4f53\u7684\u5b9e\u73b0\u601d\u8def\u5982\u4e0b:<\/p>\n<ul>\n<li>\u5bfc\u5165Spring Cache\u548cRedis\u76f8\u5173maven\u5750\u6807<\/li>\n<li>\u5728\u542f\u52a8\u7c7b\u4e0a\u52a0\u5165&#064;EnableCaching\u6ce8\u89e3&#xff0c;\u5f00\u542f\u7f13\u5b58\u6ce8\u89e3\u529f\u80fd<\/li>\n<li>\u5728\u7528\u6237\u7aef\u63a5\u53e3SetmealController\u7684<span style=\"color:#fe2c24\">list<\/span>\u65b9\u6cd5\u4e0a\u52a0\u5165&#064;Cacheable\u6ce8\u89e3<\/li>\n<li>\u5728\u7ba1\u7406\u7aef\u63a5\u53e3SetmealController\u7684<span style=\"color:#fe2c24\">save\u3001 delete\u3001update\u3001 startOrStop<\/span>\u7b49\u65b9\u6cd5\u4e0a\u52a0\u5165CacheEvict\u6ce8\u89e3<\/li>\n<\/ul>\n<h3 id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91\">\u4ee3\u7801\u5f00\u53d1<\/h3>\n<p>\u6309\u7167\u5b9e\u73b0\u601d\u8def\u6dfb\u52a0\u5373\u53ef\u3002<\/p>\n<h3 id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95\">\u529f\u80fd\u6d4b\u8bd5<\/h3>\n<p>\u524d\u540e\u7aef\u8054\u8c03\u6d4b\u8bd5\u3001\u4e0e\u5c0f\u7a0b\u5e8f\u8054\u8c03\u6d4b\u8bd5\u5373\u53ef\u3002<\/p>\n<h2 id=\"%E6%B7%BB%E5%8A%A0%E8%B4%AD%E7%89%A9%E8%BD%A6\">\u6dfb\u52a0\u8d2d\u7269\u8f66<\/h2>\n<h3 id=\"%E9%9C%80%E6%B1%82%E5%88%86%E6%9E%90%E4%B8%8E%E8%AE%BE%E8%AE%A1\">\u9700\u6c42\u5206\u6790\u4e0e\u8bbe\u8ba1<\/h3>\n<h4 id=\"%E4%BA%A7%E5%93%81%E5%8E%9F%E5%9E%8B\">\u4ea7\u54c1\u539f\u578b<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"744\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164845-6971036d6320f.png\" width=\"438\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"642\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164845-6971036d78300.png\" width=\"1350\" \/><\/p>\n<h4 id=\"%E6%8E%A5%E5%8F%A3%E8%AE%BE%E8%AE%A1\">\u63a5\u53e3\u8bbe\u8ba1<\/h4>\n<ul>\n<li>\u8bf7\u6c42\u65b9\u5f0f:POST<\/li>\n<li>\u8bf7\u6c42\u8def\u5f84:\/user\/shoppingCart\/add<\/li>\n<li>\u8bf7\u6c42\u53c2\u6570:\u5957\u9910id\u3001\u83dc\u54c1id\u3001\u53e3\u5473<\/li>\n<li>\u8fd4\u56de\u7ed3\u679c:code\u3001data\u3001msg<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"735\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164845-6971036dcfce0.png\" width=\"1239\" \/><\/p>\n<h4 id=\"%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1\">\u6570\u636e\u5e93\u8bbe\u8ba1<\/h4>\n<ul>\n<li>\u4f5c\u7528:\u6682\u65f6\u5b58\u653e\u6240\u9009\u5546\u54c1\u7684\u5730\u65b9<\/li>\n<li>\u9009\u7684\u4ec0\u4e48\u5546\u54c1<\/li>\n<li>\u6bcf\u4e2a\u5546\u54c1\u90fd\u4e70\u4e86\u51e0\u4e2a<\/li>\n<li>\u4e0d\u540c\u7528\u6237\u7684\u8d2d\u7269\u8f66\u9700\u8981\u533a\u5206\u5f00<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"695\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164846-6971036e2bbe3.png\" width=\"1374\" \/><\/p>\n<h3 id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91\">\u4ee3\u7801\u5f00\u53d1<\/h3>\n<p>controller\u5c42&#xff1a;<\/p>\n<p>package com.sky.controller.user;<\/p>\n<p>import com.sky.dto.ShoppingCartDTO;<br \/>\nimport com.sky.result.Result;<br \/>\nimport com.sky.service.ShoppingCartService;<br \/>\nimport io.swagger.annotations.Api;<br \/>\nimport io.swagger.annotations.ApiOperation;<br \/>\nimport lombok.extern.slf4j.Slf4j;<br \/>\nimport org.springframework.beans.factory.annotation.Autowired;<br \/>\nimport org.springframework.web.bind.annotation.PostMapping;<br \/>\nimport org.springframework.web.bind.annotation.RequestBody;<br \/>\nimport org.springframework.web.bind.annotation.RequestMapping;<br \/>\nimport org.springframework.web.bind.annotation.RestController;<\/p>\n<p>&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/user\/shoppingCart&#034;)<br \/>\n&#064;Api(tags &#061; &#034;C\u7aef-\u8d2d\u7269\u8f66\u63a5\u53e3&#034;)<br \/>\n&#064;Slf4j<br \/>\npublic class ShoppingCartController {<\/p>\n<p>    &#064;Autowired<br \/>\n    private ShoppingCartService shoppingCartService;<br \/>\n    \/**<br \/>\n     * \u6dfb\u52a0\u8d2d\u7269\u8f66<br \/>\n     * &#064;return<br \/>\n     *\/<br \/>\n    &#064;PostMapping(&#034;\/add&#034;)<br \/>\n    &#064;ApiOperation(&#034;\u6dfb\u52a0\u8d2d\u7269\u8f66&#034;)<br \/>\n    public Result add(&#064;RequestBody ShoppingCartDTO shoppingCartDTO) {<br \/>\n        log.info(&#034;\u6dfb\u52a0\u8d2d\u7269\u8f66&#xff1a;{}&#034;, shoppingCartDTO);<br \/>\n        shoppingCartService.add(shoppingCartDTO);<br \/>\n        return null;<br \/>\n    }<\/p>\n<p>}<\/p>\n<p>service\u5c42&#xff1a;<\/p>\n<p>package com.sky.service.impl;<\/p>\n<p>import com.sky.context.BaseContext;<br \/>\nimport com.sky.dto.ShoppingCartDTO;<br \/>\nimport com.sky.entity.Dish;<br \/>\nimport com.sky.entity.Setmeal;<br \/>\nimport com.sky.entity.SetmealDish;<br \/>\nimport com.sky.entity.ShoppingCart;<br \/>\nimport com.sky.mapper.DishMapper;<br \/>\nimport com.sky.mapper.SetmealDishMapper;<br \/>\nimport com.sky.mapper.ShoppingCartMapper;<br \/>\nimport com.sky.service.ShoppingCartService;<br \/>\nimport org.springframework.beans.BeanUtils;<br \/>\nimport org.springframework.beans.factory.annotation.Autowired;<br \/>\nimport org.springframework.stereotype.Service;<\/p>\n<p>import java.time.LocalDateTime;<br \/>\nimport java.util.List;<\/p>\n<p>&#064;Service<br \/>\npublic class ShoppingCartServiceImpl implements ShoppingCartService {<\/p>\n<p>    &#064;Autowired<br \/>\n    private ShoppingCartMapper shoppingCartMapper;<br \/>\n    &#064;Autowired<br \/>\n    private DishMapper dishMapper;<br \/>\n    &#064;Autowired<br \/>\n    private SetmealDishMapper setmealDishMapper;<\/p>\n<p>    \/**<br \/>\n     * \u6dfb\u52a0\u8d2d\u7269\u8f66<br \/>\n     * &#064;param shoppingCartDTO<br \/>\n     *\/<br \/>\n    public void add(ShoppingCartDTO shoppingCartDTO) {<br \/>\n        \/\/\u5224\u65ad\u5f53\u524d\u8d2d\u7269\u8f66\u5df2\u7ecf\u5b58\u5728<br \/>\n        ShoppingCart shoppingCart &#061; new ShoppingCart();<br \/>\n        BeanUtils.copyProperties(shoppingCartDTO, shoppingCart);<br \/>\n        \/\/\u5728\u5c0f\u7a0b\u5e8f\u4f20\u8fc7\u6765\u7684\u6570\u636e\u4e2d&#xff0c;\u6ca1\u6709userId&#xff0c;\u9700\u8981\u624b\u52a8\u8bbe\u7f6e<br \/>\n        \/\/\u6bcf\u6b21\u7528\u6237\u53d1\u8d77\u8bf7\u6c42\u4f1a\u643a\u5e26\u4e00\u4e2atoken,\u62e6\u622a\u5668\u4f1a\u83b7\u53d6\u8fd9\u4e2atoken&#xff0c;\u83b7\u53d6\u5f53\u524d\u767b\u5f55\u7528\u6237\u7684ID<br \/>\n        shoppingCart.setUserId(BaseContext.getCurrentId());<br \/>\n        List&lt;ShoppingCart&gt; list &#061; shoppingCartMapper.list(shoppingCart);<br \/>\n        \/\/\u82e5\u5df2\u7ecf\u5b58\u5728&#xff0c;\u53ea\u9700\u6570\u91cf\u52a01<br \/>\n        if(list !&#061; null &amp;&amp; list.size() &gt; 0){<br \/>\n            \/\/\u4e3a\u4ec0\u4e48\u8fd9\u6837\u8bbe\u7f6e\u6570\u636e&#xff1f;<br \/>\n            ShoppingCart cart &#061; list.get(0);<br \/>\n            cart.setNumber(cart.getNumber() &#043; 1);<br \/>\n            shoppingCartMapper.updateNumberById(cart);<br \/>\n        }<br \/>\n        \/\/\u82e5\u4e0d\u5b58\u5728&#xff0c;\u5219\u6dfb\u52a0\u5230\u8d2d\u7269\u8f66&#xff0c;\u6570\u91cf\u9ed8\u8ba4\u4e3a1<br \/>\n        else{<\/p>\n<p>            \/\/\u672c\u6b21\u6dfb\u52a0\u7684\u662f\u83dc\u54c1\u6570\u636e&#xff0c;\u5219\u9700\u8981\u63d2\u5165\u83dc\u54c1\u6570\u636e<br \/>\n            Long dishId &#061; shoppingCartDTO.getDishId();<br \/>\n            if(dishId !&#061; null){<br \/>\n                Dish dish &#061; dishMapper.getById(dishId);<br \/>\n                shoppingCart.setName(dish.getName());<br \/>\n                shoppingCart.setImage(dish.getImage());<br \/>\n                shoppingCart.setAmount(dish.getPrice());<\/p>\n<p>            }<br \/>\n            \/\/\u672c\u6b21\u6dfb\u52a0\u7684\u662f\u5957\u9910\u6570\u636e&#xff0c;\u5219\u9700\u8981\u63d2\u5165\u5957\u9910\u6570\u636e<br \/>\n            else{<br \/>\n                Long setmealId &#061; shoppingCartDTO.getSetmealId();<br \/>\n                Setmeal setmeal &#061; setmealDishMapper.getById(setmealId);<br \/>\n                shoppingCart.setName(setmeal.getName());<br \/>\n                shoppingCart.setImage(setmeal.getImage());<br \/>\n                shoppingCart.setAmount(setmeal.getPrice());<br \/>\n            }<br \/>\n            shoppingCart.setNumber(1);<br \/>\n            shoppingCart.setCreateTime(LocalDateTime.now());<br \/>\n            shoppingCartMapper.insert(shoppingCart);<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>Mapper\u5c42&#xff1a;<\/p>\n<p>&lt;insert id&#061;&#034;insert&#034;&gt;<br \/>\n        insert into shopping_cart (user_id, dish_id, setmeal_id, dish_flavor, number, create_time, amount, image, name)<br \/>\n        values (#{userId}, #{dishId}, #{setmealId}, #{dishFlavor}, #{number}, #{createTime}, #{amount}, #{image}, #{name})<br \/>\n&lt;\/insert&gt; <\/p>\n<h3 id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95\">\u529f\u80fd\u6d4b\u8bd5<\/h3>\n<p>\u6d4b\u8bd5\u6dfb\u52a0\u8d2d\u7269\u8f66&#xff0c;\u540c\u4e00\u83dc\u54c1\u4e0d\u540c\u53e3\u5473\u4ee5\u53ca\u5957\u9910\u3002<\/p>\n<h2 id=\"%E6%9F%A5%E7%9C%8B%E8%B4%AD%E7%89%A9%E8%BD%A6\">\u67e5\u770b\u8d2d\u7269\u8f66<\/h2>\n<h3 id=\"%E9%9C%80%E6%B1%82%E5%88%86%E6%9E%90%E5%92%8C%E8%AE%BE%E8%AE%A1\">\u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1<\/h3>\n<h4 id=\"%E4%BA%A7%E5%93%81%E5%8E%9F%E5%9E%8B\">\u4ea7\u54c1\u539f\u578b<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"761\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164846-6971036e751be.png\" width=\"426\" \/><\/p>\n<h4 id=\"%E6%8E%A5%E5%8F%A3%E8%AE%BE%E8%AE%A1\">\u63a5\u53e3\u8bbe\u8ba1<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"756\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164846-6971036e8b291.png\" width=\"1419\" \/><\/p>\n<h3 id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91\">\u4ee3\u7801\u5f00\u53d1<\/h3>\n<p>controller:<\/p>\n<p>    \/**<br \/>\n     *  \u67e5\u770b\u8d2d\u7269\u8f66<br \/>\n     * &#064;return<br \/>\n     *\/<br \/>\n    &#064;GetMapping(&#034;\/list&#034;)<br \/>\n    &#064;ApiOperation(&#034;\u67e5\u770b\u8d2d\u7269\u8f66&#034;)<br \/>\n    public Result&lt;List&lt;ShoppingCart&gt;&gt; list(){<br \/>\n        log.info(&#034;\u67e5\u770b\u8d2d\u7269\u8f66&#034;);<br \/>\n        List&lt;ShoppingCart&gt; list &#061; shoppingCartService.list();<br \/>\n        return Result.success(list);<br \/>\n    } <\/p>\n<p>service:<\/p>\n<p>\/**<br \/>\n     * \u67e5\u770b\u8d2d\u7269\u8f66<br \/>\n     * &#064;return<br \/>\n     *\/<br \/>\n    public List&lt;ShoppingCart&gt; list() {<br \/>\n        \/\/\u83b7\u5f97\u5f53\u524d\u7528\u6237id<br \/>\n        Long userId &#061; BaseContext.getCurrentId();<br \/>\n        ShoppingCart shoppingCart &#061; new ShoppingCart();<br \/>\n        shoppingCart.setUserId(userId);<br \/>\n        List&lt;ShoppingCart&gt; list &#061; shoppingCartMapper.list(shoppingCart);<br \/>\n        return list;<br \/>\n    } <\/p>\n<p>Mapper:<\/p>\n<p>&lt;select id&#061;&#034;list&#034; resultType&#061;&#034;com.sky.entity.ShoppingCart&#034;&gt;<br \/>\n        select * from shopping_cart<br \/>\n        &lt;where&gt;<br \/>\n            &lt;if test&#061;&#034;userId !&#061; null&#034;&gt;<br \/>\n                and user_id &#061; #{userId}<br \/>\n            &lt;\/if&gt;<br \/>\n            &lt;if test&#061;&#034;dishId !&#061; null&#034;&gt;<br \/>\n                and dish_id &#061; #{dishId}<br \/>\n            &lt;\/if&gt;<br \/>\n            &lt;if test&#061;&#034;setmealId !&#061; null&#034;&gt;<br \/>\n                and setmeal_id &#061; #{setmealId}<br \/>\n            &lt;\/if&gt;<br \/>\n            &lt;if test&#061;&#034;dishFlavor !&#061; null&#034;&gt;<br \/>\n                and dish_flavor &#061; #{dishFlavor}<br \/>\n            &lt;\/if&gt;<br \/>\n        &lt;\/where&gt;<br \/>\n    &lt;\/select&gt; <\/p>\n<h3 id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95\">\u529f\u80fd\u6d4b\u8bd5<\/h3>\n<p>\u524d\u540e\u7aef\u8054\u8c03\u6d4b\u8bd5<\/p>\n<h2 id=\"%E6%B8%85%E7%A9%BA%E8%B4%AD%E7%89%A9%E8%BD%A6\">\u6e05\u7a7a\u8d2d\u7269\u8f66<\/h2>\n<h4 id=\"%E9%9C%80%E6%B1%82%E5%88%86%E6%9E%90%E5%92%8C%E8%AE%BE%E8%AE%A1\">\u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1<\/h4>\n<h4 id=\"%E4%BA%A7%E5%93%81%E5%8E%9F%E5%9E%8B\">\u4ea7\u54c1\u539f\u578b<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"759\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164846-6971036edbc5b.png\" width=\"450\" \/><\/p>\n<h4 id=\"%E6%8E%A5%E5%8F%A3%E8%AE%BE%E8%AE%A1\">\u63a5\u53e3\u8bbe\u8ba1<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"705\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164846-6971036ef1965.png\" width=\"666\" \/><\/p>\n<h4 id=\"%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91\">\u4ee3\u7801\u5f00\u53d1<\/h4>\n<p>\u53ef\u6839\u636e\u63a5\u53e3\u8bbe\u8ba1\u6765\u5f00\u53d1&#xff0c;\u53ef\u4ee5\u953b\u70bc\u4e00\u4e0b\u3002<\/p>\n<h4 id=\"%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95\">\u529f\u80fd\u6d4b\u8bd5<\/h4>\n<p>\u524d\u540e\u7aef\u8054\u8c03\u6d4b\u8bd5\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55 \u7f13\u5b58\u83dc\u54c1<br \/>\n\u95ee\u9898\u8bf4\u660e<br \/>\n\u5b9e\u73b0\u601d\u8def<br \/>\n\u4ee3\u7801\u5f00\u53d1<br \/>\n\u529f\u80fd\u6d4b\u8bd5<br \/>\n\u7f13\u5b58\u5957\u9910<br \/>\nSpring Cache<br \/>\n\u5b9e\u73b0\u601d\u8def<br \/>\n\u4ee3\u7801\u5f00\u53d1<br \/>\n\u529f\u80fd\u6d4b\u8bd5<br \/>\n\u6dfb\u52a0\u8d2d\u7269\u8f66<br \/>\n\u9700\u6c42\u5206\u6790\u4e0e\u8bbe\u8ba1<br \/>\n\u4ea7\u54c1\u539f\u578b<br \/>\n\u63a5\u53e3\u8bbe\u8ba1<br \/>\n\u6570\u636e\u5e93\u8bbe\u8ba1<br \/>\n\u4ee3\u7801\u5f00\u53d1<br \/>\n\u529f\u80fd\u6d4b\u8bd5<br \/>\n\u67e5\u770b\u8d2d\u7269\u8f66<br \/>\n\u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1<br \/>\n\u4ea7\u54c1\u539f\u578b<br \/>\n\u63a5\u53e3\u8bbe\u8ba1<br \/>\n\u4ee3\u7801\u5f00\u53d1<br \/>\n\u529f\u80fd\u6d4b\u8bd5<br \/>\n\u6e05\u7a7a\u8d2d\u7269\u8f66<br \/>\n\u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1<br \/>\n\u4ea7\u54c1\u539f\u578b<br \/>\n\u63a5\u53e3\u8bbe\u8ba1<br \/>\n\u4ee3\u7801\u5f00\u53d1<br \/>\n\u529f\u80fd\u6d4b\u8bd5 \u7f13\u5b58\u83dc\u54c1<br \/>\n\u95ee\u9898\u8bf4\u660e<br \/>\n\u7528\u6237\u7aef\u5c0f\u7a0b\u5e8f\u5c55\u793a\u7684\u83dc\u54c1\u6570\u636e\u90fd\u662f\u90fd\u8fc7\u67e5\u8be2\u6570\u636e\u5e93\u83b7\u5f97&amp;#xff0c<\/p>\n","protected":false},"author":2,"featured_media":63457,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[398],"topic":[],"class_list":["post-63469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-398"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/63469.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 \u7f13\u5b58\u83dc\u54c1 \u95ee\u9898\u8bf4\u660e \u5b9e\u73b0\u601d\u8def \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u7f13\u5b58\u5957\u9910 Spring Cache \u5b9e\u73b0\u601d\u8def \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u6dfb\u52a0\u8d2d\u7269\u8f66 \u9700\u6c42\u5206\u6790\u4e0e\u8bbe\u8ba1 \u4ea7\u54c1\u539f\u578b \u63a5\u53e3\u8bbe\u8ba1 \u6570\u636e\u5e93\u8bbe\u8ba1 \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u67e5\u770b\u8d2d\u7269\u8f66 \u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1 \u4ea7\u54c1\u539f\u578b \u63a5\u53e3\u8bbe\u8ba1 \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u6e05\u7a7a\u8d2d\u7269\u8f66 \u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1 \u4ea7\u54c1\u539f\u578b \u63a5\u53e3\u8bbe\u8ba1 \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u7f13\u5b58\u83dc\u54c1 \u95ee\u9898\u8bf4\u660e \u7528\u6237\u7aef\u5c0f\u7a0b\u5e8f\u5c55\u793a\u7684\u83dc\u54c1\u6570\u636e\u90fd\u662f\u90fd\u8fc7\u67e5\u8be2\u6570\u636e\u5e93\u83b7\u5f97&amp;#xff0c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/63469.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-21T16:48:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164844-6971036c749c7.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63469.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/63469.html\",\"name\":\"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-21T16:48:48+00:00\",\"dateModified\":\"2026-01-21T16:48:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/63469.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/63469.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63469.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/63469.html","og_locale":"zh_CN","og_type":"article","og_title":"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 \u7f13\u5b58\u83dc\u54c1 \u95ee\u9898\u8bf4\u660e \u5b9e\u73b0\u601d\u8def \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u7f13\u5b58\u5957\u9910 Spring Cache \u5b9e\u73b0\u601d\u8def \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u6dfb\u52a0\u8d2d\u7269\u8f66 \u9700\u6c42\u5206\u6790\u4e0e\u8bbe\u8ba1 \u4ea7\u54c1\u539f\u578b \u63a5\u53e3\u8bbe\u8ba1 \u6570\u636e\u5e93\u8bbe\u8ba1 \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u67e5\u770b\u8d2d\u7269\u8f66 \u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1 \u4ea7\u54c1\u539f\u578b \u63a5\u53e3\u8bbe\u8ba1 \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u6e05\u7a7a\u8d2d\u7269\u8f66 \u9700\u6c42\u5206\u6790\u548c\u8bbe\u8ba1 \u4ea7\u54c1\u539f\u578b \u63a5\u53e3\u8bbe\u8ba1 \u4ee3\u7801\u5f00\u53d1 \u529f\u80fd\u6d4b\u8bd5 \u7f13\u5b58\u83dc\u54c1 \u95ee\u9898\u8bf4\u660e \u7528\u6237\u7aef\u5c0f\u7a0b\u5e8f\u5c55\u793a\u7684\u83dc\u54c1\u6570\u636e\u90fd\u662f\u90fd\u8fc7\u67e5\u8be2\u6570\u636e\u5e93\u83b7\u5f97&amp;#xff0c","og_url":"https:\/\/www.wsisp.com\/helps\/63469.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-21T16:48:48+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121164844-6971036c749c7.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/63469.html","url":"https:\/\/www.wsisp.com\/helps\/63469.html","name":"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-21T16:48:48+00:00","dateModified":"2026-01-21T16:48:48+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/63469.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/63469.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/63469.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u82cd\u7a79\u5916\u5356-\u7f13\u5b58\u5546\u54c1\u3001\u8d2d\u7269\u8f66"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/63469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=63469"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/63469\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/63457"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=63469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=63469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=63469"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=63469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}