{"id":907,"date":"2024-10-08T16:32:40","date_gmt":"2024-10-08T08:32:40","guid":{"rendered":"https:\/\/www.coffecat.cn\/?p=907"},"modified":"2024-10-09T12:17:00","modified_gmt":"2024-10-09T04:17:00","slug":"%e9%a1%b9%e7%9b%ae%e5%ae%9e%e6%88%98%e8%ae%b0%e5%bd%95-%e3%80%90%e7%94%a8%e6%88%b7%e4%b8%ad%e5%bf%83%e9%a1%b9%e7%9b%ae%e3%80%91%e7%94%a8%e6%88%b7%e4%b8%ad%e5%bf%83%e5%90%8e%e7%ab%af%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"https:\/\/www.coffecat.cn\/index.php\/2024\/10\/08\/%e9%a1%b9%e7%9b%ae%e5%ae%9e%e6%88%98%e8%ae%b0%e5%bd%95-%e3%80%90%e7%94%a8%e6%88%b7%e4%b8%ad%e5%bf%83%e9%a1%b9%e7%9b%ae%e3%80%91%e7%94%a8%e6%88%b7%e4%b8%ad%e5%bf%83%e5%90%8e%e7%ab%af%e5%bc%80%e5%8f%91\/","title":{"rendered":"\u9879\u76ee\u5b9e\u6218\u8bb0\u5f55 -\u3010\u7528\u6237\u4e2d\u5fc3\u9879\u76ee\u3011\u7528\u6237\u4e2d\u5fc3\u540e\u7aef\u5f00\u53d1"},"content":{"rendered":"\n<p>\u540e\u7aef\u6280\u672f\u6808\uff1a<\/p>\n\n\n\n<p>Spring + SpringMVC + SpringBoot + MyBatis + MyBatis Plus + MySQL&nbsp;<\/p>\n\n\n\n<p>\u6574\u7406\u6765\u8bf4\u6bd4\u8f83\u7b80\u5355\uff0c\u4e5f\u6ca1\u6709\u7528\u5230\u7f13\u5b58\uff0c\u540e\u9762\u6709\u9700\u8981\u53ef\u4ee5\u968f\u65f6\u6dfb\u52a0<\/p>\n\n\n\n<p>\u6839\u636e\u524d\u7aef\u9875\u9762\u53ef\u4ee5\u770b\u51fa\uff0c\u9700\u8981\u767b\u5f55\uff0c\u6ce8\u518c\uff0c\u4ee5\u53ca\u4e00\u4e2a\u67e5\u8be2\u9875\u4e2d\u7684\u67e5\u6539\u63a5\u53e3\uff0c\u9664\u4e86\u4e1a\u52a1\u76f8\u5173\u8fd8\u9700\u8981\u5b9a\u4e49\u5168\u5c40\u7edf\u4e00\u5f02\u5e38\u5904\u7406\uff0c\u7edf\u4e00\u8fd4\u56de\u7c7b\u4ee5\u53ca\u81ea\u5b9a\u4e49\u5f02\u5e38\u6765\u7edf\u4e00\u6574\u4f53\u540e\u7aef\u9879\u76ee\u7684\u89c4\u8303\uff0c\u5165\u53c2\u4e0e\u56de\u53c2\u7684\u7ed3\u6784\u53ef\u4ee5\u6839\u636e\u524d\u540e\u7aef\u8ba8\u8bba\u540e\u7684\u7ed3\u6784\u8fdb\u884c\u7f16\u5199\u3002<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>\u6a21\u578b\u521b\u5efa<\/strong><\/p>\n\n\n\n<p>\u6a21\u578b\u8fd9\u91cc\u662f\u7528\u4e86\u4e00\u4e2a\u56fd\u4ea7\u7684\u5efa\u6a21\u5de5\u5177PDManer\u521b\u5efa\u7684\uff0c\u5b98\u7f51\u94fe\u63a5\u3010<a href=\"https:\/\/www.pdmaas.cn\/home\">https:\/\/www.pdmaas.cn\/home<\/a>\u3011\uff0c\u6253\u5f00\u8f6f\u4ef6\u540e\u53ef\u4ee5\u9009\u62e9\u65b0\u521b\u5efa\u4e00\u4e2a\u9879\u76ee\uff0c\u5982\u679c\u5df2\u7ecf\u6709\u9879\u76ee\u4e5f\u53ef\u4ee5\u9009\u62e9\u6253\u5f00<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"408\" height=\"726\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-40.png\" alt=\"\" class=\"wp-image-979\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-40.png 408w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-40-169x300.png 169w\" sizes=\"auto, (max-width: 408px) 100vw, 408px\" \/><\/figure>\n\n\n\n<p>\u521b\u5efa\u597d\u540e\u53ef\u4ee5\u5728\u6a21\u578b\u4e2d\u7684\u6570\u636e\u8868\u533a\u57df\u9009\u62e9\u521b\u5efa\u65b0\u7684\u6a21\u578b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"595\" height=\"473\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-41.png\" alt=\"\" class=\"wp-image-980\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-41.png 595w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-41-300x238.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/figure>\n\n\n\n<p>\u4e5f\u53ef\u4ee5\u901a\u8fc7\u6570\u636e\u5e93\u8fdb\u884c\u9009\u62e9\uff0c\u70b9\u51fb\u4e0a\u65b9\u5bfc\u822a\u680f\u4e2d\u7684\u6570\u636e\u5e93<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"87\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-42.png\" alt=\"\" class=\"wp-image-981\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-42.png 872w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-42-300x30.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-42-768x77.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u5728\u5f39\u51fa\u7684\u6570\u636e\u5e93\u8fde\u63a5\u914d\u7f6e\u4e2d\u6dfb\u52a0\u6570\u636e\u5e93\u8fde\u63a5<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"347\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-43-1024x347.png\" alt=\"\" class=\"wp-image-982\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-43-1024x347.png 1024w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-43-300x102.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-43-768x260.png 768w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-43.png 1396w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u6dfb\u52a0\u6570\u636e\u6e90\u8fde\u63a5\u540e\u5728\u5bfc\u822a\u680f\u4e2d\u9009\u62e9\u4ece\u6570\u636e\u5e93\u5bfc\u5165\uff0c\u7136\u540e\u9009\u62e9\u6211\u4eec\u9700\u8981\u5bfc\u5165\u7684\u8868\u70b9\u51fb\u5bfc\u5165\u5c31\u5b8c\u6210\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"728\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-46.png\" alt=\"\" class=\"wp-image-985\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-46.png 960w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-46-300x228.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-46-768x582.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u5bf9\u4e8e\u6a21\u578b\u7531\u4e8e\u662f\u5355\u8868\u64cd\u4f5c\uff0c\u6240\u4ee5\u5c31\u4e0d\u7ec6\u8bb2\u5b57\u6bb5\u4e86\uff0c\u9664\u4e86\u4eba\u5458\u4e2a\u4eba\u4fe1\u606f\u5b57\u6bb5\u5916\u8fd8\u6dfb\u52a0\u4e86\u7528\u6237\u72b6\u6001\uff08\u6839\u636e\u7528\u6237\u72b6\u6001\u5224\u65ad\u7528\u6237\u662f\u5426\u88ab\u5c01\u7981\u4ece\u800c\u9650\u5236\u767b\u5f55\u6216\u90e8\u5206\u529f\u80fd\uff09\uff0c\u7528\u6237\u89d2\u8272\uff08\u5224\u65ad\u7528\u6237\u662f\u5426\u4e3a\u7ba1\u7406\u5458\uff0c\u4ece\u800c\u533a\u5206\u7528\u6237\u80fd\u770b\u5230\u7684\u76ee\u5f55\uff09\u4ee5\u53ca\u901a\u7528\u5b57\u6bb5<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"is_delete   \u662f\u5426\u5220\u9664\uff0c\u9ed8\u8ba4\u503c\u4e3a 0\ncreate_time \u521b\u5efa\u65f6\u95f4\ncreate_by   \u521b\u5efa\u4eba\nupdate_time \u4fee\u6539\u65f6\u95f4\nupdate_by   \u4fee\u6539\u4eba\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">is_delete   \u662f\u5426\u5220\u9664\uff0c\u9ed8\u8ba4\u503c\u4e3a 0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">create_time \u521b\u5efa\u65f6\u95f4<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">create_by   \u521b\u5efa\u4eba<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">update_time \u4fee\u6539\u65f6\u95f4<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">update_by   \u4fee\u6539\u4eba<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u6a21\u578b\u521b\u5efa\u597d\u540e\u9009\u62e9\u6570\u636e\u8868\u6700\u53f3\u8fb9\u7684\u7a0b\u5e8f\u4ee3\u7801<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"428\" height=\"72\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-47.png\" alt=\"\" class=\"wp-image-991\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-47.png 428w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-47-300x50.png 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u4f1a\u63d0\u4f9b\u751f\u6210\u591a\u79cd\u8bed\u8a00\u7684\u4ee3\u7801\uff0c\u6211\u4eec\u9009\u62e9\u6211\u4eec\u9700\u8981\u7684MybatisPlus<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"115\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-48.png\" alt=\"\" class=\"wp-image-993\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-48.png 786w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-48-300x44.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-48-768x112.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u770b\u5230\u4ee3\u7801\u751f\u6210\u5668\u7ed9\u51fa\u4e86\u51e0\u4e4e\u6240\u6709\u7684\u4ee3\u7801\uff0c\u5e76\u4e14\u5b8c\u6210\u4e86\u6240\u6709\u7684\u589e\u5220\u6539\u67e5\u63a5\u53e3\u7684\u5b9e\u73b0\uff0c\u5728\u8def\u5f84\u53ca\u53d8\u91cf\u4e2d\u53ef\u4ee5\u5bf9\u547d\u540d\u7a7a\u95f4\u8fdb\u884c\u8c03\u6574\u4ee5\u53ca\u751f\u6210\u7684\u6587\u4ef6\u4fdd\u5b58\u4f4d\u7f6e\uff0c\u8c03\u6574\u597d\u540e\u53ef\u4ee5\u70b9\u51fb\u751f\u6210\u751f\u6210\u6240\u6709\u6587\u4ef6\u4e5f\u53ef\u4ee5\u9700\u8981\u54ea\u90e8\u5206\u76f4\u63a5\u590d\u5236\u54ea\u90e8\u5206\u7684\u4ee3\u7801\uff0c\u6211\u8ba4\u4e3a\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u597d\u7528\u7684\u5de5\u5177\uff0c\u8fd9\u4e2a\u5de5\u5177\u4e5f\u662f\u4e4b\u524d\u4e0a\u73ed\u65f6\u540c\u4e8b\u5206\u4eab\u7684\uff0c\u975e\u5e38\u611f\u8c22\u4e4b\u524d\u7684\u540c\u4e8b\uff0c\u8ba9\u901a\u7528\u4ee3\u7801\u7684\u7f16\u5199\u53d8\u7684\u66f4\u9ad8\u6548<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"182\" height=\"323\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-49.png\" alt=\"\" class=\"wp-image-995\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-49.png 182w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-49-169x300.png 169w\" sizes=\"auto, (max-width: 182px) 100vw, 182px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>\u73af\u5883\u4e0e\u9879\u76ee\u642d\u5efa<\/strong><\/p>\n\n\n\n<p>\u7531\u4e8e\u5728\u524d\u7aef\u7bc7\u5df2\u7ecf\u8bb2\u8fc7\u4e86\u73af\u5883\u53d8\u91cf\u7684\u914d\u7f6e\uff0c\u6240\u4ee5\u8fd9\u91cc\u4e0d\u518d\u91cd\u590d\u8bb2\u89e3\u73af\u5883\u53d8\u91cf\u7684\u914d\u7f6e\uff0c\u8fd9\u91cc\u540c\u65f6\u7ed9\u51fa\u83dc\u9e1f\u6559\u7a0b\u7684\u914d\u7f6e\u3010<a href=\"https:\/\/www.runoob.com\/java\/java-environment-setup.html\">Java \u5f00\u53d1\u73af\u5883\u914d\u7f6e | \u83dc\u9e1f\u6559\u7a0b (runoob.com)<\/a>\u3011\uff0cmaven\u73af\u5883\u8fd9\u91cc\u4f7f\u7528\u7684\u662f3.6.3\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u75283.5.3\u7684\u7248\u672c\uff0c\u5982\u679c\u5728\u5f15\u5165\u4f9d\u8d56\u6bd4\u8f83\u6162\u7684\u8bdd\u53ef\u4ee5\u4fee\u6539maven-conf-settings.xml\u6587\u4ef6\uff0c\u5c06\u6587\u4ef6\u4e2d\u7684\u6e90\u6539\u4e3a\u56fd\u5185\u955c\u50cf\uff0c\u8fd9\u91cc\u53ef\u4ee5\u53c2\u8003csdn\u4e0a\u7684\u914d\u7f6e\u6559\u7a0b\u3010<a href=\"https:\/\/blog.csdn.net\/2301_78992368\/article\/details\/134541150\">Maven\u914d\u7f6e\u6559\u7a0b_maven\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u6559\u7a0b-CSDN\u535a\u5ba2<\/a>\u3011\uff0c\u6211\u8fd9\u91cc\u4f7f\u7528\u7684\u662f\u6211\u670d\u52a1\u5668\u4e0a\u7684\u6570\u636e\u5e93\uff0c\u5982\u679c\u4f60\u6ca1\u6709\u670d\u52a1\u5668\u53ef\u4ee5\u5728\u672c\u5730\u5b89\u88c5\u4e00\u4e2a\u672c\u5730\u7684mysql\u6570\u636e\u5e93\uff0c\u5982\u679c\u4f60\u662f\u5728\u672c\u5730\u5b89\u88c5\u53ef\u4ee5\u53c2\u8003csdn\u6559\u7a0b\u3010<a href=\"https:\/\/blog.csdn.net\/m0_62854966\/article\/details\/142455428\">MySQL \u6570\u636e\u5e93\u5b89\u88c5\uff08\u8be6\u7ec6\u6559\u7a0b\uff09\u30102024 \u7248\u3011_mysql\u6570\u636e\u5e93\u5b89\u88c5-CSDN\u535a\u5ba2<\/a>\u3011\uff0c\u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u6bcf\u4e2a\u4eba\u7684\u7535\u8111\u7cfb\u7edf\u7248\u672c\u4e0e\u7cfb\u7edf\u73af\u5883\u90fd\u6709\u5dee\u5f02\u6240\u4ee5\u53ef\u80fd\u4f1a\u5b58\u5728\u4e00\u4e9b\u5751\uff0c\u6839\u636e\u6bcf\u4e2a\u4eba\u4e0d\u540c\u7684\u62a5\u9519\u8fdb\u884c\u641c\u7d22\u5927\u6982\u7387\u53ef\u4ee5\u89e3\u51b3\uff0c\u5982\u9047\u5230\u7248\u672c\u95ee\u9898\u9700\u8981\u91cd\u65b0\u5b89\u88c5mysql\u6570\u636e\u5e93\u7684\uff0c\u8bb0\u5f97\u8981\u628a\u4e4b\u524d\u5b89\u88c5\u7684\u5378\u8f7d\u5220\u9664\u5e72\u51c0\uff08\u5305\u542b\u4f46\u4e0d\u9650\u4e8e\u6b8b\u7559\u6587\u4ef6\uff0c\u6ce8\u518c\u5217\u8868\uff0c\u76f8\u5173\u670d\u52a1\u7b49\uff09\uff0c\u4e0d\u7136\u53ef\u80fd\u4f1a\u6709\u5f71\u54cd<\/p>\n\n\n\n<p>\u73af\u5883\u642d\u5efa\u597d\u540e\u5c31\u53ef\u4ee5\u8fdb\u884c\u9879\u76ee\u642d\u5efa\u4e86\uff0c\u9879\u76ee\u642d\u5efa\u6211\u4f7f\u7528\u4e86idea\u81ea\u5e26\u7684\u9879\u76ee\u521b\u5efa\u5de5\u5177\uff0c\u5728File-New-Project<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"755\" height=\"177\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-30.png\" alt=\"\" class=\"wp-image-917\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-30.png 755w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-30-300x70.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p>\u9009\u62e9Spring Initializr\u6839\u636e\u63d0\u793a\u7f16\u8f91\u9879\u76ee\u540d\uff0c\u5b58\u653e\u4f4d\u7f6e\uff0c\u9879\u76ee\u8bed\u8a00\uff0c\u4ec0\u4e48\u7c7b\u578b\u7684\u9879\u76ee\uff0c\u9879\u76ee\u6a21\u5757\u6807\u8bc6\u7b26\uff0c\u5305\u540d\u4ee5\u53cajdk\u7684\u7248\u672c\uff0c\u8fd9\u91cc\u9700\u8981\u4e3b\u8981\uff0c\u65b0\u7248\u672c\u7684idea\u5df2\u7ecf\u4e0d\u518d\u652f\u6301\u9009\u62e9java8\u4e86\uff0c\u6240\u4ee5\u8fd9\u91cc\u6211\u4f7f\u7528\u4e86\u963f\u91cc\u7684\u670d\u52a1\u5730\u5740\uff0c\u5c06\u4e0a\u65b9\u7684Server URL\u66ff\u6362\u4e3a\u3010<a href=\"https:\/\/start.aliyun.com\">https:\/\/start.aliyun.com<\/a>\u3011\uff0c\u518d\u6b21\u6253\u5f00java\u9009\u9879\u5c31\u6709java8\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"963\" height=\"775\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-32.png\" alt=\"\" class=\"wp-image-919\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-32.png 963w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-32-300x241.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-32-768x618.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u586b\u5199\u597d\u540e\u70b9\u51fb\u4e0b\u4e00\u6b65\uff0c\u8fd9\u91cc\u53ef\u4ee5\u9009\u62e9\u9700\u8981\u5f15\u5165\u7684\u4f9d\u8d56\uff0c\u76f8\u5f53\u4e8e\u662f\u4e00\u4e2a\u5927\u578b\u7684supermarket\uff0c\u8981\u4ec0\u4e48\u5c31\u52fe\u9009\u4e0a\uff0c\u6839\u636e\u6211\u4eec\u4e0a\u8ff0\u7684\u6280\u672f\u6808\u5f15\u5165\u76f8\u5e94\u7684\u4f9d\u8d56\u5373\u53ef\uff0c\u9009\u62e9\u597d\u540e\u70b9\u51fb\u521b\u5efa\u5373\u53ef\u5f97\u5230\u4e00\u4e2a\u5df2\u7ecf\u5e2e\u5fd9\u6dfb\u52a0\u597d\u4f9d\u8d56\u7684\u7a7a\u9879\u76ee<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"827\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-33-1024x827.png\" alt=\"\" class=\"wp-image-920\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-33-1024x827.png 1024w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-33-300x242.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-33-768x620.png 768w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-33.png 1132w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u6211\u9996\u5148\u5b9a\u4e49\u4e86\u4e00\u4e0b\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u901a\u7528\u7684\u914d\u7f6e\u653e\u5230application.yml\u6587\u4ef6\u4e2d\uff0c\u8fd9\u91cc\u6211\u914d\u7f6e\u4e86\u542f\u52a8\u73af\u5883\uff0c\u5faa\u73af\u4f9d\u8d56\u914d\u7f6e\uff0cMyBatis-Plus \u914d\u7f6e\u8bf4\u660emapper.xml\u6587\u4ef6\u5b58\u653e\u4f4d\u7f6e\uff0c\u6570\u636e\u5e93\u914d\u7f6e\uff0c\u5305\u62ec\u5b57\u6bb5\u7b56\u7565\uff08\u5728\u63d2\u5165\u3001\u66f4\u65b0\u3001\u67e5\u8be2\u65f6\u5982\u4f55\u5904\u7406\u5b57\u6bb5\u7684NULL\u6216\u7a7a\u503c\uff09\u548cID\u751f\u6210\u7b56\u7565\uff08\u8fd9\u91cc\u4f7f\u7528<code>assign_id<\/code>\uff0c\u901a\u5e38\u662f\u57fa\u4e8e\u96ea\u82b1\u7b97\u6cd5\u751f\u6210\u5168\u5c40\u552f\u4e00ID\uff09\uff0cMyBatis\u7684\u57fa\u7840\u914d\u7f6e\uff0c\u5305\u62ec\u9a7c\u5cf0\u547d\u540d\u5230\u4e0b\u5212\u7ebf\u7684\u81ea\u52a8\u6620\u5c04\u3001\u662f\u5426\u542f\u7528\u7f13\u5b58\uff08\u8fd9\u91cc\u7981\u7528\uff09\u3001\u662f\u5426\u5728\u5b57\u6bb5\u4e3anull\u65f6\u8c03\u7528setter\u65b9\u6cd5\uff08\u8fd9\u91cc\u542f\u7528\uff09\uff0c\u53e6\u5916\u6211\u8fd9\u91cc\u5f15\u5165\u4e86jasypt\u52a0\u5bc6\u5668\u8fdb\u884c\u6570\u636e\u5e93\u5bc6\u7801\u52a0\u5bc6\u4ee5\u53ca\u5168\u5c40\u7684\u63a5\u53e3\u524d\u7f00\u914d\u7f6e<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"1021\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-34.png\" alt=\"\" class=\"wp-image-922\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-34.png 881w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-34-259x300.png 259w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-34-768x890.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u4e3a\u4e86\u5b9e\u73b0\u591a\u73af\u5883\u914d\u7f6e\uff0c\u590d\u5236application.yml\u5206\u522b\u521b\u5efaapplication-dev.yml\u548capplication-prod.yml\uff0c\u5728\u8fd9\u4e24\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\u4e3b\u8981\u5b9a\u4e49\u4e86\u7aef\u53e3\u4ee5\u53ca\u6570\u636e\u5e93\u76f8\u5173\u7684\u914d\u7f6e<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"310\" height=\"199\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-35.png\" alt=\"\" class=\"wp-image-928\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-35.png 310w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-35-300x193.png 300w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u7684\u6570\u636e\u5e93\u5bc6\u7801\u662f\u4f7f\u7528jasypt\u52a0\u5bc6\u540e\u7684\uff0c\u5e76\u672a\u8bbe\u7f6eHikariCP\u8fde\u63a5\u6c60\u6570\u636e\u5e93\u8fde\u63a5\u7684\u6700\u5927\u751f\u5b58\u65f6\u95f4\u4e3a500000\u6beb\u79d2\uff08\u7ea65\u5206\u949f\uff09\uff0c\u5f53\u8fde\u63a5\u5728\u8fd9\u4e2a\u65f6\u95f4\u540e\u4ecd\u7136\u6ca1\u6709\u88ab\u4f7f\u7528\uff0c\u90a3\u4e48\u5b83\u5c06\u88ab\u5173\u95ed\u5e76\u4ece\u6c60\u4e2d\u79fb\u9664<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"953\" height=\"542\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-36.png\" alt=\"\" class=\"wp-image-929\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-36.png 953w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-36-300x171.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-36-768x437.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u5728prod\u73af\u5883\u4e2d\u989d\u5916\u6dfb\u52a0\u4e86session\u8d85\u65f6\u65f6\u95f4<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"290\" height=\"390\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-37.png\" alt=\"\" class=\"wp-image-931\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-37.png 290w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-37-223x300.png 223w\" sizes=\"auto, (max-width: 290px) 100vw, 290px\" \/><\/figure>\n\n\n\n<p>\u63a5\u4e0b\u6765\u521b\u5efa\u9879\u76ee\u7ed3\u6784\uff0c\u5728resources\u6587\u4ef6\u5939\u4e0b\u521b\u5efamapper\u548csql\u6587\u4ef6\u5939\uff0c\u7528\u4e8e\u653e\u7f6emapper\u7684xml\u6587\u4ef6\u548c\u5efa\u8868sql\u7684\u6267\u884c\u811a\u672c\uff0c\u8fd9\u91cc\u5efa\u8bae\u5728\u9879\u76ee\u4e2d\u5b58\u653e\u5bf9\u8868\u7ed3\u6784\u7684\u6267\u884c\u8bed\u53e5\uff0c\u4ee5\u4fbf\u5728\u9879\u76ee\u4e0a\u7ebf\u65f6\u540c\u6b65\u751f\u4ea7\u73af\u5883<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"309\" height=\"91\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-38.png\" alt=\"\" class=\"wp-image-934\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-38.png 309w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-38-300x88.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><\/figure>\n\n\n\n<p>\u5728\u81ea\u5df1\u7684\u9879\u76ee\u5305\u4e0b\u521b\u5efa\u5982\u4e0b\u6587\u4ef6\u5939\uff1a<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"common\uff1a\u5b58\u653e\u5e38\u91cf\u4e0e\u901a\u7528\u914d\u7f6e\u7b49\uff0c\u8fd9\u91cc\u6211\u5b58\u653e\u7684\u662f\u5e38\u91cf\uff0c\u679a\u4e3e\uff0c\u81ea\u5b9a\u4e49\u5f02\u5e38\uff0c\u7edf\u4e00\u5f02\u5e38\u5904\u7406\u914d\u7f6e\uff0c\u901a\u7528\u5de5\u5177\u7c7b\uff0c\u901a\u7528\u8fd4\u56de\u5b9e\u4f53\n\nconfig\uff1a\u5b58\u653e\u7684\u662fwebmvc\u7684\u914d\u7f6e\uff0c\u5176\u5b9e\u8fd9\u91cc\u6ca1\u6709\u7528\u5230\uff0c\u8de8\u57df\u914d\u7f6e\u5176\u5b9e\u662f\u5728nginx\u4e2d\u914d\u7f6e\u7684\n\ncontroller\uff1a\u63a7\u5236\u5668\uff0c\u524d\u7aef\u8bf7\u6c42\u7684\u63a5\u53e3\n\nmapper\uff1a\u7531\u4e8e\u7528\u5230\u4e86mybatis plus\u6240\u4ee5\u8fd9\u91cc\u7ee7\u627fBaseMapper\u540e\u5c31\u65e0\u9700\u5728\u5199sql\uff0c\u7531\u4e0a\u53ef\u77e5\uff0c\u6211\u5728\n\nresources\u4e2d\u4e5f\u521b\u5efa\u7684mapper\u76f8\u5173\u7684\u6587\u4ef6\u5939\uff0c\u8fd9\u91cc\u4e3b\u8981\u662f\u4e3a\u4e86\u4e4b\u540e\u7684\u62d3\u5c55\u8003\u8651\uff0c\u4e3a\u4e86\u7f16\u5199\u590d\u6742sql\u4f7f\u7528\n\nmodel\uff1a\u8fd9\u91cc\u5b58\u653e\u7684\u6a21\u578b\u6216\u8005\u5b9e\u4f53\u53ea\u7528\u5230\u4e86\u6570\u636e\u5e93\u6620\u5c04\uff0c\u524d\u7aef\u5c55\u793a\u4ee5\u53ca\u4f20\u5165\u8868\u5355\u7684\u5b9e\u4f53\uff0c\u5bf9\u4e8e\u8f6c\u6362\u4f7f\u7528\u7684\u5b9e\u4f53\u5e76\u6ca1\u6709\u521b\u5efa\uff0c\u8fd9\u91cc\u505a\u4e86\u90e8\u5206\u5b9e\u4f53\u7684\u7b80\u5316\n\nmybatisplus\uff1a\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e2d\u4e3b\u8981\u5b58\u653e\u4e86dao\u66fe\u76f8\u5173\u64cd\u4f5c\u7684\u4e00\u4e9b\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\uff0c\u5305\u62ec\u5220\u9664\u65f6\u6267\u884c\u7684\u5207\u9762\uff0cmybatisplus\u7684\u5206\u9875\u63d2\u4ef6\uff0c\u81ea\u5b9a\u4e49sql\u6ce8\u5165\u5668\uff0c\u4ee5\u53ca\u81ea\u52a8\u586b\u5145\u5668\uff08\u4e3a\u901a\u7528\u5b57\u6bb5\u505a\u586b\u5145\uff09\uff0c\u4f46\u662f\u8fd9\u90e8\u5206\u8fd8\u6709\u5f85\u4f18\u5316\n\nservice\uff1a\u5177\u4f53\u7684\u63a5\u53e3\u5b9e\u73b0\uff0c\u5728\u63a7\u5236\u5c42\u5b9a\u4e49\u597d\u7684\u63a5\u53e3\u5728\u8fd9\u91cc\u8fdb\u884c\u5b9e\u73b0\n\n\u6700\u540e\u5c31\u662f\u9879\u76ee\u7684\u542f\u52a8\u5668\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">common\uff1a\u5b58\u653e\u5e38\u91cf\u4e0e\u901a\u7528\u914d\u7f6e\u7b49\uff0c\u8fd9\u91cc\u6211\u5b58\u653e\u7684\u662f\u5e38\u91cf\uff0c\u679a\u4e3e\uff0c\u81ea\u5b9a\u4e49\u5f02\u5e38\uff0c\u7edf\u4e00\u5f02\u5e38\u5904\u7406\u914d\u7f6e\uff0c\u901a\u7528\u5de5\u5177\u7c7b\uff0c\u901a\u7528\u8fd4\u56de\u5b9e\u4f53<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">config\uff1a\u5b58\u653e\u7684\u662fwebmvc\u7684\u914d\u7f6e\uff0c\u5176\u5b9e\u8fd9\u91cc\u6ca1\u6709\u7528\u5230\uff0c\u8de8\u57df\u914d\u7f6e\u5176\u5b9e\u662f\u5728nginx\u4e2d\u914d\u7f6e\u7684<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">controller\uff1a\u63a7\u5236\u5668\uff0c\u524d\u7aef\u8bf7\u6c42\u7684\u63a5\u53e3<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">mapper\uff1a\u7531\u4e8e\u7528\u5230\u4e86mybatis plus\u6240\u4ee5\u8fd9\u91cc\u7ee7\u627fBaseMapper\u540e\u5c31\u65e0\u9700\u5728\u5199sql\uff0c\u7531\u4e0a\u53ef\u77e5\uff0c\u6211\u5728<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">resources\u4e2d\u4e5f\u521b\u5efa\u7684mapper\u76f8\u5173\u7684\u6587\u4ef6\u5939\uff0c\u8fd9\u91cc\u4e3b\u8981\u662f\u4e3a\u4e86\u4e4b\u540e\u7684\u62d3\u5c55\u8003\u8651\uff0c\u4e3a\u4e86\u7f16\u5199\u590d\u6742sql\u4f7f\u7528<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">model\uff1a\u8fd9\u91cc\u5b58\u653e\u7684\u6a21\u578b\u6216\u8005\u5b9e\u4f53\u53ea\u7528\u5230\u4e86\u6570\u636e\u5e93\u6620\u5c04\uff0c\u524d\u7aef\u5c55\u793a\u4ee5\u53ca\u4f20\u5165\u8868\u5355\u7684\u5b9e\u4f53\uff0c\u5bf9\u4e8e\u8f6c\u6362\u4f7f\u7528\u7684\u5b9e\u4f53\u5e76\u6ca1\u6709\u521b\u5efa\uff0c\u8fd9\u91cc\u505a\u4e86\u90e8\u5206\u5b9e\u4f53\u7684\u7b80\u5316<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">mybatisplus\uff1a\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e2d\u4e3b\u8981\u5b58\u653e\u4e86dao\u66fe\u76f8\u5173\u64cd\u4f5c\u7684\u4e00\u4e9b\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\uff0c\u5305\u62ec\u5220\u9664\u65f6\u6267\u884c\u7684\u5207\u9762\uff0cmybatisplus\u7684\u5206\u9875\u63d2\u4ef6\uff0c\u81ea\u5b9a\u4e49sql\u6ce8\u5165\u5668\uff0c\u4ee5\u53ca\u81ea\u52a8\u586b\u5145\u5668\uff08\u4e3a\u901a\u7528\u5b57\u6bb5\u505a\u586b\u5145\uff09\uff0c\u4f46\u662f\u8fd9\u90e8\u5206\u8fd8\u6709\u5f85\u4f18\u5316<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">service\uff1a\u5177\u4f53\u7684\u63a5\u53e3\u5b9e\u73b0\uff0c\u5728\u63a7\u5236\u5c42\u5b9a\u4e49\u597d\u7684\u63a5\u53e3\u5728\u8fd9\u91cc\u8fdb\u884c\u5b9e\u73b0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\u6700\u540e\u5c31\u662f\u9879\u76ee\u7684\u542f\u52a8\u5668<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"335\" height=\"262\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-39.png\" alt=\"\" class=\"wp-image-936\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-39.png 335w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/10\/image-39-300x235.png 300w\" sizes=\"auto, (max-width: 335px) 100vw, 335px\" \/><\/figure>\n\n\n\n<p>\u521b\u5efa\u597d\u6574\u4f53\u7684\u9879\u76ee\u7ed3\u6784\u540e\uff0c\u8fd9\u91cc\u5c31\u4e0d\u518d\u5c55\u5f00\u8bf4\u660e\u6bcf\u4e00\u4e2a\u63a5\u53e3\u5177\u4f53\u7684\u5b9e\u73b0\u4e86\uff0c\u6709\u4e9b\u9879\u76ee\u4e2d\u6d89\u53ca\u5230\u7684\u5173\u952e\u70b9\u4f1a\u91cd\u70b9\u8bf4\u4e00\u4e0b<\/p>\n\n\n\n<p>\u9996\u5148\u662fController\u5c42\u8de8\u57df\u76f8\u5173\u7684\u8bbe\u7f6e\uff0c\u5982\u679c\u8bf4\u5728\u524d\u7aef\u6216nginx\u4e2d\u6ca1\u6709\u8bbe\u7f6e\u8de8\u57df\uff0c\u53ef\u4ee5\u628a\u8de8\u57df\u76f8\u5173\u7684\u914d\u7f6e\u5728\u540e\u7aef\u8fdb\u884c\u8bbe\u7f6e\uff0c\u8fd9\u91cc\u53ef\u4ee5\u5728Controller\u5c42\u6dfb\u52a0CrossOrigin\u6ce8\u89e3(\u8de8\u57df\u8d44\u6e90\u5171\u4eab)\uff0c\u5728\u6ce8\u89e3\u4e2d\u6dfb\u52a0origins\u7136\u540e\u5199\u660e\u9700\u8981\u8de8\u57df\u8bbf\u95ee\u7684\u5730\u5740\uff0c\u8fd9\u91cc\u662f\u4e00\u4e2a\u6570\u7ec4\u4ee5\u9017\u53f7\u5206\u9694\u6dfb\u52a0\u591a\u4e2a\u5730\u5740\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"@CrossOrigin(origins = {&quot;http:\/\/192.168.1.1:8081&quot;})\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">@CrossOrigin(origins = {&quot;http:\/\/192.168.1.1:8081&quot;})<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>CrossOrigin\u6ce8\u89e3\u4e2d\u8fd8\u6709\u5176\u4ed6\u7684\u5c5e\u6027<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"methods\uff1a\u5141\u8bb8\u8de8\u57df\u8bf7\u6c42\u7684\u65b9\u6cd5\uff0c\u5982 GET, POST, PUT, DELETE \u7b49\u3002\n\nallowedHeaders\uff1a\u5728\u8bf7\u6c42\u4e2d\u5141\u8bb8\u7684\u5934\u4fe1\u606f\u5b57\u6bb5\u3002\n\nexposedHeaders\uff1a\u5728\u54cd\u5e94\u4e2d\u66b4\u9732\u7ed9\u5ba2\u6237\u7aef\u7684\u5934\u4fe1\u606f\u5b57\u6bb5\u3002\n\nallowCredentials\uff1a\u662f\u5426\u5141\u8bb8\u53d1\u9001Cookie\u4fe1\u606f\u3002\n\nmaxAge\uff1a\u9884\u68c0\u8bf7\u6c42\u7684\u7ed3\u679c\u7684\u6709\u6548\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\u3002\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">methods\uff1a\u5141\u8bb8\u8de8\u57df\u8bf7\u6c42\u7684\u65b9\u6cd5\uff0c\u5982 GET, POST, PUT, DELETE \u7b49\u3002<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">allowedHeaders\uff1a\u5728\u8bf7\u6c42\u4e2d\u5141\u8bb8\u7684\u5934\u4fe1\u606f\u5b57\u6bb5\u3002<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">exposedHeaders\uff1a\u5728\u54cd\u5e94\u4e2d\u66b4\u9732\u7ed9\u5ba2\u6237\u7aef\u7684\u5934\u4fe1\u606f\u5b57\u6bb5\u3002<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">allowCredentials\uff1a\u662f\u5426\u5141\u8bb8\u53d1\u9001Cookie\u4fe1\u606f\u3002<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">maxAge\uff1a\u9884\u68c0\u8bf7\u6c42\u7684\u7ed3\u679c\u7684\u6709\u6548\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\u3002<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5982\u679c\u4f60\u9700\u8981\u5bf9\u591a\u4e2a\u7aef\u70b9\u5e94\u7528\u76f8\u540c\u7684 CORS \u7b56\u7565\uff0c\u53ef\u4ee5\u8003\u8651\u5728\u5168\u5c40\u7ea7\u522b\u914d\u7f6e CORS\uff0c\u6bd4\u5982\u901a\u8fc7\u5b9e\u73b0&nbsp;<code>WebMvcConfigurer<\/code>&nbsp;\u63a5\u53e3\u7684&nbsp;<code>addCorsMappings<\/code>&nbsp;\u65b9\u6cd5\u3002\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5728\u6bcf\u4e2a\u63a7\u5236\u5668\u6216\u65b9\u6cd5\u4e0a\u91cd\u590d\u6dfb\u52a0&nbsp;<code>@CrossOrigin<\/code>&nbsp;\u6ce8\u89e3\u3002<\/p>\n\n\n\n<p>\u5728\u5b9e\u73b0\u65b9\u9762\uff0c\u5bf9\u4e8emapper\u5c42\u7684\u6ce8\u5165\u4f7f\u7528\u7684\u662f\u76ee\u524dspring\u63a8\u8350\u7684\u6784\u9020\u65b9\u6cd5\u6ce8\u5165\u7684\u65b9\u5f0f\uff0c\u5728\u767b\u5f55\u4e0e\u6ce8\u518c\u529f\u80fd\u4e0a\u4e5f\u505a\u4e86\u540e\u7aef\u7684\u53c2\u6570\u6821\u9a8c\uff0c\u8fd9\u91cc\u662f\u4e3a\u4e86\u9632\u6b62\u8bf7\u6c42\u4e0d\u662f\u4ece\u524d\u7aef\u53d1\u8d77\u800c\u76f4\u63a5\u8bbf\u95ee\u63a5\u53e3\u7684\u8bf7\u6c42\u3002<\/p>\n\n\n\n<p>\u5728\u6ce8\u518c\u529f\u80fd\u4e2d\uff0c\u5bc6\u7801\u5e76\u4e0d\u4f1a\u540d\u6587\u5b58\u50a8\uff0c\u5728\u767b\u5f55\u6821\u9a8c\u4e2d\uff0c\u4e5f\u4f1a\u6839\u636e\u52a0\u5bc6\u540e\u7684\u5bc6\u6587\u8fdb\u884c\u6bd4\u8f83\uff0c\u5728\u767b\u5f55\u6210\u529f\u540e\uff0c\u4f1a\u5bf9\u7528\u6237\u6570\u636e\u8131\u654f\u5e76\u5c06\u8131\u654f\u540e\u7684\u7528\u6237\u767b\u5f55\u6001\u5b58\u653e\u5230session\u4e2d\u5728\u540e\u7eed\u9274\u6743\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u4ee5\u53ca\u767b\u51fa\u529f\u80fd\u4e2d\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u5728\u4e1a\u52a1\u4ee3\u7801\u4e2d\uff0c\u5c06\u4f7f\u7528\u5230\u7684\u5e38\u91cf\u5b58\u653e\u5230\u516c\u5171\u7684\u5e38\u91cf\u7c7b\u4e2d\u4ee5\u4fbf\u7edf\u4e00\u7ba1\u7406\u4e0e\u8bbf\u95ee\u3002<\/p>\n\n\n\n<p>\u5728\u5bf9\u6570\u636e\u5c42\u64cd\u4f5c\u65f6\uff0c\u521b\u5efa\u4e86\u7528\u4e8e\u5220\u9664\u65b9\u6cd5\u7684\u81ea\u52a8\u6ce8\u5165\u7684\u5207\u9762\u7c7b\uff0c\u5207\u70b9\u662f\u6bcf\u4e00\u4e2a\u5b9e\u73b0\u5c42\u4e2d\u524d\u7f00\u4e3adelete\u7684\u65b9\u6cd5\uff0c\u58f0\u660e\u4e00\u4e2a\u73af\u7ed5\u901a\u77e5\uff0c\u5728\u6240\u6709\u5339\u914d\u7684<code>delete<\/code>\u65b9\u6cd5\u6267\u884c\u524d\u540e\u6267\u884c\u3002\u73af\u7ed5\u901a\u77e5\u65b9\u6cd5\u5185\u90e8\u903b\u8f91\uff0c\u901a\u8fc7&nbsp;<code>ProceedingJoinPoint<\/code>&nbsp;\u5bf9\u8c61\u7684getArgs()\u65b9\u6cd5\u83b7\u53d6\u5230\u88ab\u4ee3\u7406\u7684\u76ee\u6807\uff08<code>IService&lt;Object&gt;<\/code>&nbsp;\u7c7b\u578b\uff09\u548c\u65b9\u6cd5\u7684\u53c2\u6570\uff0c\u83b7\u53d6\u5230\u76ee\u6807\u5bf9\u8c61\u540e\u5bf9\u5176\u6821\u9a8c\uff0c\u5982\u679c\u4e0d\u662f\u5355\u4e00\u5bf9\u8c61\u6216\u4e3a\u7a7a\u5219\u76f4\u63a5\u6267\u884c\u539f\u65b9\u6cd5\u3002\u4f7f\u7528 MyBatis-Plus \u7684&nbsp;<code>UpdateWrapper<\/code>&nbsp;\u6765\u6784\u5efa\u66f4\u65b0\u6761\u4ef6\uff0c\u7531\u4e8e\u662f\u903b\u8f91\u5220\u9664\uff0c\u6240\u4ee5\u4e5f\u662f\u4f5c\u4e3a\u66f4\u65b0\u6765\u64cd\u4f5c\uff0c\u8fd9\u91cc\u4e3b\u8981\u66f4\u65b0\u7684\u662fupdate_time\uff0cupdate_by\uff0cupdate_by_name\u5b57\u6bb5\uff0c\u83b7\u53d6\u53c2\u6570\u4e2d\u7684id\uff0c\u8c03\u7528\u83b7\u53d6\u5230\u5bf9\u8c61\u7684<code>update()<\/code>&nbsp;\u65b9\u6cd5\u6765\u6267\u884c\u66f4\u65b0\u64cd\u4f5c\u3002\u6700\u540e\u901a\u8fc7ProceedingJoinPoint\u7684proceed()\u65b9\u6cd5\u6267\u884c\u4ee3\u7406\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7\u5b9e\u73b0MetaObjectHandler\u81ea\u5b9a\u4e49\u81ea\u52a8\u586b\u5145\u5668\uff0c\u91cd\u5199MetaObjectHandler\u4e2d\u7684insertFill\u548cupdateFill\u5bf9\u63d2\u5165\u4e0e\u66f4\u65b0\u64cd\u4f5c\u586b\u5145\u901a\u7528\u5b57\u6bb5createBy\uff0ccreateByName\uff0ccreateTime\u4ee5\u53caupdateBy\uff0cupdateByName\uff0cupdateTime\u3002\u5b9a\u4e49\u597d\u540e\u5176\u5b9e\u4ed6\u662f\u4e0d\u751f\u6548\u7684\uff0c\u9700\u8981\u5728\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u5b9e\u4f53\u7684\u901a\u7528\u5b57\u6bb5TableField\u6ce8\u89e3\u4e0a\u6dfb\u52a0fill = FieldFill.\u64cd\u4f5c\u7684\u7c7b\u578b<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"    \/\/\u63d2\u5165\u64cd\u4f5c\u65f6\n    @TableField(value = &quot;xxxxx&quot; , fill = FieldFill.INSERT)\n    \/\/\u66f4\u65b0\u64cd\u4f5c\u65f6\n    @TableField(value = &quot;xxxxx&quot; , fill = FieldFill.UPDATE)\n    \/\/\u63d2\u5165\u6216\u66f4\u65b0\u64cd\u4f5c\u65f6    \n    @TableField(value = &quot;xxxxx&quot; , fill = FieldFill.INSERT_UPDATE)\n    \/\/\u6839\u636e\u6e90\u7801\u53ef\u77e5\u8fd8\u6709\u4e00\u79cd\u9ed8\u8ba4\uff0c\u5373\u4e0d\u7279\u522b\u6307\u5b9a\u5728\u63d2\u5165\u6216\u66f4\u65b0\u65f6\u81ea\u52a8\u586b\u5145\u3002\u5177\u4f53\u542b\u4e49\u53ef\u80fd\u4f9d\u8d56\u4e8e\u4f7f\u7528\u8fd9\u4e2a\u679a\u4e3e\u7684\u4e0a\u4e0b\u6587        \n    @TableField(value = &quot;xxxxx&quot; , fill = FieldFill.DEFAULT)\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/\u63d2\u5165\u64cd\u4f5c\u65f6<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">TableField<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">xxxxx<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">fill<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">FieldFill<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">INSERT<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/\u66f4\u65b0\u64cd\u4f5c\u65f6<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">TableField<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">xxxxx<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">fill<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">FieldFill<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">UPDATE<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/\u63d2\u5165\u6216\u66f4\u65b0\u64cd\u4f5c\u65f6    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">TableField<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">xxxxx<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">fill<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">FieldFill<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">INSERT_UPDATE<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">    <\/span><span style=\"color: #616E88\">\/\/\u6839\u636e\u6e90\u7801\u53ef\u77e5\u8fd8\u6709\u4e00\u79cd\u9ed8\u8ba4\uff0c\u5373\u4e0d\u7279\u522b\u6307\u5b9a\u5728\u63d2\u5165\u6216\u66f4\u65b0\u65f6\u81ea\u52a8\u586b\u5145\u3002\u5177\u4f53\u542b\u4e49\u53ef\u80fd\u4f9d\u8d56\u4e8e\u4f7f\u7528\u8fd9\u4e2a\u679a\u4e3e\u7684\u4e0a\u4e0b\u6587        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">TableField<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">xxxxx<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">fill<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">FieldFill<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">DEFAULT<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5f53\u5904\u5b8c\u4e1a\u52a1\u903b\u8f91\u83b7\u53d6\u7ed3\u679c\u540e\u5c31\u53ef\u4ee5\u505a\u7edf\u4e00\u8fd4\u56de\u4ee5\u53ca\u7edf\u4e00\u5f02\u5e38\u5904\u7406\u4e86\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u9996\u5148\u6765\u8bb2\u81ea\u5b9a\u4e49\u5f02\u5e38\uff0c\u5728common\u6587\u4ef6\u5939\u4e2d\u521b\u5efaexception\u6587\u4ef6\u5939\uff0c\u521b\u5efa\u4e00\u4e2a\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u516c\u5171\u5f02\u5e38\uff0c\u7ee7\u627fRuntimeException\u6dfb\u52a0\u4e00\u4e2a\u6784\u9020\u65b9\u6cd5\uff0c\u53c2\u6570\u8fd9\u91cc\u4f7f\u7528\u4e86\u4e24\u4e2a\uff08code\u548cmessage\uff09\u5e76\u6dfb\u52a0get\u65b9\u6cd5\u6216\u6ce8\u89e3\u3002\u7136\u540e\u521b\u5efa\u5f02\u5e38\u7edf\u4e00\u5904\u7406\uff0c\u521b\u5efahandler\u6587\u4ef6\u5939\uff0c\u7136\u540e\u521b\u5efa\u5f02\u5e38\u5904\u7406\u7c7b\u5e76\u6dfb\u52a0@ControllerAdvice(\u5b9a\u4e49\u5168\u5c40\u7684\u63a7\u5236\u5668\u7ea7\u522b\u7684\u5207\u9762)\u6ce8\u89e3\uff0c\u5728<code>@ExceptionHandler<\/code>\u6ce8\u89e3\u4e2d\u6dfb\u52a0\u6211\u4eec\u521b\u5efa\u7684\u5f02\u5e38\u7c7b\u3002\u6700\u540e\u521b\u5efa\u4e00\u4e2a\u65b9\u6cd5\u7528\u4e8e\u5904\u7406\u6211\u4eec\u7684\u5f02\u5e38\uff0c\u8fd9\u91cc\u6211\u4eec\u5bf9\u8fd4\u56de\u7684\u7ed3\u6784\u8fdb\u884c\u7edf\u4e00\u5c01\u88c5\u5904\u7406\uff0c\u5728common\u4e2d\u521b\u5efa\u4e00\u4e2a\u7edf\u4e00\u8fd4\u56de\u7684vo\u5b9e\u4f53\u5bf9\u8c61\uff0c\u4e3a\u5bf9\u8c61\u6dfb\u52a0\u4e00\u4e2a\u6cdb\u578b\uff0c\u8fd9\u4e2a\u5b9e\u4f53\u4e2d\u7684\u53c2\u6570\u6709code\uff0cmessage\uff0cdata\uff0c\u5176\u4e2d\u6dfb\u52a0\u7684\u6cdb\u578b\u5c31\u662fdata\u7684\u6570\u636e\u7c7b\u578b\u5e76\u901a\u8fc7lombok\u6dfb\u52a0get\uff0cset\u65b9\u6cd5<\/p>\n\n\n\n<p>\u6700\u540e\u5728\u8fd4\u56de\u6570\u636e\u65f6\u6211\u4eec\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e2a\u7edf\u4e00\u7684\u8fd4\u56de\u5de5\u5177\u7c7b\uff0c\u53c2\u6570\u4e5f\u662fcode\uff0cmessage\uff0ccode\uff0c\u72b6\u6001\u7801\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e2a\u679a\u4e3e\uff0c\u5c06\u9700\u8981\u8fd4\u56de\u7684\u4e0d\u540c\u72b6\u6001\u7801\u653e\u8fdb\u53bb\u3002\u8fd4\u56de\u7c7b\u578b\u5c31\u662f\u4e0a\u9762\u5b9a\u4e49\u597d\u7684\u5e26\u6cdb\u578b\u7684\u8fd4\u56de\u5b9e\u4f53\uff0c\u5728\u8fd9\u4e2a\u5de5\u5177\u7c7b\u4e2d\uff0c\u5b9a\u4e49\u4e86success\uff0cerror\u6210\u529f\u6216\u8005\u5931\u8d25\u65b9\u6cd5\uff0c\u53c2\u6570\u53ef\u4ee5\u6839\u636e\u4e1a\u52a1\u5b9e\u9645\u60c5\u51b5\u6765\u5b9a\uff0c\u6211\u8fd9\u91cc\u53ea\u662f\u7528\u5230\u4e86\uff0c\u53c2\u6570\u662fmessage\u6216message\u548cdata\u7684\uff08\u56e0\u4e3a\u6211\u662f\u5728\u65b9\u6cd5\u5185\u90e8\u5b9a\u7ed9\u5b9a\u4e86\u72b6\u6001\u7801\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5916\u5c42\u4e1a\u52a1\u4ee3\u7801\u4e2d\u4f20\u5165\uff09\u3002\u5728\u8fd4\u56de\u7684\u65f6\u5019\u7531\u4e8e\u662f\u7edf\u4e00\u5f02\u5e38\u5c31\u4f7f\u7528\u7684\u662f\u5de5\u5177\u7c7b\u4e2d\u7684error\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>\u5269\u4e0b\u7684\u5c31\u662f\u5355\u72ec\u521b\u5efa\u4e86\u4e00\u4e2a\u52a0\u5bc6\u7c7b\uff08\u7528\u4e8e\u7528\u6237\u6ce8\u518c\u5bc6\u7801\u52a0\u5bc6\uff09<\/p>\n\n\n\n<p>\u81f3\u6b64\u540e\u7aef\u6240\u6709\u7684\u4e1a\u52a1\u4ee3\u7801\u5c31\u5df2\u7ecf\u5b8c\u6210\u4e86\uff0c\u7136\u540e\u5c31\u662f\u540e\u7aef\u7684dockerfile\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u7ebf\u4e0a\u6253\u5305\u5e76\u90e8\u7f72\u7684\u65b9\u5f0f\uff0c\u4f46\u662f\u6211\u8bd5\u4e86\u4e00\u4e0b\uff0c\u6211\u7684\u5c0f\u670d\u52a1\u5668\u5e26\u5bbd\u6709\u9650\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u5728\u56fd\u5185\uff0c\u6253\u5305\u5de8\u6162\u4e14\u5bb9\u6613\u5361\u4f4f\uff0c\u6211\u4e5f\u6ca1\u6709\u518d\u53bb\u8bbe\u7f6e\u955c\u50cf\u4e4b\u7c7b\u7684\uff0c\u8fd9\u91cc\u9009\u62e9\u76f4\u63a5\u4e0a\u4f20\u6253\u5305\u597d\u7684\u6587\u4ef6\uff0c\u5728\u670d\u52a1\u5668\u4e0a\u76f4\u63a5\u90e8\u7f72\uff0c\u7b2c\u4e00\u6b21\u6784\u5efa\u4f1a\u6bd4\u8f83\u6162\uff0c\u540e\u9762\u6709\u7f13\u5b58\u540e\u5c31\u5feb\u4e86\uff0c\u9996\u5148\u662f\u83b7\u53d6maven\u548cjdk\uff0c\u7136\u540e\u521b\u5efaxxxxx\u6587\u4ef6\u5939\u548clog\u65e5\u5fd7\u5b58\u653e\u7684\u6587\u4ef6\u5939\uff0c\u590d\u5236\u6211\u4eec\u4e0a\u4f20\u7684\u6587\u4ef6\u5230xxxxx\u6587\u4ef6\u5939\u5e76\u91cd\u547d\u540dapp.jar\uff0c\u8bbe\u7f6e\u7aef\u53e3\u53f7\u4e3a8081\uff0c\u6700\u7ec8\u4ee5cmd\u547d\u4ee4\u884c\u65b9\u5f0f\u542f\u52a8\u9879\u76ee\uff0c\u5e76\u8bbe\u7f6e\u542f\u52a8\u73af\u5883<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"FROM maven:3.5-jdk-8-alpine as builder\n\nRUN mkdir \/xxxxx\nRUN mkdir -p \/xxx\/log\/\nCOPY .\/target\/xxxxx-0.0.1-SNAPSHOT.jar \/xxxxx\/app.jar\nEXPOSE 8081\n\nCMD [&quot;java&quot;,&quot;-jar&quot;,&quot;\/xxxxx\/app.jar&quot;,&quot;--spring.profiles.active=prod&quot;]\n\n\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #8FBCBB\">FROM<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">maven<\/span><span style=\"color: #81A1C1\">:<\/span><span style=\"color: #B48EAD\">3.5<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">jdk<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">8<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">alpine as builder<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">RUN<\/span><span style=\"color: #D8DEE9FF\"> mkdir <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9FF\">xxxxx<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">RUN<\/span><span style=\"color: #D8DEE9FF\"> mkdir <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">p <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9FF\">xxx<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9FF\">log<\/span><span style=\"color: #81A1C1\">\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">COPY <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9FF\">target<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9FF\">xxxxx<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">0.0<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">1<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">SNAPSHOT<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">jar<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9FF\">xxxxx<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">app<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">jar<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">EXPOSE <\/span><span style=\"color: #B48EAD\">8081<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8FBCBB\">CMD<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">[<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">java<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">-jar<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\/xxxxx\/app.jar<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">--spring.profiles.active=prod<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">]<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u81f3\u6b64\u540e\u7aef\u7684\u5f00\u53d1\u5c31\u5b8c\u6210\u4e86<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u540e\u7aef\u6280\u672f\u6808\uff1a Spring + SpringMVC + SpringBoot + MyBatis + MyBa &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.coffecat.cn\/index.php\/2024\/10\/08\/%e9%a1%b9%e7%9b%ae%e5%ae%9e%e6%88%98%e8%ae%b0%e5%bd%95-%e3%80%90%e7%94%a8%e6%88%b7%e4%b8%ad%e5%bf%83%e9%a1%b9%e7%9b%ae%e3%80%91%e7%94%a8%e6%88%b7%e4%b8%ad%e5%bf%83%e5%90%8e%e7%ab%af%e5%bc%80%e5%8f%91\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u9879\u76ee\u5b9e\u6218\u8bb0\u5f55 -\u3010\u7528\u6237\u4e2d\u5fc3\u9879\u76ee\u3011\u7528\u6237\u4e2d\u5fc3\u540e\u7aef\u5f00\u53d1\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,33],"tags":[],"class_list":["post-907","post","type-post","status-publish","format-standard","hentry","category-34","category-33"],"views":776,"_links":{"self":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts\/907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/comments?post=907"}],"version-history":[{"count":67,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts\/907\/revisions"}],"predecessor-version":[{"id":997,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts\/907\/revisions\/997"}],"wp:attachment":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/media?parent=907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/categories?post=907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/tags?post=907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}