{"id":16132,"date":"2023-02-10T17:40:26","date_gmt":"2023-02-10T09:40:26","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=16132"},"modified":"2023-02-10T17:40:30","modified_gmt":"2023-02-10T09:40:30","slug":"ibatis%e5%92%8cmybatis%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/16132.html","title":{"rendered":"ibatis\u548cmybatis\u6709\u4ec0\u4e48\u533a\u522b"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\">\n<p>ibatis\u548cmybatis\u7684\u533a\u522b\u662f\uff1a1. \u4f20\u5165\u53c2\u6570\uff1b2. \u63a5\u6536\u53c2\u6570\uff1b3. \u5224\u65ad\u8bed\u53e5\uff1b4. \u5faa\u73af\u7684\u4f7f\u7528\u3002\u5176\u4e2d\uff0ciBatis\u662fparameterClass\uff0c\u800cMyBatis\u662f\u53ef\u4ee5\u4e0d\u5199\u7684\uff0c\u4e5f\u53ef\u4ee5\u7528parameterType;parameterClass\uff0c\u800cMyBatis\u662f\u53ef\u4ee5\u4e0d\u5199\u7684\uff0c\u4e5f\u53ef\u4ee5\u7528parameterType\u3002<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"680\" height=\"421\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/02\/\u6dfb\u52a0\u6807\u9898-9-6.png?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\" class=\"wp-image-16133\" srcset=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/02\/\u6dfb\u52a0\u6807\u9898-9-6.png 680w, https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/02\/\u6dfb\u52a0\u6807\u9898-9-6-300x186.png 300w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001ibatis\u548cmybatis\u7684\u533a\u522b<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1.<\/strong><strong>\u4f20\u5165\u53c2\u6570<\/strong><\/h3>\n\n\n\n<p>iBatis\u662fparameterClass\uff0c\u800cMyBatis\u662f\u53ef\u4ee5\u4e0d\u5199\u7684\uff0c\u4e5f\u53ef\u4ee5\u7528parameterType;parameterClass\uff0c\u800cMyBatis\u662f\u53ef\u4ee5\u4e0d\u5199\u7684\uff0c\u4e5f\u53ef\u4ee5\u7528parameterType;<br>iBatis\u7684\u4f20\u51fa\u53c2\u6570\u5173\u952e\u5b57\u662f\uff1aresultClass\uff0c\u800cMyBatis\u662fresultMap\u3002<br>iBatis\uff1a &lt;select id=&#8221;selectDeviceByWhere&#8221; parameterClass=&#8221;Map&#8221; resultClass=&#8221;BaseResultMap&#8221;&gt; &lt;\/select&gt;<br>MyBatis\uff1a&lt;select id=&#8221;selectDeviceByWhere&#8221; parameterType=&#8221;Map&#8221; resultMap=&#8221;BaseResultMap&#8221;&gt; &lt;\/select&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2.<\/strong><strong>\u63a5\u6536\u53c2\u6570<\/strong><\/h3>\n\n\n\n<p>IBatis\u662f\u4f7f\u7528# #\u548c$ KaTeX parse error: Expected &#8216;EOF&#8217;, got &#8216;#&#8217; at position 23: \u2026\u4f7f\u7528\u65b9\u6cd5\u7b49\u540c\u4e8eMyBatis;#\u0332 #=#{ }, ==={ } \uff0c\u89e3\u91ca\u4e00\u4e0b#\u548cKaTeX parse error: Expected &#8216;EOF&#8217;, got &#8216;#&#8217; at position 5: \u7684\u533a\u522b\uff0c#\u0332\u5b57\u7b26\u4e32\u5904\u7406\uff0c\u52a0\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u4e00\u5b9a\u2026\u76f4\u63a5\u4f7f\u7528\uff0c\u5f53\u4f20\u5165\u7684\u662f\u6570\u5b57\u65f6\uff0c\u7528#\u4f1a\u8fdb\u884c\u9690\u5f0f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u8017\u6027\u80fd\u3002IBatis\u662f\u4f7f\u7528# #\u548c$ KaTeX parse error: Expected &#8216;EOF&#8217;, got &#8216;#&#8217; at position 23: \u2026\u4f7f\u7528\u65b9\u6cd5\u7b49\u540c\u4e8eMyBatis;#\u0332 #=#{ }, ==={ } \uff0c\u89e3\u91ca\u4e00\u4e0b#\u548cKaTeX parse error: Expected &#8216;EOF&#8217;, got &#8216;#&#8217; at position 5: \u7684\u533a\u522b\uff0c#\u0332\u5b57\u7b26\u4e32\u5904\u7406\uff0c\u52a0\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u4e00\u5b9a\u2026\u76f4\u63a5\u4f7f\u7528\uff0c\u5f53\u4f20\u5165\u7684\u662f\u6570\u5b57\u65f6\uff0c\u7528#\u4f1a\u8fdb\u884c\u9690\u5f0f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u8017\u6027\u80fd\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3.<\/strong><strong>\u5224\u65ad\u8bed\u53e5<\/strong><\/h3>\n\n\n\n<p>\u8fd9\u4e2a\u4e5f\u662f\u975e\u5e38\u5e38\u7528\u548c\u91cd\u8981\u7684\u5730\u65b9\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8eMyBatis\u7684\u5f88\u7b80\u5355\uff0c\u53ea\u8981\u5728where \u6216\u8005if \u7684\u6807\u7b7e\u91cc\u9762\u6dfb\u52a0test=&#8221;&#8221;\u5c31\u53ef\u4ee5\u4e86\uff0c\u91cc\u9762\u5199\u5224\u65ad\u6761\u4ef6\u4e86\u3002\u4f46\u662fIBatis\u7684\u5c31\u9ebb\u70e6\u4e86\u8bb8\u591a\u4e86\uff0c\u5b83\u5c06\u6bcf\u4e2a\u90fd\u65b9\u6cd5\u90fd\u8fdb\u884c\u4e86\u5c01\u88c5\u3002\u4f8b\u5982<\/p>\n\n\n\n<p>isNull\uff1a\u5224\u65adproperty\u5b57\u6bb5\u662f\u5426\u662fnull<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.<\/strong><strong>\u5faa\u73af\u7684\u4f7f\u7528<\/strong><\/h3>\n\n\n\n<p>iBatis\u662f\u4f7f\u7528Iterate\uff1a\u8fd9\u5c5e\u6027\u904d\u5386\u6574\u4e2a\u96c6\u5408\uff0c\u5e76\u4e3a java.util.List \u96c6\u5408\u4e2d\u7684\u5143\u7d20\u91cd\u590d\u5143\u7d20\u4f53\u7684\u5185\u5bb9\u3002\u4f8b\u5982<\/p>\n\n\n\n<p>&lt;isNotEmpty property=&#8221;deptIds&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and dept_id in<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;iterate property=&#8221;deptIds&#8221; open=&#8221;(&#8221; close=&#8221;)&#8221; conjunction=&#8221;,&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #deptIds[]#<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/iterate&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; &lt;\/isNotEmpty&gt;<\/p>\n\n\n\n<p>deptIds\u662f\u6570\u7ec4\u7c7b\u578b\u7684\u5c5e\u6027\u503c\uff0c\u5f53deptIds\u4e0d\u4e3anull\u6216\u201c\u201d\u65f6\uff0c\u8fdb\u884cdeptIds\u904d\u5386\u53d6\u503c\u3002<\/p>\n\n\n\n<p>MyBatis\u4f7f\u7528\u7684\u662fForEach\u65b9\u6cd5\u3002\u4ed6\u53ef\u4ee5\u904d\u5386List,,Map\u4e09\u79cd\u5143\u7d20\u3002<\/p>\n\n\n\n<p><strong>\u5ef6\u4f38\u9605\u8bfb\uff1a<br><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001ibatis\u8fc7\u6e21\u4e3amybatis<\/strong><\/h2>\n\n\n\n<p>\u5bf9\u4e8e\u4ece\u4e8bJava EE\u7684\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0ciBatis \u662f\u4e00\u4e2a\u518d\u719f\u6089\u4e0d\u8fc7\u7684\u6301\u4e45\u5c42\u6846\u67b6\u4e86\uff0ciBatis \u53ef\u4ee5\u7b97\u662f\u5728\u6240\u6709\u4e3b\u6d41\u7684\u6301\u4e45\u5c42\u6846\u67b6\u4e2d\u5b66\u4e60\u6210\u672c\u6700\u4f4e\uff0c\u6700\u5bb9\u6613\u4e0a\u624b\u548c\u638c\u63e1\u7684\u6846\u67b6\u3002\u867d\u8bf4\u5176\u4ed6\u6301\u4e45\u5c42\u6846\u67b6\u4e5f\u53f7\u79f0\u95e8\u69db\u4f4e\uff0c\u5bb9\u6613\u4e0a\u624b\uff0c\u4f46\u662f\u7b49\u5230\u4f60\u771f\u6b63\u4f7f\u7528\u65f6\u4f1a\u53d1\u73b0\uff0c\u8981\u60f3\u638c\u63e1\u5e76\u7528\u597d\u5b83\u662f\u4e00\u4ef6\u975e\u5e38\u56f0\u96be\u7684\u4e8b\u3002<\/p>\n\n\n\n<p>iBatis \u81ea\u4ece\u5728Apache\u8f6f\u4ef6\u57fa\u91d1\u4f1a\u7f51\u7ad9\u4e0a\u53d1\u5e03\u81f3\u4eca\uff0c\u548c\u4ed6\u7684\u660e\u661f\u5144\u5f1f\u4eec\uff08Http Server\uff0cTomcat\uff0cStruts\uff0cMaven\uff0cAnt\u7b49\u7b49\uff09\u4e00\u8d77\u63a5\u53d7\u8005\u4e07\u5343 Java \u5f00\u53d1\u8005\u7684\u656c\u4ef0\u3002\u7136\u800c\u5728\u5f53\u65f6\uff0c\u51e0\u4e4e\u662f\u53d1\u5e03 3.0\u7248\u672c\u7684\u540c\u65f6\uff0ciBatis\u4e3b\u9875\u4e0a\u7684\u4e00\u5219Apache iBATIS has been retired(\u9000\u4f11)\u7684\u58f0\u660e\u5728\u793e\u533a\u5f15\u8d77\u4e86\u4e00\u9635\u4e0d\u5c0f\u7684\u6ce2\u6f9c\u3002\u5728Apache\u5bc4\u5c45\u516d\u5e74\u4e4b\u540e\uff0ciBatis\u5c06\u4ee3\u7801\u6258\u7ba1\u5230Google Code\u3002\u5728\u58f0\u660e\u4e2d\u7ed9\u51fa\u7684\u4e3b\u8981\u7406\u7531\u662f\uff0c\u548cApache\u76f8\u6bd4\uff0cGoogle Code\u66f4\u6709\u5229\u4e8e\u5f00\u53d1\u8005\u7684\u534f\u540c\u5de5\u4f5c\uff0c\u4e5f\u66f4\u80fd\u9002\u5e94\u5feb\u901f\u53d1\u5e03\u3002\u4e8e\u6b64\u540c\u65f6\uff0ciBatis \u66f4\u540d\u4e3a MyBatis<\/p>\n\n\n\n<p>\u4eceiBatis\u5230MyBatis\uff0c\u4e0d\u53ea\u662f\u540d\u79f0\u4e0a\u7684\u53d8\u5316\uff0cMyBatis\u63d0\u4f9b\u4e86\u66f4\u4e3a\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u540c\u65f6\u5e76\u6ca1\u6709\u635f\u5931\u5176\u6613\u7528\u6027\uff0c\u76f8\u53cd\uff0c\u5728\u5f88\u591a\u5730\u65b9\u90fd\u501f\u52a9\u4e8eJDK\u7684\u6cdb\u578b\u548c\u6ce8\u89e3\u7279\u6027\u8fdb\u884c\u4e86\u7b80\u5316\u3002iBatis \u786e\u5b9e\u8be5\u9000\u4f11\u4e86\uff0c\u56e0\u4e3a\u4e00\u4e2a\u66f4\u4e3a\u51fa\u8272\u7684\u7ee7\u4efb\u8005\u7ecf\u8fc7 10\u4e2a Beta \u7248\u672c\u7684\u8715\u53d8\u5df2\u7136\u51fa\u73b0\u5728\u6211\u4eec\u7684\u9762\u524d\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u5c31\u662f\u5173\u4e8eibatis\u548cmybatis\u7684\u533a\u522b\u7684\u5185\u5bb9\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"ibatis\u548cmybatis\u7684\u533a\u522b\u662f\uff1a1. \u4f20\u5165\u53c2\u6570\uff1b2. \u63a5\u6536\u53c2\u6570\uff1b3. \u5224\u65ad\u8bed\u53e5\uff1b4. \u5faa\u73af\u7684\u4f7f\u7528\u3002\u5176\u4e2d\uff0c [&hellip;]","protected":false},"author":1,"featured_media":16133,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/16132"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=16132"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/16132\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/16133"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=16132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=16132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=16132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}