{"id":10008123,"date":"2023-08-21T13:00:13","date_gmt":"2023-08-21T05:00:13","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008123"},"modified":"2023-08-21T13:00:13","modified_gmt":"2023-08-21T05:00:13","slug":"%e8%a7%92%e5%ba%a6%e6%96%b0%e5%a5%87%ef%bc%81%e7%ac%ac%e4%b8%80%e6%ac%a1%e7%9c%8b%e5%88%b0%e8%bf%99%e6%a0%b7%e4%bd%bf%e7%94%a8mybatis%e7%9a%84%ef%bc%8c%e7%9c%8b%e5%be%97%e6%88%91%e4%b8%80%e6%84%a3","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008123","title":{"rendered":"\u89d2\u5ea6\u65b0\u5947\uff01\u7b2c\u4e00\u6b21\u770b\u5230\u8fd9\u6837\u4f7f\u7528MyBatis\u7684\uff0c\u770b\u5f97\u6211\u4e00\u6123\u4e00\u6123\u7684\u3002"},"content":{"rendered":"<p>\u4f60\u597d\u5440\uff0c\u6211\u662f\u6b6a\u6b6a\u3002<\/p>\n<p>\u8fd9\u671f\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e2a\u8bfb\u8005\u7ed9\u6211\u5206\u4eab\u7684\u4e00\u4e2a\u5173\u4e8e MyBatis \u7684\u201c\u7f16\u7a0b\u5c0f\u6280\u5de7\u201d\uff0c\u8bf4\u771f\u7684\uff0c\u8fd9\u9a9a\u64cd\u4f5c\uff0c\u76f4\u63a5\u628a\u6211\u770b\u5f97\u4e00\u6123\u4e00\u6123\u7684\u3002<\/p>\n<p>\u6211\u66f4\u60c5\u613f\u53eb\u5b83\uff1a\u5751\u4f60\u6ca1\u5546\u91cf\u4e4b\u57cb\u96f7\u5927\u6cd5\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133321\" alt=\"\" title=\"\"><\/p>\n<h2>Demo<\/h2>\n<p>\u4e3a\u4e86\u8ba9\u4f60\u4e1d\u6ed1\u5165\u620f\uff0c\u6211\u8fd8\u662f\u5148\u7ed9\u4f60\u641e\u4e2a Demo\u3002<\/p>\n<p>\u56e0\u4e3a\u8981\u4f7f\u7528\u5230 MyBatis \u561b\uff0c\u6240\u4ee5\u6211\u4eec\u5148\u641e\u4e24\u4e2a\u8868\u3002<\/p>\n<p>\u4e00\u4e2a\u8868\u53eb\u505a product \u8868\uff0c\u8868\u7ed3\u6784\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133322\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u53e6\u4e00\u4e2a\u8868\u53eb\u505a order_info \u8868\uff0c\u8868\u7ed3\u6784\u4e5f\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133323\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u770b\u5230\u8fd9\u4e24\u4e2a\u8868\u51fa\u73b0\u7684\u65f6\u5019\uff0c\u4f60\u5c31\u77e5\u9053\u6211\u7684\u573a\u666f\u662f\u5565\u4e86\uff0c\u80af\u5b9a\u662f\u5356\u8d27\u561b\u3002<\/p>\n<p>\u5e93\u5b58\u51cf\u4e00\uff0c\u8ba2\u5355\u52a0\u4e00\u3002<\/p>\n<p>\u5927\u5bb6\u518d\u719f\u6089\u4e0d\u8fc7\u7684\u573a\u666f\u4e86\u3002<\/p>\n<p>\u5206\u5206\u949f\u80fd\u5199\u51fa\u8fd9\u6837\u7684\u4f2a\u4ee3\u7801\uff1a<\/p>\n<pre><code>public void saleProduct(){\n    \/\/\u66f4\u65b0\u5e93\u5b58\uff0c\u5e93\u5b58\u51cf\u4e00\n    productMapper.updateProductCount();\n    \/\/\u4fdd\u5b58\u8ba2\u5355\u4fe1\u606f\n    orderInfoMapper.saveOrderInfo();\n}<\/code><\/pre>\n<p>\u5f53\u7136\u4e86\uff0c\u8fd9\u4e2a\u4f2a\u4ee3\u7801\u4f60\u4e00\u773c\u5c31\u80fd\u770b\u51fa\u95ee\u9898\uff1a\u51cf\u5e93\u5b58\u548c\u4fdd\u5b58\u8ba2\u5355\u5e94\u8be5\u662f\u4e00\u4e2a\u4e8b\u52a1\u64cd\u4f5c\uff0c\u6240\u4ee5\u5e94\u8be5\u628a\u8fd9\u4e24\u4e2a\u52a8\u4f5c\u5305\u88f9\u5728\u4e8b\u52a1\u91cc\u9762\u3002<\/p>\n<p>\u4e8e\u662f\u6211\u4eec\u7684\u4f2a\u4ee3\u7801\u53d8\u6210\u4e86\u8fd9\u6837\uff1a<\/p>\n<pre><code>public void saleProduct() {\n    \/\/\u5f00\u542f\u4e8b\u52a1\n    begin;\n    \/\/\u66f4\u65b0\u5e93\u5b58\uff0c\u5e93\u5b58\u51cf\u4e00\n    Boolean updateSuccess = productMapper.updateProductCount();\n    \/\/\u4fdd\u5b58\u8ba2\u5355\u4fe1\u606f\n    orderInfoMapper.saveOrderInfo();\n    if (updateSuccess) {\n        \/\/\u63d0\u4ea4\u4e8b\u52a1\n        commit;\n    } else {\n        \/\/\u56de\u6eda\u4e8b\u52a1\n        rollback\n    }\n}<\/code><\/pre>\n<p>\u5f53\u65f6\u8bfb\u8005\u7ed9\u6211\u4e3e\u4f8b\u7684\u65f6\u5019\uff0c\u5b8c\u5168\u662f\u53e6\u5916\u4e00\u4e2a\u573a\u666f\uff0c\u548c\u5356\u8d27\u5b8c\u5168\u6ca1\u6709\u4efb\u4f55\u5173\u7cfb\u3002<\/p>\n<p>\u8bfb\u8005\u4e3e\u7684\u4f8b\u5b50\u5927\u6982\u662f\u51e0\u4e2a\u8868\u4e4b\u95f4\u6709\u5173\u8054\u5173\u7cfb\uff0c\u5982\u679c\u4e00\u4e2a\u8868\u7684\u67d0\u6761\u6570\u636e\u88ab\u5220\u9664\u4e86\uff0c\u53e6\u5916\u51e0\u4e2a\u8868\u91cc\u9762\u5bf9\u5e94\u7684\u6570\u636e\u4e5f\u8981\u5220\u9664\uff0c\u8fd8\u6709\u4e00\u4e2a\u8868\u9700\u8981\u66f4\u65b0\u72b6\u6001\u3002<\/p>\n<p>\u4e3a\u4e86\u66f4\u597d\u7684\u5c55\u793a\u8fd9\u4e2a\u201c\u7f16\u7a0b\u5c0f\u6280\u5de7\u201d\uff0c\u6211\u624d\u628a\u573a\u666f\u7b80\u5316\u5230\u4e86\u524d\u9762\u63d0\u5230\u7684\u5356\u8d27\u7684\u6837\u5b50\u3002<\/p>\n<p>\u524d\u9762\u8bf4\u7684\u662f\u4f2a\u4ee3\u7801\u3002<\/p>\n<p>\u73b0\u5728\u6211\u7ed9\u4f60\u5c55\u793a\u4e00\u4e0b\u7528\u201c\u7f16\u7a0b\u5c0f\u6280\u5de7\u201d\u5199\u51fa\u6765\u7684\u771f\u5b9e\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u9996\u5148\u662f controller \u63a5\u53e3\uff1a<\/p>\n<pre><code>@GetMapping(&quot;\/sale&quot;)\npublic void sale() {\n    productMapper.selaProduct();\n}<\/code><\/pre>\n<p>\u7136\u540e\u662f\u8fd9\u4e2a productMapper \u7684 selaProduct \u63a5\u53e3\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133324\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u662f\u7684\uff0c\u4f60\u6ca1\u6709\u770b\u9519\uff0c\u8fd9\u5c31\u662f\u4e00\u4e2a MyBatis \u7684 mapper \u63a5\u53e3\uff0c\u63a5\u4e0b\u6765\u5c31\u76f4\u63a5\u5230\u4e86 mapper.xml \u6587\u4ef6\u91cc\u9762\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133325\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u5199\u6cd5\uff0c\u8fd9\u5c0f\u6280\u5de7\uff0c\u6211\u90fd\u4e0d\u6253\u7b97\u95ee\u4f60\u9a9a\u4e0d\u9a9a\uff0c\u6211\u5c31\u95ee\u4f60\u89c1\u6ca1\u89c1\u8fc7\uff1f<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133326\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>\u80fd\u7528\u5417\uff1f<\/h2>\n<p>\u6b6a\u5e08\u5085\u8fd8\u662f\u592a\u5e74\u8f7b\uff0c\u89c1\u8bc6\u4e0d\u591f\uff0c\u5728\u8fd9\u4e4b\u524d\u4ece\u6765\u6ca1\u89c1\u8fc7\u5728 mapper.xml \u91cc\u9762\u80fd\u8fd9\u6837\u53bb\u5199 sql \u7684\u3002<\/p>\n<p>\u4e0d\u8bf4\u89c1\u8fc7\uff0c\u5728\u6211\u7684\u5c0f\u8111\u888b\u91cc\u9762\uff0c\u6211\u662f\u538b\u6839\u5c31\u6ca1\u60f3\u8fc7\u8fd9\u6837\u53bb\u5199\u3002\u6240\u4ee5\u770b\u5230\u8fd9\u4e2a\u5199\u6cd5\u7684\u7b2c\u4e00\u53cd\u5e94\u662f\uff1a\u8fd9\u80fd\u884c\u5417\uff1f\u8fd9\u4e0d\u884c\u5427\uff1f<\/p>\n<p>\u4e8e\u662f\uff0c\u79c9\u627f\u7740\u5927\u80c6\u5047\u8bbe\u5c0f\u5fc3\u6c42\u8bc1\u7684\u6001\u5ea6\uff0c\u5199\u4e86\u4e0a\u9762\u7684 Demo\u3002<\/p>\n<p>\u9879\u76ee\u542f\u52a8\u4e4b\u540e\u53d1\u8d77\u8c03\u7528\uff0c\u63a7\u5236\u53f0\u76f4\u63a5\u62a5\u4e86\u9519\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133327\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u770b\u5230\u8fd9\u4e2a\u62a5\u9519\u7684\u65f6\u5019\uff0c\u6211\u4e0b\u610f\u8bc6\u7684\u89c9\u5f97\u5c31\u662f MyBatis \u4e0d\u652f\u6301\u8fd9\u6837\u7684\u5199\u6cd5\uff0c\u76f4\u63a5\u62a5\u9519\u4e86\uff0c\u8fd9\u4e5f\u7b26\u5408\u6211\u4e4b\u524d\u7684\u8ba4\u77e5\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u5728\u8bfb\u8005\u7684\u6307\u5bfc\u4e0b\uff0c\u4ed6\u63d0\u9192\u6211\u5728\u6570\u636e\u5e93\u8fde\u63a5\u7684\u914d\u7f6e\u4e0a\u52a0\u4e0a\u8fd9\u6837\u7684\u914d\u7f6e\uff1a<\/p>\n<blockquote><p>allowMultiQueries=true<\/p><\/blockquote>\n<p>\u6211\u7684 Demo \u542f\u52a8\u7684\u65f6\u5019\uff0c\u786e\u5b9e\u6ca1\u6709\u52a0\u8fd9\u4e2a\u914d\u7f6e\u3002\u4f46\u662f\u770b\u5230\u8fd9\u4e2a\u914d\u7f6e\u7684\u4e00\u77ac\u95f4\uff0c\u6211\u5f00\u59cb\u89c9\u5f97\u6709\u70b9\u610f\u601d\u4e86\u3002<\/p>\n<p>\u56e0\u4e3a\u6211\u77e5\u9053\u8fd9\u4e2a\u914d\u7f6e\u662f\u5e72\u561b\u7684\u3002<\/p>\n<p>\u89c1\u540d\u77e5\u610f\u561b\uff1aallow Multi Queries\uff0c\u5141\u8bb8\u8fdb\u884c\u591a\u4e2a\u67e5\u8be2\u3002<\/p>\n<p>\u6700\u5e38\u7528\u7684\u573a\u666f\u5c31\u662f\u7528 foreach \u6807\u7b7e\u6765\u8fdb\u884c\u6279\u91cf\u63d2\u5165\u6216\u8005\u66f4\u65b0\u7684\u65f6\u5019\u4f1a\u7528\u5230\u8fd9\u4e2a\u914d\u7f6e\u3002<\/p>\n<p>\u5728\u8fd9\u4e2a\u53c2\u6570\u7684\u52a0\u6301\u4e0b\uff0c\u524d\u9762 mapper.xml \u91cc\u9762\u7684\u5199\u7684\u90a3\u4e2a sql\uff0c\u5f88\u6709\u53ef\u80fd\u5c31\u80fd\u6b63\u5e38\u6267\u884c\u4e86\u3002<\/p>\n<p>\u56e0\u4e3a\u52a0\u5165\u8fd9\u4e2a\u914d\u7f6e\u4e4b\u540e\uff0c\u53ef\u4ee5\u5728\u4e00\u4e2a\u6570\u636e\u5e93\u8fde\u63a5\u4e2d\u6267\u884c\u591a\u4e2a sql \u8bed\u53e5\uff0c\u800c\u5bf9\u4e8e MyBatis \u6216\u8005 MySQL \u7684\u9a71\u52a8\u6765\u8bf4\uff0c\u5b83\u5e76\u4e0d\u533a\u8fd9\u201c\u591a\u4e2a sql\u201d\u90fd\u662f insert \u8bed\u53e5\u8fd8\u662f update \u8bed\u53e5\uff0c\u6216\u8005\u662f\u6df7\u5408\u7740\u90fd\u6709\u7684\u8bed\u53e5\u3002<\/p>\n<p>\u6211\u4e5f\u53bb MySQL \u5b98\u7f51\u4e0a\u67e5\u8be2\u4e86\u8fd9\u4e2a\u914d\u7f6e\u7684\u542b\u4e49\uff1a<\/p>\n<blockquote><p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=sTyHugeW4%2BhBLWpEqYIxWw%3D%3D.bzdBfFkaJ4Gstl7730JfT1GELdtbvwYMh2Ss7iRONgfWa6z06lynY799iNMFxXnbHYT7ibei1apy%2BkmyXWxbh4dnZP87lMAQ5PBo1Qp9F9UlGZI1WqhDY1TW8tyNC1CP6CSG1M%2FoCHa5qp1Scrpt%2FdlKtrMs7E2PBDaqOqwTOXk%3D\" rel=\"noopener noreferrer\">https:\/\/dev.mysql.com\/doc\/connector-j\/8.1\/en\/connector-j-conn&#8230;<\/a><\/p><\/blockquote>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133328\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5bf9\u4e8e\u8fd9\u4e2a\u53c2\u6570\uff0c\u5b98\u7f51\u4e0a\u5c31\u4e00\u53e5\u8bdd\uff1a<\/p>\n<blockquote><p>Allow the use of &#8220;;&#8221; to delimit multiple queries during one statement. This option does not affect the &#8216;addBatch()&#8217; and &#8216;executeBatch()&#8217; methods, which rely on &#8216;rewriteBatchStatements&#8217; instead.<br \/>\u5141\u8bb8\u5728\u4e00\u6761\u8bed\u53e5\u4e2d\u4f7f\u7528&#8221;; &#8220;\u5206\u9694\u591a\u4e2a\u67e5\u8be2\u3002\u8be5\u9009\u9879\u4e0d\u4f1a\u5f71\u54cd &#8220;addBatch() &#8220;\u548c &#8220;executeBatch() &#8220;\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u4eec\u4f9d\u8d56\u4e8e &#8220;rewriteBatchStatements&#8221;\u3002<\/p><\/blockquote>\n<p>\u5728\u4ecb\u7ecd allowMultiQueries \u7684\u65f6\u5019\uff0c\u8fd8\u63d0\u5230\u4e86\u4e00\u4e2a rewriteBatchStatements \u53c2\u6570\u3002<\/p>\n<p>\u5173\u4e8e\u8fd9\u4e2a\u53c2\u6570\u662f\u5e72\u5565\u7684\uff0c\u6211\u8fd9\u91cc\u5c31\u4e0d\u5c55\u5f00\u63cf\u8ff0\u4e86\uff0c\u6211\u53ea\u80fd\u8bf4\u8fd9\u4e24\u4e2a\u73a9\u610f\u662f\u4e00\u5957\u7ec4\u5408\u62f3\uff0c\u91cc\u9762\u4e5f\u5927\u6709\u6587\u7ae0\uff0c\u5982\u679c\u4f60\u4e0d\u77e5\u9053\uff0c\u5efa\u8bae\u4f60\u53bb\u4e86\u89e3\u4e00\u4e0b\u3002<\/p>\n<p>\u5c31\u5f53\u662f\u8bfe\u540e\u4e60\u9898\u4e86\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133329\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6211\u4eec\u8fd8\u662f\u5148\u8ddf\u7740\u4e3b\u5e72\u8d70\u3002<\/p>\n<p>\u5f53\u6211\u5728\u6570\u636e\u5e93\u8fde\u63a5\u4e0a\u8ffd\u52a0\u914d\u7f6e allowMultiQueries=true \u4e4b\u540e\uff0c\u91cd\u542f\u4e86\u670d\u52a1\u3002<\/p>\n<p>\u518d\u6b21\u53d1\u8d77\u8c03\u7528\u3002<\/p>\n<p>\u4e3a\u4e86\u8868\u793a\u6211\u7684\u9707\u60ca\uff0c\u6211\u7ed9\u4f60\u641e\u4e2a\u52a8\u56fe\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133330\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5e93\u5b58\u51cf\u4e00\uff0c\u8ba2\u5355\u52a0\u4e00\uff0c\u65b9\u6cd5\u6267\u884c\u6210\u529f\u4e86\u3002<\/p>\n<p>\u8fd8\u771f TM \u80fd\u7528\uff0c\u4f60\u8bf4\u8fd9\u4e8b\u641e\u7684\uff0c\u5b9e\u5c5e\u662f\u5f00\u4e86\u773c\u4e86\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133331\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u6ce2\u6da8\u77e5\u8bc6\u4e86\uff0c\u5c5e\u4e8e\u672a\u66fe\u8bbe\u60f3\u8fc7\u7684\u9053\u8def\u3002<\/p>\n<h2>\u57cb\u96f7<\/h2>\n<p>\u5343\u4e07\u522b\u8fd9\u6837\u5199\uff01<\/p>\n<p>\u542c\u6b6a\u5e08\u5085\u4e00\u53e5\u529d\uff0c\u5343\u4e07\u522b\u8fd9\u6837\u5199\uff01<\/p>\n<p>\u9996\u5148\u8fd9\u6837\u7684\u5199\u6cd5\u5c31\u4e0d\u7b26\u5408\u7edd\u5927\u90e8\u5206\u7a0b\u5e8f\u5458\u7684\u8ba4\u77e5\u3002<\/p>\n<p>\u8bd5\u95ee\u8c01\u80fd\u60f3\u5230\u6700\u540e\u7684 mapper.xml \u91cc\u9762\uff0c\u5e76\u4e0d\u53ea\u662f\u7b80\u7b80\u5355\u5355\u7684 sql\uff0c\u91cc\u9762\u5c45\u7136\u8fd8\u57cb\u5728\u4e00\u5768\u4e1a\u52a1\u903b\u8f91\u5462\uff1f<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133332\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5173\u952e\u662f\u8fd9\u6837\u5199\u4e5f\u57cb\u96f7\u554a\u3002<\/p>\n<p>\u4e3e\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u8fd9\u6837\u7684\u5199\u6cd5\uff0c\u5b8c\u5168\u6ca1\u6709\u8003\u8651\u5e93\u5b58\u662f\u5426\u8db3\u591f\u7684\u60c5\u51b5\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133325\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6bd4\u5982\uff0c\u5f53\u524d\u5e93\u5b58\u6ca1\u6709\u4e86\uff0c\u6309\u7167\u8fd9\u6837\u7684\u5199\u6cd5\uff0c\u8fd8\u662f\u4f1a\u5728 order_info \u8868\u91cc\u9762\u63d2\u5165\u4e00\u6761\u6570\u636e\u3002<\/p>\n<p>\u8d85\u5356\u4e86\uff0c\u670b\u53cb\u3002<\/p>\n<p>\u53ea\u6709 commit\uff0c\u6ca1\u6709\u8003\u8651\u56de\u6eda\u7684\u60c5\u51b5\u3002<\/p>\n<p>\u800c\u4e14\u8fd9\u6837\u5199\u6839\u672c\u5c31\u5b8c\u5168\u4e0d\u53ef\u80fd\u8003\u8651\u8d85\u5356\u7684\u60c5\u51b5\uff0c\u56e0\u4e3a\u4f60\u62ff\u4e0d\u5230\u6263\u51cf\u5e93\u5b58\u7684\u64cd\u4f5c\u662f\u5426\u6267\u884c\u6210\u529f\uff0c\u4ece\u800c\u65e0\u6cd5\u5224\u65ad\u662f\u9700\u8981 commit \u8fd8\u662f rollback\u3002<\/p>\n<p>\u4ec0\u4e48\uff0c\u4f60\u95ee\u6211\u80fd\u4e0d\u80fd\u5199\u5b58\u50a8\u8fc7\u7a0b\u6765\u5224\u65ad\uff1f<\/p>\n<p>\u80fd\uff0cMyBatis \u786e\u5b9e\u53ef\u4ee5\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u3002<\/p>\n<p>\u9996\u5148\uff0c\u5b58\u50a8\u8fc7\u7a0b\u8fd8\u662f\u5f97\u5728 MySQL \u91cc\u9762\u5199\u597d\uff0cMyBatis \u53ea\u662f\u53d1\u8d77\u8c03\u7528\u3002<\/p>\n<p>\u5176\u6b21\uff0c\u8d76\u7d27\u6253\u6d88\u4f60\u8fd9\u4e2a\u8d8a\u8d70\u8d8a\u8fdc\u7684\u9a9a\u60f3\u6cd5\uff0c\u8001\u8001\u5b9e\u5b9e\u7684\u5199 Java \u4ee3\u7801\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u5b83\u4e0d\u9999\u5417\uff1f<\/p>\n<p>\u4ec0\u4e48\uff0c\u4f60\u53c8\u95ee\u6211\u5982\u679c\u662f\u4e0d\u9700\u8981\u5224\u65ad\u524d\u4e00\u6761 sql \u662f\u5426\u6267\u884c\u6210\u529f\u7684\u573a\u666f\u5462\uff1f<\/p>\n<p>\u6bd4\u5982\u6211\u524d\u9762\u63d0\u5230\u7684\u8bfb\u8005\u4e3e\u7684\u4f8b\u5b50\uff0c\u51e0\u4e2a\u8868\u4e4b\u95f4\u6709\u5173\u8054\u5173\u7cfb\uff0c\u5982\u679c\u4e00\u4e2a\u8868\u7684\u67d0\u6761\u6570\u636e\u88ab\u5220\u9664\u4e86\uff0c\u53e6\u5916\u51e0\u4e2a\u8868\u91cc\u9762\u5bf9\u5e94\u7684\u6570\u636e\u4e5f\u8981\u5220\u9664\uff0c\u8fd8\u6709\u4e00\u4e2a\u8868\u9700\u8981\u66f4\u65b0\u72b6\u6001\u3002<\/p>\n<p>\u5927\u6982\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<pre><code>begin;\ndelete from table1 where user_id=xxx;\ndelete from table2 where user_id=xxx;\ndelete from table3 where user_id=xxx;\nupdate table4 set user_status=1 where user_id=xxx;\ncommit;<\/code><\/pre>\n<p>\u548c\u5356\u8d27\u7684\u573a\u666f\u4e0d\u4e00\u6837\u7684\u662f\uff0c\u5728\u8fd9\u4e2a\u573a\u666f\u4e0b\u5982\u679c\u6bcf\u4e2a sql \u6267\u884c\u6210\u529f\uff0c\u5219\u4ee3\u8868\u4e1a\u52a1\u6267\u884c\u6210\u529f\u3002<\/p>\n<p>\u770b\u8d77\u6765\uff0c\u4f3c\u4e4e\u6ca1\u4ec0\u4e48\u95ee\u9898\u3002<\/p>\n<p>\u4f46\u662f\u6211\u95ee\u4f60\u4e00\u4e2a\u95ee\u9898\uff1a\u8fd9\u4e00\u7ec4 SQL \u4e00\u5b9a\u4f1a\u8d70\u90fd commit \u5417\uff1f<\/p>\n<p>\u4f60\u597d\u597d\u60f3\u60f3\uff1f<\/p>\n<p>\u80af\u5b9a\u4e0d\u4e00\u5b9a\u561b\uff0c\u4fdd\u4e0d\u9f50\u6267\u884c\u7684\u8fc7\u7a0b\u4e2d\u51fa\u4ec0\u4e48\u5e7a\u86fe\u5b50\u3002<\/p>\n<p>\u4e3e\u4e2a\u6700\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u8868\u5199\u9519\u4e86\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133333\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728\u8fd9\u4e2a\u573a\u666f\u4e0b\uff0c\u518d\u6b21\u53d1\u8d77\u8c03\u7528\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133334\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u7a0b\u5e8f\u62a5\u9519\u8bf4\u627e\u4e0d\u5230\u8fd9\u4e2a\u8868\u3002<\/p>\n<p>\u90a3\u4e48\u8bf7\u95ee\uff1a\u6b64\u65f6\uff0c\u8ba2\u5355\u8868\u662f\u5426\u5e94\u8be5\u6709\u6570\u636e\u88ab\u63d2\u5165\uff1f<\/p>\n<p>\u51fa\u5f02\u5e38\u4e86\uff0c\u80af\u5b9a\u4e0d\u5e94\u8be5\u6709\u6570\u636e\u63d2\u5165\u3002\u6211\u770b\u4e86\u6570\u636e\u5e93\uff0c\u786e\u5b9e\u4e5f\u6ca1\u6709\u65b0\u6570\u636e\u63d2\u5165\u3002<\/p>\n<p>\u770b\u8d77\u6765\u786e\u5b9e\u6ca1\u95ee\u9898\u3002<\/p>\n<p>\u90a3\u4e48\u518d\u8bf7\u95ee\uff1a\u5728\u8fd9\u79cd\u5199\u6cd5\u7684\u60c5\u51b5\u4e0b\uff0c\u5f53\u524d\u8fd9\u4e2a\u4e8b\u52a1\u662f\u88ab\u56de\u6eda\u4e86\u8fd8\u662f\u88ab\u63d0\u4ea4\u4e86\uff1f<\/p>\n<p>\u3002\u3002\u3002<\/p>\n<p>\u3002\u3002\u3002<\/p>\n<p>\u3002\u3002\u3002<\/p>\n<p>\u6b63\u786e\u7b54\u6848\u662f\u88ab\u6302\u8d77\u4e86\u3002<\/p>\n<p>\u901a\u8fc7\u6267\u884c\u4e0b\u9762\u8fd9\u4e2a SQL\uff0c\u6211\u4eec\u53ef\u4ee5\u83b7\u53d6\u5230\u5f53\u524d\u4e8b\u52a1\u5217\u8868\uff1a<\/p>\n<blockquote><p>SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;<\/p><\/blockquote>\n<p>\u901a\u8fc7\u67e5\u8be2\u7ed3\u679c\u53ef\u4ee5\u53d1\u73b0\uff0c\u5728\u6211\u4eec\u7a0b\u5e8f\u629b\u51fa\u5f02\u5e38\u4e4b\u540e\uff0c\u5f53\u524d\u4e8b\u52a1\u8fd8\u5728 RUNNING \u72b6\u6001\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133335\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u800c\u4e14\uff0c\u8fd9\u4e2a\u4e8b\u52a1\u5728\u670d\u52a1\u91cd\u542f\u4e4b\u524d\uff0c\u5c06\u4e00\u76f4\u5728 RUNNING \u72b6\u6001\uff0c\u5373\u88ab\u6302\u8d77\u4e86\u3002<\/p>\n<p>\u4f46\u4ec5\u4ece\u7a0b\u5e8f\u7684\u89d2\u5ea6\u770b\uff0c\u629b\u51fa\u5f02\u5e38\uff0c\u6ca1\u6709\u6570\u636e\uff0c\u7b26\u5408\u9884\u671f\uff0c\u6ca1\u6709\u4efb\u4f55\u6bdb\u75c5\u3002<\/p>\n<p>\u57cb\u96f7\u4e86\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u542c\u6b6a\u5e08\u5085\u4e00\u53e5\u529d\uff0c\u5343\u4e07\u522b\u8fd9\u6837\u5199\uff01<\/p>\n<p>\u8001\u8001\u5b9e\u5b9e\u7684\u5199\u5927\u5bb6\u90fd\u770b\u5f97\u61c2\u7684 Java \u4ee3\u7801\uff0c\u4e0d\u8981\u5728 mapper.xml \u91cc\u9762\u641e\u4e8b\u60c5\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133336\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>\u6269\u5c55<\/h2>\n<p>\u5176\u5b9e\u6211\u89c9\u5f97\u5427\uff0c\u524d\u9762\u90fd\u5c5e\u4e8e\u5375\u7528\u4e0d\u5927\u7684\u77e5\u8bc6\u70b9\uff0c\u56e0\u4e3a\u5927\u5bb6\u4e00\u822c\u90fd\u4e0d\u4f1a\u8fd9\u6837\u53bb\u5199\u3002<\/p>\n<p>\u4f46\u662f\u65e2\u7136\u90fd\u5199\u5230\u8fd9\u91cc\u4e86\uff0c\u573a\u666f\u4e5f\u6709\u4e86\uff0c\u6211\u4e5f\u7ed9\u5927\u5bb6\u6269\u5c55\u4e00\u4e2a\u7a0d\u5fae\u6709\u70b9\u7528\u7684\u77e5\u8bc6\u3002<\/p>\n<p>\u8fd8\u662f\u5728\u5356\u8d27\u7684\u573a\u666f\u4e0b\u3002<\/p>\n<p>\u8ba2\u5355\u52a0\u4e00\uff0c\u5e93\u5b58\u51cf\u4e00\u662f\u8fd9\u6837\u7684\u3002<\/p>\n<pre><code>begin;\nINSERT INTO order_info(`buy_name`, `buy_goods`) VALUES ('\u6b6a\u5e08\u5085', 'ipad pro\u9876\u914d\u7248');\nupdate product set product_count=product_count-1 where id=1 and product_count&gt;0;\ncommit;<\/code><\/pre>\n<p>\u800c\u5e93\u5b58\u51cf\u4e00\uff0c\u8ba2\u5355\u52a0\u4e00\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<pre><code>begin;\nupdate product set product_count=product_count-1 where id=1 and product_count&gt;0;\nINSERT INTO order_info(`buy_name`, `buy_goods`) VALUES ('\u6b6a\u5e08\u5085', 'ipad pro\u9876\u914d\u7248');\ncommit;<\/code><\/pre>\n<p>\u90fd\u662f\u5305\u88f9\u5728\u4e8b\u52a1\u91cc\u9762\uff0c\u4e3a\u4e86\u7b80\u5316\u4ee3\u7801\uff0c\u6211\u4eec\u5047\u8bbe\u5e93\u5b58\u975e\u5e38\u591f\u7528\uff0c\u5148\u4e0d\u8003\u8651 rollback \u7684\u573a\u666f\u3002<\/p>\n<p>\u8bf7\u95ee\u662f\u201c\u8ba2\u5355\u52a0\u4e00\uff0c\u5e93\u5b58\u51cf\u4e00\u201d\u7684\u6027\u80fd\u597d\uff0c\u8fd8\u662f\u201c\u5e93\u5b58\u51cf\u4e00\uff0c\u8ba2\u5355\u52a0\u4e00\u201d\u7684\u6027\u80fd\u597d\uff0c\u8fd8\u662f\u8bf4\u8fd9\u4e8c\u8005\u6ca1\u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133337\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u9996\u5148\uff0c\u4ece\u6267\u884c\u7ed3\u679c\u4e0a\u770b\uff0c\u8fd9\u4e8c\u8005\u786e\u5b9e\u662f\u6ca1\u6709\u4ec0\u4e48\u533a\u522b\u7684\uff0c\u90fd\u80fd\u4fdd\u8bc1\u4e1a\u52a1\u573a\u666f\u7684\u6b63\u786e\u6027\u3002<\/p>\n<p>\u4f46\u662f\u5f53\u4f60\u8003\u8651\u6027\u80fd\u7684\u65f6\u5019\uff0c\u80af\u5b9a\u662f\u201c\u8ba2\u5355\u52a0\u4e00\uff0c\u5e93\u5b58\u51cf\u4e00\u201d\u7684\u6027\u80fd\u66f4\u597d\u3002<\/p>\n<p>\u5982\u679c\u4f60\u6ca1\u60f3\u660e\u767d\u7684\u8bdd\uff0c\u6211\u7ed9\u4f60\u4e00\u4e2a\u7b80\u5355\u7684\u63d0\u793a\uff1a\u5728\u4e1a\u52a1\u6b63\u786e\u7684\u524d\u63d0\u4e0b\uff0c\u52a0\u9501\u7684\u4ee3\u7801\u8d8a\u9760\u8fd1\u89e3\u9501\u7684\u4ee3\u7801\uff0c\u662f\u4e0d\u662f\u6027\u80fd\u8d8a\u597d\uff1f<\/p>\n<p>\u5982\u679c\u4f60\u8fd8\u6ca1\u60f3\u660e\u767d\u7684\u8bdd\uff0c\u6211\u518d\u7ed9\u4f60\u4e00\u4e2a\u63d0\u793a\uff1a\u5e93\u5b58\u51cf\u4e00\uff0c\u5b83\u4f1a\u52a0\u9501\u5417\uff1f\u4f60\u4e0d\u7ba1\u5b83\u662f\u52a0\u8868\u9501\u3001\u95f4\u9699\u9501\u8fd8\u662f\u8bb0\u5f55\u9501\uff0c\u6211\u5c31\u95ee\u4f60\u5b83\u52a0\u4e0d\u52a0\u9501\uff1f<\/p>\n<p>\u5982\u679c\u4f60\u8fd8\u6ca1\u53cd\u5e94\u8fc7\u6765\u7684\u8bdd\uff0c\u8bf4\u660e\u4f60\u5bf9\u4e8e MySQL \u7684\u52a0\u9501\u673a\u5236\u638c\u63e1\u7684\u6709\u70b9\u8584\u5f31\uff0c\u53ef\u4ee5\u53bb\u52a0\u56fa\u4e00\u4e0b\u3002<\/p>\n<p>\u6211\u76f4\u63a5\u516c\u5e03\u7b54\u6848\u4e86\uff1a<\/p>\n<blockquote><p>update product set product_count=product_count-1 where id=1 and product_count&gt;0;<\/p><\/blockquote>\n<p>\u56e0\u4e3a where \u6761\u4ef6\u4e2d\u662f id=1\uff0c\u6240\u4ee5\u9501\u662f\u52a0\u5728\u552f\u4e00\u7d22\u5f15\u4e0a\u7684\uff0c\u800c\u4e14\u8868\u4e2d\u5b58\u5728\u8be5\u8bb0\u5f55\uff0c\u6240\u4ee5\u53ea\u4f1a\u5bf9 id=1 \u8fd9\u884c\u8bb0\u5f55\u52a0\u9501\u3002<\/p>\n<p>\u9488\u5bf9 id=1 \u8fd9\u4e00\u4e2a\u4ea7\u54c1\u6765\u8bf4\uff0c\u5982\u679c\u5b83\u662f\u4e00\u4e2a\u70ed\u70b9\u5546\u54c1\uff0c\u6211\u4eec\u91c7\u53d6\u201c\u8ba2\u5355\u52a0\u4e00\uff0c\u5e93\u5b58\u51cf\u4e00\u201d\u7684\u5199\u6cd5\uff0c\u6027\u80fd\u4f1a\u66f4\u9ad8\u4e00\u70b9\u3002<\/p>\n<p>\u56e0\u4e3a\u5728\u52a0\u9501\u9891\u7387\u76f8\u540c\u7684\u60c5\u51b5\u4e0b\uff0c\u89e3\u9501\u8d8a\u5feb\u7684\uff0c\u6027\u80fd\u8d8a\u9ad8\u3002<\/p>\n<p>\u4e0a\u4e2a\u56fe\u4f60\u5c31\u660e\u767d\u4e86\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133338\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8c03\u6362\u4e00\u4e2a SQL \u7684\u4e8b\u513f\uff0c\u6027\u80fd\u5c31\u4e0a\u53bb\u4e86\uff0c\u6211\u5c31\u95ee\u4f60\u8212\u4e0d\u8212\u670d\uff1f<\/p>\n<p>\u6700\u540e\uff0c\u518d\u8bf4\u4e2a\u4e0d\u76f8\u5173\u7684\uff1a<\/p>\n<p>\u6211\u5728\u6587\u7ae0\u6700\u5f00\u59cb\u7684\u5730\u65b9\u7ed9\u4e86\u8fd9\u6837\u7684\u4e00\u4e2a\u56fe\u7247\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133324\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4f60\u4e0d\u89c9\u5f97\u522b\u626d\u5417\uff1f<\/p>\n<p>sela \u662f\u4ec0\u4e48\u9b3c\uff1f<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133339\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5f88\u660e\u663e\uff0c\u8fd9\u4e2a\u5730\u65b9\u662f\u4e00\u4e2a\u5355\u7eaf\u7684\u62fc\u5199\u9519\u8bef\uff0c\u60f3\u8981\u6253\u51fa\u7684\u5355\u8bcd\u662f sale\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133340\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8bf7\u95ee\uff0c\u5f53\u4f60\u5728\u7a0b\u5e8f\u91cc\u9762\u770b\u5230\u8fd9\u6837\u7684\u62fc\u5199\u7684\u65f6\u5019\uff0c\u4f60\u4f1a\u600e\u4e48\u529e\uff1f<\/p>\n<p>\u5982\u679c\u662f\u6211\uff0c\u6211\u4f1a\u4e3b\u52a8\u628a selaProduct \u4fee\u6539\u4e3a saleProduct\uff0c\u5176\u4ed6\u4ec0\u4e48\u90fd\u4e0d\u4f1a\u52a8\u3002<\/p>\n<p>\u8fd9\u5c31\u662f\u6211\u5728\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\u63d0\u5230\u7684\u4e00\u4e2a\u7f16\u7801\u89c4\u5219\uff0c\u7ae5\u5b50\u519b\u519b\u89c4\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133341\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4fee\u6539\u4e00\u4e2a\u62fc\u5199\u9519\u8bef\u7684\u65b9\u6cd5\u540d\u3001\u53d8\u91cf\u540d\uff0c\u5728\u4ee3\u7801\u91cc\u9762\u4e5f\u662f\u4e00\u4ef6\u5f88\u91cd\u8981\u7684\u5c0f\u4e8b\u3002<\/p>\n<p>\u8fd9\u4e0d\u662f\u4ee3\u7801\u6d01\u7656\uff0c\u8fd9\u662f\u57fa\u672c\u7684\u804c\u4e1a\u9053\u5fb7\u3002<\/p>\n<p>\u56e0\u4e3a\u4f60\u4e5f\u4e0d\u60f3\u4e0b\u4e00\u4e2a\u63a5\u624b\u4f60\u4ee3\u7801\u7684\u4eba\uff0c\u56e0\u4e3a\u770b\u5230\u4e00\u5806\u53eb\u505a\u201csucceess\u3001createTiem\u3001lastUpdataBy\u3001bussinessDate\u3001proudectName\u201d\u7b49\u7b49\u8fd9\u4e9b\u53d8\u91cf\u540d\u800c\u8840\u538b\u4e0a\u5347\uff0c\u6c14\u5927\u4f24\u8eab\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044133342\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044133319\">https:\/\/segmentfault.com\/a\/1190000044133319<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u597d\u5440\uff0c\u6211\u662f\u6b6a\u6b6a\u3002 \u8fd9\u671f\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e2a\u8bfb\u8005\u7ed9\u6211\u5206\u4eab\u7684\u4e00\u4e2a\u5173\u4e8e MyBatis \u7684\u201c\u7f16\u7a0b\u5c0f\u6280\u5de7\u201d\uff0c\u8bf4\u771f\u7684\uff0c\u8fd9\u9a9a\u64cd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008123","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008123"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008123\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}