{"id":6399,"date":"2022-07-13T22:21:30","date_gmt":"2022-07-13T14:21:30","guid":{"rendered":"http:\/\/123.57.164.21\/?p=6399"},"modified":"2022-07-13T22:21:30","modified_gmt":"2022-07-13T14:21:30","slug":"mybatis%e4%b8%ad%e7%9a%84resultmap%e8%ae%b2%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=6399","title":{"rendered":"Mybatis\u4e2d\u7684resultMap\u8bb2\u89e3"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\"><strong>\u524d\u8a00<\/strong><\/h5>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u4f7f\u7528<a rel=\"noreferrer noopener\" href=\"https:\/\/so.csdn.net\/so\/search?q=mybatis&amp;spm=1001.2101.3001.7020\" target=\"_blank\">mybatis<\/a>\uff0c\u6709\u4e24\u4e2a\u5c5e\u6027\u6807\u7b7e<code>&lt;resultType><\/code>\u3001<code>&lt;resultMap><\/code>\u53ef\u4ee5\u63d0\u4f9b\u7ed3\u679c\u6620\u5c04\u3002<\/p>\n\n\n\n<p>\u867d\u7136<code>resultType<\/code> \u5c5e\u6027\u5728\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u90fd\u591f\u7528\uff0c\u4f46\u662f\u5728\u4e00\u4e9b\u7279\u6b8a\u60c5\u51b5\u4e0b\u65e0\u80fd\u4e3a\u529b\uff0c\u6bd4\u5982\u5c5e\u6027\u540d\u548c\u5217\u540d\u4e0d\u4e00\u81f4\uff0c\u4e3a\u4e00\u4e9b\u8fde\u63a5\u7684\u590d\u6742\u8bed\u53e5\u7f16\u5199\u6620\u5c04\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>\u9047\u5230\u8fd9\u4e9b\u60c5\u51b5\uff0c\u6211\u4eec\u8981\u4f7f\u7528<code>&lt;resultMap><\/code>\u6807\u7b7e\uff0c\u4e00\u4efd <code>&lt;resultMap><\/code> \u80fd\u591f\u4ee3\u66ff\u5b9e\u73b0\u540c\u7b49\u529f\u80fd\u7684\u6570\u5343\u884c\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>resultMap \u662f Mybatis \u6700\u5f3a\u5927\u7684\u5143\u7d20\u4e4b\u4e00\uff0c\u5b83\u53ef\u4ee5\u5c06\u67e5\u8be2\u5230\u7684\u590d\u6742\u6570\u636e\uff08\u6bd4\u5982\u67e5\u8be2\u5230\u51e0\u4e2a\u8868\u4e2d\u6570\u636e\uff09\u6620\u5c04\u5230\u4e00\u4e2a\u7ed3\u679c\u96c6\u5f53\u4e2d\u3002\u5982\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6709\u4e00\u4e2a\u8868\u4e3a\uff08\u7528\u6237\u89d2\u8272\u8868\uff09\uff0c\u901a\u8fc7\u67e5\u8be2\u7528\u6237\u8868\u4fe1\u606f\u5c55\u793a\u9875\u9762\uff0c\u5728\uff08\u7528\u6237\u8868\uff09\u4e2d\u5b58\u5728\u7528\u6237\u89d2\u8272\u8868 id \uff0c\u5728\u5b9e\u9645\u5217\u8868\u9875\u7684\u5c55\u793a\u4e2d\uff0c\u7528\u6237\u5173\u6ce8\u7684\u662f\u7528\u6237\u89d2\u8272\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u89d2\u8272 id\u3002\u89e3\u51b3\u6b64\u7c7b\u95ee\u9898\u53ef\u4ee5\u901a\u8fc7 resultMap \u6765\u6620\u5c04\u81ea\u5b9a\u4e49\u7ed3\u679c\u3002 \u4f7f\u7528 resultMap \u505a\u81ea\u5b9a\u4e49\u7ed3\u679c\u6620\u5c04\uff0c\u5b57\u6bb5\u540d\u53ef\u4ee5\u4e0d\u4e00\u81f4\uff0c\u5e76\u4e14\u8fd8\u53ef\u4ee5\u6307\u5b9a\u8981\u663e\u793a\u7684\u5217\uff0c\u6bd4\u8f83\u7075\u6d3b\uff0c\u5e94\u7528\u4e5f\u5e7f\u6cdb(\u63a8\u8350\u4f7f\u7528)\u3002<\/p>\n\n\n\n<p>resultMap \u5143\u7d20\u662f MyBatis \u4e2d\u6700\u91cd\u8981\u6700\u5f3a\u5927\u7684\u5143\u7d20\u3002<br>resultMap \u7684\u8bbe\u8ba1\u601d\u60f3\u662f\uff0c\u5bf9\u7b80\u5355\u7684\u8bed\u53e5\u505a\u5230\u96f6\u914d\u7f6e\uff0c\u5bf9\u4e8e\u590d\u6742\u4e00\u70b9\u7684\u8bed\u53e5\uff0c\u53ea\u9700\u8981\u63cf\u8ff0\u8bed\u53e5\u4e4b\u95f4\u7684\u5173\u7cfb\u5c31\u884c\u4e86\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">resultMap \u77e5\u8bc6\u70b9<\/h5>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>resultMap \u5143\u7d20\u7528\u6765\u63cf\u8ff0\u5982\u4f55\u5c06\u7ed3\u679c\u96c6\u6620\u5c04\u5230 Java \u5bf9\u8c61\uff0c\u4f7f\u7528 resultMap \u5bf9\u5217\u8868\u5c55\u793a\u6240\u9700\u7684\u5fc5\u8981\u5b57\u6bb5\u6765\u8fdb\u884c\u81ea\u52a8\u6620\u5c04\uff0c\u7279\u522b\u662f\u5f53\u6570\u636e\u5e93\u7684\u5b57\u6bb5\u540d\u548c\u5b9e\u4f53\u7c7b POJO \u4e2d\u7684\u5c5e\u6027\u540d\u4e0d\u4e00\u81f4\u7684\u60c5\u51b5\u4e0b\uff0c\u6bd4\u5982\u89d2\u8272\u540d\u79f0\uff0c\u5b57\u6bb5\u540d\/\u5217\u540d column \u662f roleName\uff0c\u800c User \u5bf9\u8c61\u7684\u5c5e\u6027\u540d\u5219\u4e3a userRoleName \uff0c\u6b64\u65f6\u5c31\u9700\u8981\u505a\u6620\u5c04\u3002<\/p>\n\n\n\n<p>resultMap \u5143\u7d20\u7684\u5c5e\u6027\u503c\u548c\u5b50\u8282\u70b9<\/p>\n\n\n\n<ul><li>id \u5c5e\u6027\uff1a\u552f\u4e00\u6807\u8bc6\uff0c\u6b64 id \u503c\u7528\u4e8e select \u5143\u7d20 resultMap \u5c5e\u6027\u7684\u5f15\u7528\u3002<\/li><li>type \u5c5e\u6027\uff1a\u8868\u793a\u8be5 resultMap \u7684\u6620\u5c04\u7ed3\u679c\u7c7b\u578b\u3002<\/li><li>result \u5b50\u8282\u70b9\uff1a\u7528\u4e8e\u6807\u8bc6\u4e00\u4e9b\u7b80\u5355\u5c5e\u6027\uff0c\u5176\u4e2d column \u5c5e\u6027\u8868\u793a\u4ece\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u7684\u5b57\u6bb5\u540d\u6216\u522b\u540d\uff0c property \u5c5e\u6027\u5219\u8868\u793a\u67e5\u8be2\u51fa\u6765\u7684\u5b57\u6bb5\u5bf9\u5e94\u7684\u503c\u8d4b\u7ed9\u5b9e\u4f53\u5bf9\u8c61\u7684\u54ea\u4e2a\u5c5e\u6027\u3002<\/li><\/ul>\n\n\n\n<p>\u8bf4\u660e\uff1aMyBatis \u4e2d\u5728\u5bf9\u67e5\u8be2\u8fdb\u884c select \u6620\u5c04\u7684\u65f6\u5019\uff0c\u8fd4\u56de\u7c7b\u578b\u53ef\u4ee5\u7528 resultType \u4e5f\u53ef\u4ee5\u7528 resultMap \uff0cresultType\u548c resultMap \u6709\u4e00\u5b9a\u5173\u8054\u548c\u533a\u522b\uff0c\u5e94\u7528\u573a\u666f\u4e5f\u4e0d\u540c\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>resultType \u548c resultMap \u533a\u522b<\/strong><\/h5>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>resultType\uff1a\u76f4\u63a5\u8868\u793a\u8fd4\u56de\u7c7b\u578b\uff0c\u5305\u62ec\u57fa\u7840\u6570\u636e\u7c7b\u578b\u548c\u590d\u6742\u6570\u636e\u7c7b\u578b\u3002<br>resultMap \u5219\u662f\u5bf9\u5916\u90e8 resultMap \u5b9a\u4e49\u7684\u5f15\u7528\uff0c\u5bf9\u5e94\u5916\u90e8 resultMap \u7684 id\uff0c\u8868\u793a\u8fd4\u56de\u7ed3\u679c\u6620\u5c04\u5230\u54ea\u4e00\u4e2a resultMap \u4e0a\u3002\u5b83\u7684\u5e94\u7528\u573a\u666f\u4e00\u822c\u662f\uff1a\u6570\u636e\u5e93\u5b57\u6bb5\u4fe1\u606f\u4e0e\u5bf9\u8c61\u5c5e\u6027\u4e0d\u4e00\u81f4\u6216\u8005\u9700\u8981\u505a\u590d\u6742\u7684\u8054\u5408\u67e5\u8be2\u4ee5\u4fbf\u81ea\u7531\u63a7\u5236\u6620\u5c04\u7ed3\u679c\u3002<\/p>\n\n\n\n<p>\u8bf4\u660e\uff1a\u6ce8\u610f\uff0cMyBatis \u4e2d\u4f7f\u7528 resultType \u505a\u81ea\u52a8\u6620\u5c04\uff0c\u4e00\u5b9a\u8981\u6ce8\u610f\uff1a\u5b57\u6bb5\u540d\u548c JavaBean \u7684\u5c5e\u6027\u540d\u5fc5\u987b\u4e00\u81f4\u3002\u82e5\u4e0d\u4e00\u81f4\uff0c\u5219\u9700\u8981\u7ed9\u5b57\u6bb5\u8d77\u522b\u540d\uff0c\u4fdd\u8bc1\u522b\u540d\u4e0e\u5c5e\u6027\u540d\u4e00\u81f4\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>resultType \u548c resultMap \u5173\u8054<\/strong><\/h5>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728 MyBatis \u8fdb\u884c\u67e5\u8be2\u6620\u5c04\u7684\u65f6\u5019\uff0c\u5176\u5b9e\u67e5\u8be2\u51fa\u6765\u7684\u6bcf\u4e2a\u5b57\u6bb5\u503c\u90fd\u653e\u5728\u4e00\u4e2a\u5bf9\u5e94\u7684 Map \u91cc\u9762\uff0c\u5176\u4e2d\u952e\u662f\u5b57\u6bb5\u540d\uff0c\u503c\u5219\u662f\u5176\u5bf9\u5e94\u7684\u503c\u3002\u5f53 select \u5143\u7d20\u63d0\u4f9b\u7684\u8fd4\u56de\u7c7b\u578b\u5c5e\u6027\u662f resultType \u7684\u65f6\u5019\uff0c MyBatis \u4f1a\u5c06 Map \u91cc\u9762\u7684\u952e\u503c\u5bf9\u53d6\u51fa\u8d4b\u7ed9 resultType \u6240\u6307\u5b9a\u7684\u5bf9\u8c61\u5bf9\u5e94\u7684\u5c5e\u6027(\u5373\u8c03\u7528\u5bf9\u5e94\u7684\u5bf9\u8c61\u91cc\u7684\u5c5e\u6027\u7684 setter \u65b9\u6cd5\u8fdb\u884c\u586b\u5145)\u3002\u6b63\u56e0\u4e3a\u5982\u6b64\uff0c\u5f53\u4f7f\u7528 resultType \u7684\u65f6\u5019\uff0c\u76f4\u63a5\u5728\u540e\u53f0\u5c31\u80fd\u63a5\u6536\u5230\u5176\u76f8\u5e94\u7684\u5bf9\u8c61\u5c5e\u6027\u503c\u3002\u7531\u6b64\u53ef\u770b\u51fa\uff0c\u5176\u5b9e MyBatis \u7684\u6bcf\u4e2a\u67e5\u8be2\u6620\u5c04\u7684\u8fd4\u56de\u7c7b\u578b\u90fd\u662f resultMap \uff0c\u53ea\u662f\u5f53\u6211\u4eec\u63d0\u4f9b\u7684\u8fd4\u56de\u7c7b\u578b\u5c5e\u6027\u662f resultType \u7684\u65f6\u5019\uff0c MyBatis \u4f1a\u81ea\u52a8\u628a\u5bf9\u5e94\u7684\u503c\u8d4b\u7ed9 resultType \u6240\u6307\u5b9a\u5bf9\u8c61\u7684\u5c5e\u6027\uff1b \u800c\u5f53\u6211\u4eec\u63d0\u4f9b\u7684\u8fd4\u56de\u7c7b\u578b\u662f resultMap \u7684\u65f6\u5019\uff0c\u56e0\u4e3a Map \u4e0d\u80fd\u5f88\u597d\u5730\u8868\u793a\u9886\u57df\u6a21\u578b\uff0c\u6211\u4eec\u5c31\u9700\u8981\u901a\u8fc7\u8fdb\u4e00\u6b65\u7684\u5b9a\u4e49\u628a\u5b83\u8f6c\u5316\u4e3a\u5bf9\u5e94\u7684\u5b9e\u4f53\u5bf9\u8c61\u3002<br>\u3000\u3000\u5f53\u8fd4\u56de\u7c7b\u578b\u662f resultMap \u65f6\uff0c\u4e5f\u662f\u975e\u5e38\u6709\u7528\u7684\uff0c\u8fd9\u4e3b\u8981\u7528\u5728\u8fdb\u884c\u590d\u6742\u8054\u5408\u67e5\u8be2\u4e0a\uff0c\u5f53\u7136\u5728\u8fdb\u884c\u7b80\u5355\u67e5\u8be2\u65f6\u662f\u6ca1\u6709\u4ec0\u4e48\u5fc5\u8981\u7684\uff0c\u4f7f\u7528 resultType \u8db3\u4ee5\u3002<\/p>\n\n\n\n<ul><li>Mybatis \u662f\u5bf9\u8fd4\u56de\u7684\u7ed3\u679c\u7684\u6bcf\u4e00\u884c\u505a\u6620\u5c04\u7684\uff0c\u56e0\u6b64\u5728\u6307\u5b9a resultType \u6216\u8005 resultMap \u8fd4\u56de\u7c7b\u578b\u65f6\u5e94\u7279\u522b\u6ce8\u610f\u662f\u4e00\u884c\u7684\u7c7b\u578b\u800c\u4e0d\u662f\u6240\u6709\u3002<\/li><li>MyBatis \u4e2d\u5728\u67e5\u8be2\u8fdb\u884c select \u6620\u5c04\u7684\u65f6\u5019\uff0c\u8fd4\u56de\u7c7b\u578b\u53ef\u4ee5\u7528 resultType\uff0c\u4e5f\u53ef\u4ee5\u7528 resultMap\uff0cresultType \u662f\u76f4\u63a5\u8868\u793a\u8fd4\u56de\u7c7b\u578b\u7684\uff0c\u800c resultMap \u5219\u662f\u5bf9\u5916\u90e8 resultMap \u7684\u5f15\u7528\uff0c\u5728 MyBatis \u7684 select \u5143\u7d20\u4e2d\uff0cresultType \u548c resultMap \u672c\u8d28\u4e0a\u662f\u4e00\u6837\u7684\uff0c\u90fd\u662f Map \u6570\u636e\u7ed3\u6784\u3002\u4f46\u9700\u8981\u660e\u786e\u4e00\u70b9\uff1a resultType \u5c5e\u6027\u548c resultMap \u5c5e\u6027\u7edd\u5bf9\u4e0d\u80fd\u540c\u65f6\u5b58\u5728\uff0c\u53ea\u80fd\u4e8c\u8005\u9009 \u5176\u4e00\u4f7f\u7528\u3002<\/li><li>\u5728 MyBatis \u4e2d\uff0c\u4f7f\u7528 resultMap \u80fd\u591f\u8fdb\u884c\u81ea\u52a8\u6620\u5c04\u5339\u914d\u7684\u524d\u63d0\u662f\u5b57\u6bb5\u540d\u548c\u5c5e\u6027\u540d\u9700\u8981\u4e00\u81f4\uff0c\u5728\u9ed8\u8ba4\u6620\u5c04\u7ea7\u522b(PARTIAL)\u60c5\u51b5\u4e0b\uff0c\u82e5\u4e00\u81f4\uff0c\u5373\u4f7f\u6ca1\u6709\u505a\u5c5e\u6027\u540d\u548c\u5b57\u6bb5\u540d\u7684\u5339\u914d\uff0c\u4e5f\u53ef\u4ee5\u5728\u540e\u53f0\u83b7\u53d6\u5230\u672a\u5339\u914d\u8fc7\u7684\u5c5e\u6027\u503c\uff1b\u82e5\u4e0d\u4e00\u81f4\uff0c\u4e14\u5728 resultMap \u91cc\u6ca1\u6709\u505a\u6620\u5c04\uff0c\u90a3\u4e48\u5c31\u65e0\u6cd5\u5728\u540e\u53f0\u83b7\u53d6\u5e76\u8f93\u51fa\u3002<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>\u6848\u4f8b\u89e3\u6790\uff1a<\/strong><code>\u6839\u636e\u7528\u6237\u540d\u548c\u7528\u6237\u89d2\u8272 id \u67e5\u8be2\u51fa\u7528\u6237\u8868\u4e2d\u7528\u6237\u4fe1\u606f\uff0c\u8981\u6c42\u7528\u6237\u89d2\u8272\u8981\u663e\u793a\u89d2\u8272\u540d\u79f0\u800c\u4e0d\u662f\u89d2\u8272 id\u3002<\/code><\/p>\n\n\n\n<p><strong>\u65b9\u5f0f 1 \uff1a\u4f7f\u7528 resultType \u505a\u81ea\u52a8\u6620\u5c04\u00a0\uff08\u4e86\u89e3\u5373\u53ef\uff09<\/strong><\/p>\n\n\n\n<p>\u6ce8\u610f\uff0cMyBatis \u4e2d\u4f7f\u7528 resultType \u505a\u81ea\u52a8\u6620\u5c04\uff0c\u4e00\u5b9a\u8981\u6ce8\u610f\uff1a\u5b57\u6bb5\u540d\u548c JavaBean \u7684\u5c5e\u6027\u540d\u5fc5\u987b\u4e00\u81f4\u3002\u82e5\u4e0d\u4e00\u81f4\uff0c\u5219\u9700\u8981\u7ed9\u5b57\u6bb5\u8d77\u522b\u540d\uff0c\u4fdd\u8bc1\u522b\u540d\u4e0e\u5c5e\u6027\u540d\u4e00\u81f4\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\uff081\uff09\u4fee\u6539\u5b9e\u4f53\u7c7b POJO\uff1aUser.java\uff0c\u589e\u52a0 userRoleName \u5c5e\u6027\uff0c\u6dfb\u52a0\u5bf9\u5e94\u7684 get \u548c set \u65b9\u6cd5\u3002\n  \n   private String userRoleName; \/\/\u7528\u6237\u89d2\u8272\u540d\u79f0\n    \n   public String getUserRoleName() {\n        return userRoleName;\n    }\n    public void setUserRoleName(String userRoleName) {\n        this.userRoleName = userRoleName;\n    }\n\n\uff082\uff09UserMapper.java \u63a5\u53e3\u4e2d\u7f16\u5199\u67e5\u8be2\u7528\u6237\u5217\u8868\u7684 getUserList()\u65b9\u6cd5\u3002\n\n\u3000\u3000\/**\n     * \u6839\u636e\u7528\u6237\u540d\u79f0\uff08\u6a21\u7cca\u67e5\u8be2\uff09\u548c\u7528\u6237\u89d2\u8272\u67e5\u8be2\u7528\u6237\u5217\u8868\uff08\u8981\u6c42\u7528\u6237\u89d2\u8272\u8981\u663e\u793a\u89d2\u8272\u540d\u79f0\u800c\u4e0d\u662f\u89d2\u8272 id\uff09\n     * @param userName \u7528\u6237\u540d\u79f0\n     * @param userRole \u7528\u6237\u89d2\u8272\n     * @return\n     *\/\n    public List&lt;User> getUserList(@Param(\"uName\")String userName,@Param(\"uRole\")int userRole); \n\n\uff083\uff09UserMapper.xml \u4e2d\uff0c\u7f16\u5199\u67e5\u8be2\u7528\u6237\u5217\u8868\u7684 SQL \u8bed\u53e5\uff0c\u5bf9\u8868(mbms_user)\u548c\u89d2\u8272\u8868(mbms_role)\u8fdb\u884c\u8fde\u8868\u67e5\u8be2\uff0c\u4f7f\u7528 resultType \u505a\u81ea\u52a8\u6620\u5c04\u3002\n\n&lt;!-- \u6839\u636e\u7528\u6237\u540d\u79f0\uff08\u6a21\u7cca\u67e5\u8be2\uff09\u548c\u7528\u6237\u89d2\u8272\u67e5\u8be2\u7528\u6237\u5217\u8868\uff08\u8981\u6c42\u7528\u6237\u89d2\u8272\u8981\u663e\u793a\u89d2\u8272\u540d\u79f0\u800c\u4e0d\u662f\u89d2\u8272 id\uff09 -->\n    &lt;select id=\"getUserList\" resultType=\"user\">\n        SELECT u.*,r.roleName AS userRoleName FROM `smbms_user` u,`smbms_role` r  \n        WHERE u.`userRole`=r.`id`\n         AND userRole=#{uRole}\n         AND userName LIKE CONCAT('%',#{uName},'%')\n    &lt;\/select>\n\n\u8bf4\u660e\uff1a\u4f7f\u7528 resultType \u505a\u81ea\u52a8\u6620\u5c04\uff0c\u8981\u6c42\u6570\u636e\u5e93\u5b57\u6bb5\u540d\u5fc5\u987b\u548c POJO \u5c5e\u6027\u540d\u4e00\u81f4\u3002\u56e0\u6b64\u8981\u7ed9\u6570\u636e\u5e93\u5b57\u6bb5\u53d6\u522b\u540d\uff0c\u522b\u540d\u4e3a userRoleName \u3002\n\n\uff084\uff09\u5355\u5143\u6d4b\u8bd5\u7c7b \n\n @Test \/\/\u6d4b\u8bd5\u6839\u636e\u7528\u6237\u540d\u79f0\uff08\u6a21\u7cca\u67e5\u8be2\uff09\u548c\u7528\u6237\u89d2\u8272\u67e5\u8be2\u7528\u6237\u5217\u8868\uff08\u8981\u6c42\u7528\u6237\u89d2\u8272\u8981\u663e\u793a\u89d2\u8272\u540d\u79f0\u800c\u4e0d\u662f\u89d2\u8272 id\uff09\n public void testGetUserList(){\n     \u3000List&lt;User> userList=new ArrayList&lt;User>();\n    \u3000 String userName=\"\u8d75\";\n       int userRole=2;\n       userList=session.getMapper(UserMapper.class).getUserList(userName, userRole);\n       for (User user : userList) {\n             System.out.println(user);\n       }\n }\n\u3000\u3000\u3000\u3000\n\u3000\u3000\u3000\u8bf4\u660e\uff1a\u6b64\u79cd\u65b9\u6cd5\u5fc5\u987b\u7ed9 r.roleName \u53d6\u522b\u540d\u4e3a  userRoleName \u3002<\/pre>\n\n\n\n<p><strong>\u65b9\u5f0f 2 \uff1a\u4f7f\u7528 resultMap\u00a0\u6765\u81ea\u5b9a\u4e49\u6620\u5c04\u7ed3\u679c\uff08\u63a8\u8350\u4f7f\u7528\uff09<\/strong><\/p>\n\n\n\n<p>\u901a\u8fc7 resultMap \u6765\u81ea\u5b9a\u4e49\u6620\u5c04\u7ed3\u679c\u3002 \u4f7f\u7528 resultMap \u505a\u81ea\u5b9a\u4e49\u7ed3\u679c\u6620\u5c04\uff0c\u5b57\u6bb5\u540d\u53ef\u4ee5\u4e0d\u4e00\u81f4\uff0c\u5e76\u4e14\u8fd8\u53ef\u4ee5\u6307\u5b9a\u8981\u663e\u793a\u7684\u5217\uff0c\u6bd4\u8f83\u7075\u6d3b\uff0c\u5e94\u7528\u4e5f\u5e7f\u6cdb(\u63a8\u8350\u4f7f\u7528)<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\uff081\uff09\u4fee\u6539\u5b9e\u4f53\u7c7b POJO\uff1aUser.java\uff0c\u589e\u52a0 userRoleName \u5c5e\u6027\uff0c\u6dfb\u52a0\u5bf9\u5e94\u7684 get \u548c set \u65b9\u6cd5\u3002\n  \n   private String userRoleName; \/\/\u7528\u6237\u89d2\u8272\u540d\u79f0\n    \n   public String getUserRoleName() {\n        return userRoleName;\n    }\n    public void setUserRoleName(String userRoleName) {\n        this.userRoleName = userRoleName;\n    }\n\n\uff082\uff09UserMapper.java \u63a5\u53e3\u4e2d\u7f16\u5199\u67e5\u8be2\u7528\u6237\u5217\u8868\u7684 getUserList()\u65b9\u6cd5\u3002\n\n\u3000\u3000\/**\n     * \u6839\u636e\u7528\u6237\u540d\u79f0\uff08\u6a21\u7cca\u67e5\u8be2\uff09\u548c\u7528\u6237\u89d2\u8272\u67e5\u8be2\u7528\u6237\u5217\u8868\uff08\u8981\u6c42\u7528\u6237\u89d2\u8272\u8981\u663e\u793a\u89d2\u8272\u540d\u79f0\u800c\u4e0d\u662f\u89d2\u8272 id\uff09\n     * @param userName \u7528\u6237\u540d\u79f0\n     * @param userRole \u7528\u6237\u89d2\u8272\n     * @return\n     *\/\n    public List&lt;User> getUserList(@Param(\"uName\")String userName,@Param(\"uRole\")int userRole); \n\n\uff083\uff09UserMapper.xml \u4e2d\uff0c\u7f16\u5199\u67e5\u8be2\u7528\u6237\u5217\u8868\u7684 SQL \u8bed\u53e5\uff0c\u5bf9\u8868(mbms_user)\u548c\u89d2\u8272\u8868(mbms_role)\u8fdb\u884c\u8fde\u8868\u67e5\u8be2\uff0c\u4f7f\u7528 resultMap \u505a\u81ea\u5b9a\u4e49\u7ed3\u679c\u6620\u5c04\u3002\n\n&lt;!-- \u6839\u636e\u7528\u6237\u540d\u79f0\uff08\u6a21\u7cca\u67e5\u8be2\uff09\u548c\u7528\u6237\u89d2\u8272\u67e5\u8be2\u7528\u6237\u5217\u8868\uff08\u8981\u6c42\u7528\u6237\u89d2\u8272\u8981\u663e\u793a\u89d2\u8272\u540d\u79f0\u800c\u4e0d\u662f\u89d2\u8272 id\uff09 -->\n    &lt;select id=\"getUserList\" resultMap=\"userList\">\n        SELECT u.*,r.roleName FROM\n        `smbms_user` u,`smbms_role` r\n        WHERE u.`userRole`=r.`id`\n        AND userRole=#{uRole}\n        AND userName LIKE CONCAT('%',#{uName},'%')\n    &lt;\/select>\n\n    &lt;resultMap type=\"user\" id=\"userList\">\n        &lt;result property=\"id\" column=\"id\" \/>\n        &lt;result property=\"userCode\" column=\"userCode\" \/>\n        &lt;result property=\"userName\" column=\"userName\" \/>\n        &lt;result property=\"phone\" column=\"phone\" \/>\n        &lt;result property=\"birthday\" column=\"birthday\" \/>\n        &lt;result property=\"gender\" column=\"gender\" \/>\n        &lt;result property=\"userRole\" column=\"userRole\" \/>\n\n        &lt;result property=\"userRoleName\" column=\"roleName\" \/>\n    &lt;\/resultMap>\n\n\uff084\uff09\u5355\u5143\u6d4b\u8bd5\u7c7b\n@Test \/\/\u6d4b\u8bd5\u6839\u636e\u7528\u6237\u540d\u79f0\uff08\u6a21\u7cca\u67e5\u8be2\uff09\u548c\u7528\u6237\u89d2\u8272\u67e5\u8be2\u7528\u6237\u5217\u8868\uff08\u8981\u6c42\u7528\u6237\u89d2\u8272\u8981\u663e\u793a\u89d2\u8272\u540d\u79f0\u800c\u4e0d\u662f\u89d2\u8272 id\uff09\n public void testGetUserList(){\n     \u3000List&lt;User> userList=new ArrayList&lt;User>();\n    \u3000 String userName=\"\u8d75\";\n       int userRole=2;\n       userList=session.getMapper(UserMapper.class).getUserList(userName, userRole);\n       for (User user : userList) {\n             System.out.println(user);\n       }\n }\n \u3000\u3000\u8bf4\u660e\uff1aresultMap \u505a\u81ea\u5b9a\u4e49\u7ed3\u679c\u6620\u5c04\uff0c\u4e0e MyBatis \u7684\u81ea\u52a8\u6620\u5c04\u7ea7\u522b\uff08autoMappingBehavior\uff09\u6709\u5173\u3002\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u8865\u5145\u7684\u8bf4\u660e\uff1a<strong>\u5c5e\u6027\u540d\u548c\u5217\u540d\u4e0d\u4e00\u81f4<\/strong><\/h5>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u6bd4\u5982\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5e38\u89c1\u7684\u60c5\u5883\uff0cJavaBean \u5c5e\u6027\u4f7f\u7528\u9a7c\u5cf0\u547d\u540d\uff0c\u6570\u636e\u5e93\u5217\u540d\u5355\u8bcd\u4e4b\u95f4\u52a0\u5165\u4e0b\u5212\u7ebf\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class User {\n  private int id;\n  private String username;\n  private String hashedPassword;\n\n  public int getId() {\n    return id;\n  }\n  public void setId(int id) {\n    this.id = id;\n  }\n  public String getUsername() {\n    return username;\n  }\n  public void setUsername(String username) {\n    this.username = username;\n  }\n  public String getHashedPassword() {\n    return hashedPassword;\n  }\n  public void setHashedPassword(String hashedPassword) {\n    this.hashedPassword = hashedPassword;\n  }\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;select id=\"selectUsers\" resultType=\"User\">\n  select\n    user_id,user_name,hashed_password\n  from some_table\n  where id = #{id}\n&lt;\/select><\/pre>\n\n\n\n<p>\u4e3a\u4e86\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5728 <code>&lt;resultMap><\/code>\u4e2d\u505a\u4e00\u4e0b\u7b80\u5355\u7684\u914d\u7f6e\uff0c\u7136\u540e\u5728\u5f15\u7528\u5b83\u7684\u8bed\u53e5\u4e2d\u8bbe\u7f6e <code>&lt;resultMap><\/code> \u5c5e\u6027\u5c31\u884c\u4e86\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;resultMap id=\"userResultMap\" type=\"User\">\n  &lt;id property=\"id\" column=\"user_id\" \/>\n  &lt;result property=\"username\" column=\"user_name\"\/>\n  &lt;result property=\"password\" column=\"hashed_password\"\/>\n&lt;\/resultMap> \n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;select id=\"selectUsers\" resultMap=\"userResultMap\">\n  select user_id, user_name, hashed_password\n  from some_table\n  where id = #{id}\n&lt;\/select>\n<\/pre>\n\n\n\n<p>\u6ce8\u610f\uff1a\u8fd9\u91cc\u53bb\u6389\u4e86<code>&lt;reslutType><\/code>\u5c5e\u6027\uff0c\u7528<code>&lt;resultMap><\/code>\u4ee3\u66ff\uff0c\u4e8c\u8005\u53ea\u80fd\u9009\u62e9\u5176\u4e2d\u7684\u4e00\u4e2a\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u8865\u5145\u7684\u8bf4\u660e\uff1a<strong>\u9ad8\u7ea7\u7ed3\u679c\u6620\u5c04<\/strong><\/h5>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>MyBatis \u521b\u5efa\u65f6\u7684\u4e00\u4e2a\u601d\u60f3\u662f\uff1a\u6570\u636e\u5e93\u4e0d\u53ef\u80fd\u6c38\u8fdc\u662f\u4f60\u6240\u60f3\u6216\u6240\u9700\u7684\u90a3\u4e2a\u6837\u5b50\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u5e0c\u671b\u6bcf\u4e2a\u6570\u636e\u5e93\u90fd\u5177\u5907\u826f\u597d\u7684\u7b2c\u4e09\u8303\u5f0f\u6216 BCNF \u8303\u5f0f\uff0c\u53ef\u60dc\u5b83\u4eec\u5e76\u4e0d\u90fd\u662f\u90a3\u6837\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u80fd\u6709\u4e00\u79cd\u6570\u636e\u5e93\u6620\u5c04\u6a21\u5f0f\uff0c\u5b8c\u7f8e\u9002\u914d\u6240\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u90a3\u5c31\u592a\u597d\u4e86\uff0c\u53ef\u60dc\u6ca1\u6709\u3002 \u800c ResultMap \u5c31\u662f MyBatis \u5bf9\u8fd9\u4e2a\u95ee\u9898\u7684\u7b54\u6848\u3002<\/p>\n\n\n\n<p><strong>\u4e00\u5bf9\u4e00\u6620\u5c04<\/strong><\/p>\n\n\n\n<p>\u6bd4\u5982\uff0c\u6211\u4eec\u5982\u4f55\u6620\u5c04\u4e0b\u9762\u8fd9\u4e2a\u8bed\u53e5\uff1f<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;select id=\"selectBlogDetails\" resultMap=\"detailedBlogResultMap\">\n  select\n       B.id as blog_id,\n       B.title as blog_title,\n       B.author_id as blog_author_id,\n       A.id as author_id,\n       A.username as author_username,\n       A.password as author_password,\n       A.email as author_email,\n       A.bio as author_bio,\n       A.favourite_section as author_favourite_section\n  from Blog B\n  left outer join Author A on B.author_id = A.id\n  where B.id = #{id}\n&lt;\/select>\n<\/pre>\n\n\n\n<p>\u8fd9\u662f\u5178\u578b\u7684\u4e00\u5bf9\u4e00\u7684\u5173\u8054\u5173\u7cfb\u60c5\u51b5\uff0c\u6211\u4eec\u901a\u8fc7<code>&lt;association><\/code>\u914d\u7f6e\u5c31\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;resultMap id=\"detailedBlogResultMap\" type=\"Blog\">\n  &lt;constructor>\n    &lt;idArg column=\"blog_id\" javaType=\"int\"\/>\n  &lt;\/constructor>\n  &lt;result property=\"title\" column=\"blog_title\"\/>\n  &lt;association property=\"author\" javaType=\"Author\">\n    &lt;id property=\"id\" column=\"author_id\"\/>\n    &lt;result property=\"username\" column=\"author_username\"\/>\n    &lt;result property=\"password\" column=\"author_password\"\/>\n    &lt;result property=\"email\" column=\"author_email\"\/>\n    &lt;result property=\"bio\" column=\"author_bio\"\/>\n    &lt;result property=\"favouriteSection\" column=\"author_favourite_section\"\/>\n  &lt;\/association>\n&lt;\/resultMap>\n<\/pre>\n\n\n\n<p>\u6620\u5c04\u5728 javaBean \u4e2d\u7684\u8868\u793a\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">private Author author;<\/pre>\n\n\n\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u4e00\u6b65\u4e00\u6b65\u6765\u770b\u8fd9\u4e9b\u5143\u7d20\u7684\u610f\u4e49\u3002<\/p>\n\n\n\n<p>reslutMap \u7684\u5c5e\u6027<\/p>\n\n\n\n<ul><li>id:\u5f53\u524d\u547d\u540d\u7a7a\u95f4\u4e2d\u7684\u4e00\u4e2a\u552f\u4e00\u6807\u8bc6\uff0c\u7528\u4e8e\u6807\u8bc6\u4e00\u4e2a\u7ed3\u679c\u6620\u5c04\u3002<\/li><li>type:\u7c7b\u7684\u5b8c\u5168\u9650\u5b9a\u540d, \u6216\u8005\u4e00\u4e2a\u7c7b\u578b\u522b\u540d\u3002<\/li><\/ul>\n\n\n\n<p>id \u548c result\uff1aid \u548c result \u5143\u7d20\u90fd\u5c06\u4e00\u4e2a\u5217\u7684\u503c\u6620\u5c04\u5230\u4e00\u4e2a\u7b80\u5355\u6570\u636e\u7c7b\u578b\uff08String, int, double, Date \u7b49\uff09\u7684\u5c5e\u6027\u6216\u5b57\u6bb5\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e24\u8005\u4e4b\u95f4\u7684\u552f\u4e00\u4e0d\u540c\u662f\uff0cid \u5143\u7d20\u5bf9\u5e94\u7684\u5c5e\u6027\u4f1a\u88ab\u6807\u8bb0\u4e3a\u5bf9\u8c61\u7684\u6807\u8bc6\u7b26\uff0c\u5728\u6bd4\u8f83\u5bf9\u8c61\u5b9e\u4f8b\u65f6\u4f7f\u7528\u3002 \u8fd9\u6837\u53ef\u4ee5\u63d0\u9ad8\u6574\u4f53\u7684\u6027\u80fd\uff0c\u5c24\u5176\u662f\u8fdb\u884c\u7f13\u5b58\u548c\u5d4c\u5957\u7ed3\u679c\u6620\u5c04\uff08\u4e5f\u5c31\u662f\u8fde\u63a5\u6620\u5c04\uff09\u7684\u65f6\u5019\u3002<\/p>\n\n\n\n<p>\u4e24\u8005\u7684\u4e00\u4e9b\u5c5e\u6027\uff1a<\/p>\n\n\n\n<ul><li>property\uff1a\u6620\u5c04\u5230\u5217\u7ed3\u679c\u7684\u5b57\u6bb5\u6216\u5c5e\u6027\u3002<\/li><li>column\uff1a\u6570\u636e\u5e93\u4e2d\u7684\u5217\u540d\uff0c\u6216\u8005\u662f\u5217\u7684\u522b\u540d\u3002<\/li><li>javaType\uff1a\u4e00\u4e2a Java \u7c7b\u7684\u5168\u9650\u5b9a\u540d\uff0c\u6216\u4e00\u4e2a\u7c7b\u578b\u522b\u540d\u3002\u901a\u5e38\u4e0d\u4f1a\u914d\u7f6e\uff0cmybatis \u80fd\u591f\u6839\u636e\u53c2\u6570\u4fe1\u606f\u81ea\u52a8\u8bc6\u522b\uff0c\u5982\u679c\u4f60\u6620\u5c04\u5230\u7684\u662f HashMap\uff0c\u90a3\u4e48\u4f60\u5e94\u8be5\u660e\u786e\u5730\u6307\u5b9a javaType \u6765\u4fdd\u8bc1\u884c\u4e3a\u4e0e\u671f\u671b\u7684\u76f8\u4e00\u81f4\u3002<\/li><li>jdbcType\uff1aJDBC \u7c7b\u578b\uff0c\u6240\u652f\u6301\u7684 JDBC \u7c7b\u578b\u53c2\u89c1\u8fd9\u4e2a\u8868\u683c\u4e4b\u540e\u7684\u201c\u652f\u6301\u7684 JDBC \u7c7b\u578b\u201d\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u591a\u5bf9\u591a\u6620\u5c04<\/strong><\/p>\n\n\n\n<p>\u9996\u5148\u6765\u770b\u5bf9\u5e94\u7684 SQL \u8bed\u53e5\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;select id=\"selectBlog\" resultMap=\"blogResult\">\n  select\n  B.id as blog_id,\n  B.title as blog_title,\n  B.author_id as blog_author_id,\n  P.id as post_id,\n  P.subject as post_subject,\n  P.body as post_body,\n  from Blog B\n  left outer join Post P on B.id = P.blog_id\n  where B.id = #{id}\n&lt;\/select>\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;resultMap id=\"blogResult\" type=\"Blog\">\n  &lt;id property=\"id\" column=\"blog_id\" \/>\n  &lt;result property=\"title\" column=\"blog_title\"\/>\n  &lt;collection property=\"posts\" ofType=\"Post\">\n    &lt;id property=\"id\" column=\"post_id\"\/>\n    &lt;result property=\"subject\" column=\"post_subject\"\/>\n    &lt;result property=\"body\" column=\"post_body\"\/>\n  &lt;\/collection>\n&lt;\/resultMap>\n\n<\/pre>\n\n\n\n<p>javaBean \u4e2d\u6211\u4eec\u8fd9\u6837\u8868\u793a\u96c6\u5408\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">private List&lt;Post> posts;<\/pre>\n\n\n\n<p>\u5927\u90e8\u5206\u90fd\u548c\u6211\u4eec\u4e0a\u9762\u5b66\u4e60\u8fc7\u7684\u5173\u8054\u5143\u7d20\u975e\u5e38\u76f8\u4f3c,\u8fd9\u91cc\u53ea\u662f\u65b0\u589e\u4e86\u4e00\u4e2a <code>ofType<\/code>\u5c5e\u6027\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u5c5e\u6027\u975e\u5e38\u91cd\u8981\uff0c\u5b83\u7528\u6765\u5c06 JavaBean\uff08\u6216\u5b57\u6bb5\uff09\u5c5e\u6027\u7684\u7c7b\u578b\u548c\u96c6\u5408\u5b58\u50a8\u7684\u7c7b\u578b\u533a\u5206\u5f00\u6765\u3002 \u6240\u4ee5\u4f60\u53ef\u4ee5\u6309\u7167\u4e0b\u9762\u8fd9\u6837\u6765\u9605\u8bfb\u6620\u5c04\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;collection property=\"posts\" javaType=\"ArrayList\" ofType=\"Post\"\/><\/pre>\n\n\n\n<p>\u201cposts \u662f\u4e00\u4e2a\u5b58\u50a8 Post \u7684 ArrayList \u96c6\u5408\u201d\u3002\u5728\u4e00\u822c\u60c5\u51b5\u4e0b\uff0cMyBatis \u53ef\u4ee5\u63a8\u65ad javaType \u5c5e\u6027\uff0c\u56e0\u6b64\u5e76\u4e0d\u9700\u8981\u586b\u5199\u3002\u6240\u4ee5\u5f88\u591a\u65f6\u5019\u4f60\u53ef\u4ee5\u7b80\u7565\u6210\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;collection property=\"posts\" ofType=\"Post\"\/><\/pre>\n\n\n\n<p>\u9ad8\u7ea7\u5173\u8054\u548c\u96c6\u5408\u6620\u5c04\u662f\u4e00\u4e2a\u6df1\u5ea6\u8bdd\u9898\u3002\u6587\u7ae0\u7684\u4ecb\u7ecd\u53ea\u80fd\u5230\u6b64\u4e3a\u6b62\u3002\u914d\u5408\u5c11\u8bb8\u7684\u5b9e\u8df5\uff0c\u4f60\u4f1a\u5f88\u5feb\u4e86\u89e3\u5168\u90e8\u7684\u7528\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u4f7f\u7528mybatis\uff0c\u6709\u4e24\u4e2a\u5c5e\u6027\u6807\u7b7e&lt;resultType>\u3001&lt;resultMap>\u53ef\u4ee5\u63d0\u4f9b\u7ed3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/6399"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6399"}],"version-history":[{"count":11,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/6399\/revisions"}],"predecessor-version":[{"id":6410,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/6399\/revisions\/6410"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}