{"id":27165,"date":"2024-11-24T13:19:49","date_gmt":"2024-11-24T05:19:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27165\/"},"modified":"2024-11-24T13:19:49","modified_gmt":"2024-11-24T05:19:49","slug":"mybatis-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%97%b6%e6%8b%a6%e6%88%aa%e5%99%a8%e5%a4%b1%e6%95%88%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27165\/","title":{"rendered":"MyBatis \u6279\u91cf\u63d2\u5165\u65f6\u62e6\u622a\u5668\u5931\u6548\u5982\u4f55\u89e3\u51b3\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173120225112181.jpg\" class=\"aligncenter\" title=\"MyBatis \u6279\u91cf\u63d2\u5165\u65f6\u62e6\u622a\u5668\u5931\u6548\u5982\u4f55\u89e3\u51b3\uff1f\u63d2\u56fe\" alt=\"MyBatis \u6279\u91cf\u63d2\u5165\u65f6\u62e6\u622a\u5668\u5931\u6548\u5982\u4f55\u89e3\u51b3\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>mybatis\u62e6\u622a\u5668\u5728\u6279\u91cf\u63d2\u5165\u6570\u636e\u65f6\u5931\u6548\u7684\u89e3\u51b3\u529e\u6cd5<\/strong><\/p>\n<p>\u5728mybatis\u4e2d\u4f7f\u7528\u62e6\u622a\u5668\u5bf9\u6570\u636e\u8fdb\u884c\u81ea\u52a8\u586b\u5145\u65f6\uff0c\u5982\u679c\u6279\u91cf\u63d2\u5165\u65f6\u62e6\u622a\u5668\u5931\u6548\uff0c\u539f\u56e0\u53ef\u80fd\u662f\u4e0d\u5f53\u7684\u62e6\u622a\u65b9\u6cd5\u7b7e\u540d\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u62e6\u622a\u5668\u53ea\u62e6\u622aexecutor\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\uff0c\u800c\u4e0d\u62e6\u622astatementhandler\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u6279\u91cf\u63d2\u5165\u65f6\u65e0\u6cd5\u751f\u6548\u3002<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\u662f\u4fee\u6539\u62e6\u622a\u5668\u7684\u6ce8\u89e3\uff0c\u540c\u65f6\u62e6\u622aexecutor\u548cstatementhandler\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>@Intercepts({\n    @Signature(type = Executor.class, method = \"update\", args = {MappedStatement.class, Object.class}),\n    @Signature(type = StatementHandler.class, method = \"update\", args = {Statement.class})\n})\npublic class MyBatisAutoFillPlugin implements Interceptor {\n    \/\/ \u539f\u6709\u4ee3\u7801\u7701\u7565\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u901a\u8fc7\u4fee\u6539\u62e6\u622a\u5668\u7b7e\u540d\uff0c\u5c06statementhandler\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\u4e5f\u7eb3\u5165\u62e6\u622a\u8303\u56f4\uff0c\u5373\u53ef\u786e\u4fdd\u6279\u91cf\u63d2\u5165\u65f6\u4e5f\u80fd\u89e6\u53d1\u62e6\u622a\u5668\uff0c\u4ece\u800c\u5b9e\u73b0\u81ea\u52a8\u586b\u5145\u529f\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMyBatis \u6279\u91cf\u63d2\u5165\u65f6\u62e6\u622a\u5668\u5931\u6548\u5982\u4f55\u89e3\u51b3\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mybatis\u62e6\u622a\u5668\u5728\u6279\u91cf\u63d2\u5165\u6570\u636e\u65f6\u5931\u6548\u7684\u89e3\u51b3\u529e\u6cd5 \u5728mybatis\u4e2d\u4f7f\u7528\u62e6\u622a\u5668\u5bf9\u6570\u636e\u8fdb\u884c\u81ea\u52a8\u586b\u5145\u65f6\uff0c\u5982\u679c\u6279\u91cf\u63d2\u5165\u65f6\u62e6\u622a\u5668\u5931\u6548\uff0c\u539f\u56e0\u53ef\u80fd\u662f\u4e0d\u5f53\u7684\u62e6\u622a\u65b9\u6cd5\u7b7e\u540d\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u62e6\u622a\u5668\u53ea\u62e6\u622aexecutor\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\uff0c\u800c\u4e0d\u62e6\u622astatementhandler\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u6279\u91cf\u63d2\u5165\u65f6\u65e0\u6cd5\u751f\u6548\u3002 \u89e3\u51b3\u529e\u6cd5\u662f\u4fee\u6539\u62e6\u622a\u5668\u7684\u6ce8\u89e3\uff0c\u540c\u65f6\u62e6\u622aexecutor\u548cstatementhandler\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a @Intercepts({ @Signature(type = Executor.class, method = &#8220;update&#8221;, args = {MappedStatement.class, Object.class}), @Signature(type = StatementHandler.class, method = &#8220;update&#8221;, args = {Statement.class}) }) public class MyBatisAutoFillPlugin implements Interceptor { \/\/ \u539f\u6709\u4ee3\u7801\u7701\u7565 } \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u4fee\u6539\u62e6\u622a\u5668\u7b7e\u540d\uff0c\u5c06statementhandler\u5bf9\u8c61\u4e0a\u7684\u201cupdate\u201d\u65b9\u6cd5\u4e5f\u7eb3\u5165\u62e6\u622a\u8303\u56f4\uff0c\u5373\u53ef\u786e\u4fdd\u6279\u91cf\u63d2\u5165\u65f6\u4e5f\u80fd\u89e6\u53d1\u62e6\u622a\u5668\uff0c\u4ece\u800c\u5b9e\u73b0\u81ea\u52a8\u586b\u5145\u529f\u80fd\u3002 \u4ee5\u4e0a\u5c31\u662fMyBatis \u6279\u91cf\u63d2\u5165\u65f6\u62e6\u622a\u5668\u5931\u6548\u5982\u4f55\u89e3\u51b3\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-27165","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=27165"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27165\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}