{"id":97648,"date":"2026-08-29T23:00:43","date_gmt":"2026-08-29T15:00:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/97648.html"},"modified":"2026-08-29T23:00:43","modified_gmt":"2026-08-29T15:00:43","slug":"mybatis-%e6%a0%b8%e5%bf%83%e5%8e%9f%e7%90%86%e8%af%a6%e8%a7%a3%ef%bc%9ajpa%e3%80%81%e4%ba%8c%e7%ba%a7%e7%bc%93%e5%ad%98%e3%80%81%e7%bb%93%e6%9e%9c%e6%98%a0%e5%b0%84%e4%b8%8e-mapper-%e4%bb%a3%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/97648.html","title":{"rendered":"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406"},"content":{"rendered":"<h3>\u524d\u8a00<\/h3>\n<p>\u521a\u63a5\u89e6 MyBatis \u65f6&#xff0c;\u6211\u4e00\u76f4\u89c9\u5f97 Mapper \u63a5\u53e3\u6709\u70b9\u201c\u795e\u5947\u201d&#xff1a;\u63a5\u53e3\u660e\u660e\u6ca1\u6709\u5b9e\u73b0\u7c7b&#xff0c;\u6ce8\u5165\u540e\u5374\u80fd\u76f4\u63a5\u8c03\u7528&#xff1b;XML \u91cc\u5199\u4e00\u6bb5 SQL&#xff0c;\u8fd4\u56de\u503c\u53c8\u80fd\u81ea\u52a8\u53d8\u6210 Java \u5bf9\u8c61\u3002<\/p>\n<p>\u540e\u9762\u518d\u56de\u5934\u770b&#xff0c;\u4f1a\u53d1\u73b0 MyBatis \u5e76\u6ca1\u6709\u51ed\u7a7a\u505a\u4ec0\u4e48\u3002\u5b83\u7684\u6838\u5fc3\u903b\u8f91\u5f88\u6e05\u695a&#xff1a;\u542f\u52a8\u65f6\u89e3\u6790 SQL \u548c\u6620\u5c04\u89c4\u5219&#xff0c;\u8fd0\u884c\u65f6\u4e3a Mapper \u63a5\u53e3\u521b\u5efa\u4ee3\u7406\u5bf9\u8c61&#xff0c;\u518d\u7531\u4ee3\u7406\u5bf9\u8c61\u627e\u5230\u5bf9\u5e94 SQL \u5e76\u4ea4\u7ed9\u6267\u884c\u5668\u5904\u7406\u3002<\/p>\n<p>\u672c\u6587\u4ece\u5b9e\u9645\u5f00\u53d1\u4e2d\u7ecf\u5e38\u88ab\u95ee\u5230\u7684\u4e94\u4e2a\u95ee\u9898\u5165\u624b&#xff0c;\u628a MyBatis \u4e0e JPA\u3001\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u548c Mapper \u4ee3\u7406\u4e32\u8d77\u6765\u8bb2\u6e05\u695a\u3002<\/p>\n<h3>\u4e00\u3001MyBatis \u548c JPA \u6709\u4ec0\u4e48\u533a\u522b<\/h3>\n<p>\u5148\u7ea0\u6b63\u4e00\u4e2a\u5e38\u89c1\u8bf4\u6cd5&#xff1a;MyBatis \u4e0e JPA \u5e76\u4e0d\u662f\u5b8c\u5168\u5bf9\u7b49\u7684\u4e24\u4e2a\u6846\u67b6\u3002<\/p>\n<p>MyBatis \u662f\u4e00\u4e2a SQL \u6620\u5c04\u6846\u67b6&#xff0c;\u5f00\u53d1\u8005\u81ea\u5df1\u7f16\u5199 SQL&#xff0c;\u5b83\u8d1f\u8d23\u53c2\u6570\u7ed1\u5b9a\u3001SQL \u6267\u884c\u548c\u7ed3\u679c\u6620\u5c04\u3002JPA \u5219\u662f Java \u6301\u4e45\u5316\u89c4\u8303&#xff0c;Hibernate \u662f\u5e38\u89c1\u5b9e\u73b0&#xff0c;Spring Data JPA \u53c8\u5728 JPA \u4e4b\u4e0a\u5c01\u88c5\u4e86 Repository \u7b49\u80fd\u529b\u3002<\/p>\n<p>\u5982\u679c\u7cfb\u7edf\u4e2d\u590d\u6742\u67e5\u8be2\u591a\u3001SQL \u8c03\u4f18\u8981\u6c42\u9ad8&#xff0c;MyBatis \u5f80\u5f80\u66f4\u987a\u624b&#xff1b;\u5982\u679c\u4e1a\u52a1\u4ee5\u6807\u51c6 CRUD \u548c\u9886\u57df\u5bf9\u8c61\u5173\u7cfb\u4e3a\u4e3b&#xff0c;JPA \u53ef\u4ee5\u51cf\u5c11\u4e0d\u5c11\u91cd\u590d\u4ee3\u7801\u3002<\/p>\n<h3>\u4e8c\u3001MyBatis \u4e8c\u7ea7\u7f13\u5b58\u662f\u600e\u6837\u5de5\u4f5c\u7684<\/h3>\n<p>\u8c08\u4e8c\u7ea7\u7f13\u5b58\u524d&#xff0c;\u9700\u8981\u5148\u533a\u5206\u4e00\u7ea7\u7f13\u5b58\u3002<\/p>\n<ul>\n<li>\n<p>\u4e00\u7ea7\u7f13\u5b58\u5c5e\u4e8e SqlSession&#xff0c;\u9ed8\u8ba4\u5f00\u542f\u3002\u540c\u4e00\u4e2a SqlSession \u4e2d\u6267\u884c\u76f8\u540c\u67e5\u8be2&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u590d\u7528\u7ed3\u679c\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e8c\u7ea7\u7f13\u5b58\u5c5e\u4e8e Mapper \u7684 namespace&#xff0c;\u53ef\u4ee5\u5728\u591a\u4e2a SqlSession \u4e4b\u95f4\u5171\u4eab\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5728 Mapper XML \u4e2d\u52a0\u5165\u4e0b\u9762\u7684\u914d\u7f6e\u5373\u53ef\u5f00\u542f\u5f53\u524d\u547d\u540d\u7a7a\u95f4\u7684\u4e8c\u7ea7\u7f13\u5b58&#xff1a;<\/p>\n<p>&lt;mapper namespace&#061;&#034;com.example.mapper.UserMapper&#034;&gt;<br \/>\n    &lt;cache\/&gt;<br \/>\n&lt;\/mapper&gt;<\/p>\n<p>\u4e00\u6b21\u67e5\u8be2\u53ef\u4ee5\u7b80\u5355\u7406\u89e3\u4e3a&#xff1a;\u5148\u68c0\u67e5\u5f53\u524d\u4f1a\u8bdd\u7684\u4e00\u7ea7\u7f13\u5b58&#xff0c;\u518d\u6839\u636e\u7f13\u5b58\u6267\u884c\u5668\u68c0\u67e5\u4e8c\u7ea7\u7f13\u5b58&#xff0c;\u672a\u547d\u4e2d\u65f6\u624d\u8bbf\u95ee\u6570\u636e\u5e93\u3002\u67e5\u8be2\u7ed3\u679c\u4e0d\u4f1a\u7acb\u523b\u8fdb\u5165\u4e8c\u7ea7\u7f13\u5b58&#xff0c;\u901a\u5e38\u8981\u7b49 SqlSession \u63d0\u4ea4\u6216\u5173\u95ed\u540e\u624d\u4f1a\u5199\u5165\u3002<\/p>\n<p>\u5047\u8bbe\u4e24\u4e2a SqlSession \u8c03\u7528\u540c\u4e00\u4e2a UserMapper \u67e5\u8be2\u7528\u6237&#xff1a;\u7b2c\u4e00\u4e2a\u4f1a\u8bdd\u67e5\u8be2\u6570\u636e\u5e93\u5e76\u63d0\u4ea4\u540e&#xff0c;\u7b2c\u4e8c\u4e2a\u4f1a\u8bdd\u518d\u6267\u884c\u76f8\u540c\u8bed\u53e5&#xff0c;\u5c31\u53ef\u80fd\u547d\u4e2d\u4e8c\u7ea7\u7f13\u5b58\u3002<\/p>\n<p>\u5f53\u540c\u4e00 namespace \u4e0b\u6267\u884c insert\u3001update \u6216 delete \u65f6&#xff0c;MyBatis \u9ed8\u8ba4\u4f1a\u6e05\u7a7a\u76f8\u5173\u7f13\u5b58&#xff0c;\u907f\u514d\u7ee7\u7eed\u8bfb\u53d6\u65e7\u6570\u636e\u3002\u67e5\u8be2\u6807\u7b7e\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5c5e\u6027\u63a7\u5236\u884c\u4e3a&#xff1a;<\/p>\n<p>&lt;select id&#061;&#034;findById&#034;<br \/>\n        resultType&#061;&#034;com.example.domain.User&#034;<br \/>\n        useCache&#061;&#034;true&#034;<br \/>\n        flushCache&#061;&#034;false&#034;&gt;<br \/>\n    select id, user_name from user where id &#061; #{id}<br \/>\n&lt;\/select&gt;<\/p>\n<p>\u4e8c\u7ea7\u7f13\u5b58\u770b\u8d77\u6765\u65b9\u4fbf&#xff0c;\u4f46\u5b9e\u9645\u9879\u76ee\u4e2d\u8981\u8c28\u614e\u4f7f\u7528\u3002\u5b83\u4ee5 namespace \u4e3a\u8fb9\u754c&#xff0c;\u5982\u679c\u4e00\u5f20\u8868\u88ab\u591a\u4e2a Mapper \u4fee\u6539&#xff0c;\u7f13\u5b58\u672a\u5fc5\u80fd\u88ab\u6b63\u786e\u611f\u77e5\u548c\u6e05\u7406&#xff1b;\u5206\u5e03\u5f0f\u90e8\u7f72\u4e0b&#xff0c;\u5404\u5b9e\u4f8b\u7684\u672c\u5730\u7f13\u5b58\u4e5f\u4e0d\u4e00\u81f4\u3002\u56e0\u6b64&#xff0c;\u5bf9\u4e00\u81f4\u6027\u8981\u6c42\u9ad8\u7684\u4e1a\u52a1&#xff0c;\u56e2\u961f\u5f80\u5f80\u66f4\u613f\u610f\u4f7f\u7528 Redis \u7b49\u8fb9\u754c\u66f4\u660e\u786e\u7684\u7f13\u5b58\u65b9\u6848\u3002<\/p>\n<h3>\u4e09\u3001resultType \u548c resultMap \u7684\u533a\u522b<\/h3>\n<p>\u4e8c\u8005\u90fd\u7528\u4e8e\u544a\u8bc9 MyBatis\u201c\u67e5\u8be2\u7ed3\u679c\u5e94\u8be5\u600e\u6837\u8f6c\u6362\u6210 Java \u5bf9\u8c61\u201d&#xff0c;\u533a\u522b\u5728\u4e8e\u6620\u5c04\u80fd\u529b\u3002<\/p>\n<h4>resultType&#xff1a;\u9002\u5408\u7b80\u5355\u6620\u5c04<\/h4>\n<p>\u5f53\u5217\u540d\u4e0e Java \u5c5e\u6027\u540d\u80fd\u591f\u76f4\u63a5\u5bf9\u5e94\u65f6&#xff0c;\u4f7f\u7528 resultType \u6700\u7701\u4e8b&#xff1a;<\/p>\n<p>&lt;select id&#061;&#034;findById&#034; resultType&#061;&#034;com.example.domain.User&#034;&gt;<br \/>\n    select id, user_name as userName<br \/>\n    from user<br \/>\n    where id &#061; #{id}<br \/>\n&lt;\/select&gt;<\/p>\n<p>\u8fd9\u91cc\u901a\u8fc7 SQL \u522b\u540d\u8ba9 user_name \u5bf9\u5e94 userName\u3002\u5982\u679c\u5f00\u542f\u4e0b\u5212\u7ebf\u8f6c\u9a7c\u5cf0\u914d\u7f6e&#xff0c;\u5f88\u591a\u573a\u666f\u751a\u81f3\u4e0d\u9700\u8981\u522b\u540d\u3002<\/p>\n<h4>resultMap&#xff1a;\u9002\u5408\u590d\u6742\u6620\u5c04<\/h4>\n<p>\u5b57\u6bb5\u540d\u5dee\u5f02\u8f83\u5927&#xff0c;\u6216\u8005\u5b58\u5728\u5d4c\u5957\u5bf9\u8c61\u3001\u4e00\u5bf9\u4e00\u3001\u4e00\u5bf9\u591a\u5173\u7cfb\u65f6&#xff0c;resultMap \u66f4\u5408\u9002&#xff1a;<\/p>\n<p>&lt;resultMap id&#061;&#034;userMap&#034; type&#061;&#034;com.example.domain.User&#034;&gt;<br \/>\n    &lt;id property&#061;&#034;id&#034; column&#061;&#034;user_id&#034;\/&gt;<br \/>\n    &lt;result property&#061;&#034;userName&#034; column&#061;&#034;user_name&#034;\/&gt;<br \/>\n    &lt;collection property&#061;&#034;roles&#034;<br \/>\n                ofType&#061;&#034;com.example.domain.Role&#034;&gt;<br \/>\n        &lt;id property&#061;&#034;id&#034; column&#061;&#034;role_id&#034;\/&gt;<br \/>\n        &lt;result property&#061;&#034;name&#034; column&#061;&#034;role_name&#034;\/&gt;<br \/>\n    &lt;\/collection&gt;<br \/>\n&lt;\/resultMap&gt;<\/p>\n<p>&lt;select id&#061;&#034;findWithRoles&#034; resultMap&#061;&#034;userMap&#034;&gt;<br \/>\n    select &#8230;<br \/>\n&lt;\/select&gt;<\/p>\n<p>\u53ef\u4ee5\u628a resultType \u7406\u89e3\u4e3a\u201c\u544a\u8bc9 MyBatis \u8fd4\u56de\u4ec0\u4e48\u7c7b\u578b\u201d&#xff0c;\u628a resultMap \u7406\u89e3\u4e3a\u201c\u660e\u786e\u63cf\u8ff0\u6bcf\u4e2a\u5b57\u6bb5\u600e\u4e48\u88c5\u914d\u201d\u3002\u4e00\u6761 SQL \u901a\u5e38\u4e8c\u9009\u4e00&#xff0c;\u4e0d\u80fd\u540c\u65f6\u6307\u5b9a\u4e24\u8005\u3002<\/p>\n<h3>\u56db\u3001Mapper \u63a5\u53e3\u6709\u54ea\u4e9b\u7ed1\u5b9a\u65b9\u5f0f<\/h3>\n<p>\u5e38\u89c1\u7ed1\u5b9a\u65b9\u5f0f\u4e3b\u8981\u6709 XML \u548c\u6ce8\u89e3\u4e24\u79cd\u3002<\/p>\n<h4>1. XML \u7ed1\u5b9a<\/h4>\n<p>XML \u7684 namespace \u5fc5\u987b\u662f Mapper \u63a5\u53e3\u7684\u5168\u9650\u5b9a\u540d&#xff0c;SQL \u6807\u7b7e\u7684 id \u5fc5\u987b\u4e0e\u63a5\u53e3\u65b9\u6cd5\u540d\u5bf9\u5e94&#xff1a;<\/p>\n<p>public interface UserMapper {<br \/>\n    User findById(Long id);<br \/>\n}<\/p>\n<p>&lt;mapper namespace&#061;&#034;com.example.mapper.UserMapper&#034;&gt;<br \/>\n    &lt;select id&#061;&#034;findById&#034; resultType&#061;&#034;com.example.domain.User&#034;&gt;<br \/>\n        select * from user where id &#061; #{id}<br \/>\n    &lt;\/select&gt;<br \/>\n&lt;\/mapper&gt;<\/p>\n<p>MyBatis \u6700\u7ec8\u4f7f\u7528\u7684\u8bed\u53e5\u6807\u8bc6\u662f&#xff1a;<\/p>\n<p>com.example.mapper.UserMapper.findById<\/p>\n<h4>2. \u6ce8\u89e3\u7ed1\u5b9a<\/h4>\n<p>\u7b80\u5355 SQL \u4e5f\u53ef\u4ee5\u76f4\u63a5\u5199\u5728\u63a5\u53e3\u65b9\u6cd5\u4e0a&#xff1a;<\/p>\n<p>&#064;Mapper<br \/>\npublic interface UserMapper {<br \/>\n    &#064;Select(&#034;select * from user where id &#061; #{id}&#034;)<br \/>\n    User findById(Long id);<br \/>\n}<\/p>\n<p>&#064;Mapper \u6216 &#064;MapperScan \u7684\u4f5c\u7528\u662f\u626b\u63cf\u63a5\u53e3\u3001\u6ce8\u518c Mapper Bean&#xff1b;\u771f\u6b63\u5c06\u65b9\u6cd5\u4e0e SQL \u5173\u8054\u8d77\u6765\u7684&#xff0c;\u662f XML \u4e2d\u7684 namespace &#043; id \u6216\u65b9\u6cd5\u4e0a\u7684 SQL \u6ce8\u89e3\u3002<\/p>\n<p>\u590d\u6742 SQL \u66f4\u9002\u5408 XML&#xff0c;\u7b80\u5355\u4e14\u7a33\u5b9a\u7684 SQL \u4f7f\u7528\u6ce8\u89e3\u4f1a\u66f4\u7d27\u51d1\u3002\u9879\u76ee\u4e2d\u53ef\u4ee5\u5171\u5b58&#xff0c;\u4f46\u6700\u597d\u5efa\u7acb\u7edf\u4e00\u89c4\u8303&#xff0c;\u907f\u514d\u540c\u4e00\u6761\u8bed\u53e5\u5728\u4e24\u5904\u7ef4\u62a4\u3002<\/p>\n<h3>\u4e94\u3001Mapper \u63a5\u53e3\u4e3a\u4ec0\u4e48\u4e0d\u9700\u8981\u5b9e\u73b0\u7c7b<\/h3>\n<p>Mapper \u63a5\u53e3\u80fd\u591f\u76f4\u63a5\u8c03\u7528&#xff0c;\u9760\u7684\u662f\u52a8\u6001\u4ee3\u7406\u3002<\/p>\n<p>Spring \u542f\u52a8\u65f6&#xff0c;MyBatis \u626b\u63cf Mapper \u63a5\u53e3&#xff0c;\u901a\u8fc7 MapperFactoryBean \u5c06\u5176\u6ce8\u518c\u4e3a Bean\u3002\u771f\u6b63\u6ce8\u5165\u4e1a\u52a1\u7c7b\u7684\u4e0d\u662f\u63a5\u53e3\u5b9e\u73b0\u7c7b&#xff0c;\u800c\u662f\u7531 MapperProxyFactory \u521b\u5efa\u7684\u4ee3\u7406\u5bf9\u8c61\u3002<\/p>\n<p>\u5f53\u6211\u4eec\u8c03\u7528&#xff1a;<\/p>\n<p>userMapper.findById(1L);<\/p>\n<p>\u8bf7\u6c42\u4f1a\u8fdb\u5165 MapperProxy\u3002\u4ee3\u7406\u5bf9\u8c61\u6839\u636e\u201c\u63a5\u53e3\u5168\u9650\u5b9a\u540d &#043; \u65b9\u6cd5\u540d\u201d\u627e\u5230\u5bf9\u5e94\u7684 MappedStatement&#xff0c;\u7136\u540e\u901a\u8fc7 SqlSession \u6267\u884c\u67e5\u8be2\u3002<\/p>\n<p>\u540e\u7eed\u53ef\u4ee5\u6982\u62ec\u4e3a\u4e0b\u9762\u8fd9\u6761\u94fe\u8def&#xff1a;<\/p>\n<p>Mapper \u63a5\u53e3\u65b9\u6cd5<br \/>\n    \u2192 MapperProxy<br \/>\n    \u2192 MapperMethod<br \/>\n    \u2192 SqlSession<br \/>\n    \u2192 Executor<br \/>\n    \u2192 StatementHandler<br \/>\n    \u2192 JDBC<br \/>\n    \u2192 ResultSetHandler<br \/>\n    \u2192 Java \u5bf9\u8c61<\/p>\n<p>\u5176\u4e2d&#xff0c;Executor \u8d1f\u8d23\u6267\u884c\u7b56\u7565\u548c\u7f13\u5b58&#xff0c;StatementHandler \u8d1f\u8d23\u521b\u5efa\u5e76\u64cd\u4f5c JDBC Statement&#xff0c;ParameterHandler \u8d1f\u8d23\u8bbe\u7f6e\u53c2\u6570&#xff0c;ResultSetHandler \u5219\u6309\u7167 resultType \u6216 resultMap \u5c06\u7ed3\u679c\u96c6\u8f6c\u6362\u6210 Java \u5bf9\u8c61\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00\u521a\u63a5\u89e6 MyBatis \u65f6&#xff0c;\u6211\u4e00\u76f4\u89c9\u5f97 Mapper \u63a5\u53e3\u6709\u70b9\u201c\u795e\u5947\u201d&#xff1a;\u63a5\u53e3\u660e\u660e\u6ca1\u6709\u5b9e\u73b0\u7c7b&#xff0c;\u6ce8\u5165\u540e\u5374\u80fd\u76f4\u63a5\u8c03\u7528&#xff1b;XML \u91cc\u5199\u4e00\u6bb5 SQL&#xff0c;\u8fd4\u56de\u503c\u53c8\u80fd\u81ea\u52a8\u53d8\u6210 Java \u5bf9\u8c61\u3002\u540e\u9762\u518d\u56de\u5934\u770b&#xff0c;\u4f1a\u53d1\u73b0 MyBatis \u5e76\u6ca1\u6709\u51ed\u7a7a\u505a\u4ec0\u4e48\u3002\u5b83\u7684\u6838\u5fc3\u903b\u8f91\u5f88\u6e05\u695a&#xff1a;\u542f\u52a8\u65f6\u89e3\u6790 SQL \u548c\u6620\u5c04\u89c4\u5219&#xff0c;\u8fd0\u884c\u65f6\u4e3a Mapper \u63a5\u53e3\u521b\u5efa\u4ee3\u7406\u5bf9\u8c61&#xff0c;\u518d\u7531\u4ee3\u7406\u5bf9\u8c61\u627e\u5230\u5bf9\u5e94 SQ<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10187,99,1769,223],"topic":[],"class_list":["post-97648","post","type-post","status-publish","format-standard","hentry","category-server","tag-codingplan","tag-java","tag-mybatis","tag-tomcat"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/97648.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00\u521a\u63a5\u89e6 MyBatis \u65f6&#xff0c;\u6211\u4e00\u76f4\u89c9\u5f97 Mapper \u63a5\u53e3\u6709\u70b9\u201c\u795e\u5947\u201d&#xff1a;\u63a5\u53e3\u660e\u660e\u6ca1\u6709\u5b9e\u73b0\u7c7b&#xff0c;\u6ce8\u5165\u540e\u5374\u80fd\u76f4\u63a5\u8c03\u7528&#xff1b;XML \u91cc\u5199\u4e00\u6bb5 SQL&#xff0c;\u8fd4\u56de\u503c\u53c8\u80fd\u81ea\u52a8\u53d8\u6210 Java \u5bf9\u8c61\u3002\u540e\u9762\u518d\u56de\u5934\u770b&#xff0c;\u4f1a\u53d1\u73b0 MyBatis \u5e76\u6ca1\u6709\u51ed\u7a7a\u505a\u4ec0\u4e48\u3002\u5b83\u7684\u6838\u5fc3\u903b\u8f91\u5f88\u6e05\u695a&#xff1a;\u542f\u52a8\u65f6\u89e3\u6790 SQL \u548c\u6620\u5c04\u89c4\u5219&#xff0c;\u8fd0\u884c\u65f6\u4e3a Mapper \u63a5\u53e3\u521b\u5efa\u4ee3\u7406\u5bf9\u8c61&#xff0c;\u518d\u7531\u4ee3\u7406\u5bf9\u8c61\u627e\u5230\u5bf9\u5e94 SQ\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/97648.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-29T15:00:43+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97648.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/97648.html\",\"name\":\"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-29T15:00:43+00:00\",\"dateModified\":\"2026-08-29T15:00:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/97648.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/97648.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97648.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/97648.html","og_locale":"zh_CN","og_type":"article","og_title":"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u524d\u8a00\u521a\u63a5\u89e6 MyBatis \u65f6&#xff0c;\u6211\u4e00\u76f4\u89c9\u5f97 Mapper \u63a5\u53e3\u6709\u70b9\u201c\u795e\u5947\u201d&#xff1a;\u63a5\u53e3\u660e\u660e\u6ca1\u6709\u5b9e\u73b0\u7c7b&#xff0c;\u6ce8\u5165\u540e\u5374\u80fd\u76f4\u63a5\u8c03\u7528&#xff1b;XML \u91cc\u5199\u4e00\u6bb5 SQL&#xff0c;\u8fd4\u56de\u503c\u53c8\u80fd\u81ea\u52a8\u53d8\u6210 Java \u5bf9\u8c61\u3002\u540e\u9762\u518d\u56de\u5934\u770b&#xff0c;\u4f1a\u53d1\u73b0 MyBatis \u5e76\u6ca1\u6709\u51ed\u7a7a\u505a\u4ec0\u4e48\u3002\u5b83\u7684\u6838\u5fc3\u903b\u8f91\u5f88\u6e05\u695a&#xff1a;\u542f\u52a8\u65f6\u89e3\u6790 SQL \u548c\u6620\u5c04\u89c4\u5219&#xff0c;\u8fd0\u884c\u65f6\u4e3a Mapper \u63a5\u53e3\u521b\u5efa\u4ee3\u7406\u5bf9\u8c61&#xff0c;\u518d\u7531\u4ee3\u7406\u5bf9\u8c61\u627e\u5230\u5bf9\u5e94 SQ","og_url":"https:\/\/www.wsisp.com\/helps\/97648.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-29T15:00:43+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/97648.html","url":"https:\/\/www.wsisp.com\/helps\/97648.html","name":"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-29T15:00:43+00:00","dateModified":"2026-08-29T15:00:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/97648.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/97648.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/97648.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MyBatis \u6838\u5fc3\u539f\u7406\u8be6\u89e3\uff1aJPA\u3001\u4e8c\u7ea7\u7f13\u5b58\u3001\u7ed3\u679c\u6620\u5c04\u4e0e Mapper \u4ee3\u7406"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=97648"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97648\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=97648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=97648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=97648"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=97648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}