
{"id":2776,"date":"2020-12-19T09:53:59","date_gmt":"2020-12-19T01:53:59","guid":{"rendered":"http:\/\/127.0.0.2\/?p=2776"},"modified":"2020-12-19T09:53:59","modified_gmt":"2020-12-19T01:53:59","slug":"2020java%e6%a1%86%e6%9e%b6%e6%95%99%e7%a8%8b%e4%b9%8bmybatis%e5%8f%82%e6%95%b0%e4%bc%a0%e9%80%92","status":"publish","type":"post","link":"https:\/\/www.9713job.com\/?p=2776","title":{"rendered":"2020java\u6846\u67b6\u6559\u7a0b\u4e4bmybatis\u53c2\u6570\u4f20\u9012"},"content":{"rendered":"<h3>2020java\u6846\u67b6\u6559\u7a0b\u4e4bmybatis\u53c2\u6570\u4f20\u9012<\/h3>\n<h3>\u4e00\u3001\u5206\u9875<\/h3>\n<p><strong>\u65b9\u5f0f1\uff1a\u4f7f\u7528\u7d22\u5f15<\/strong><\/p>\n<p>\u6309\u7167\u53c2\u6570\u7684\u987a\u5e8f\uff0c\u4ece0\u5f00\u59cb<\/p>\n<p>select*from users limit <strong><span style=\"color: #ff0000;\">#{0},#{1}<\/span><\/strong><\/p>\n<p><strong>\u65b9\u5f0f2\uff1a\u4f7f\u7528\u6ce8\u89e3<\/strong><\/p>\n<p>select*from users limit #{start},#{pageSize}<\/p>\n<p>List&lt;Users&gt; selectUsersPage2(<br \/>\n<strong><span style=\"color: #ff0000;\">@Param(value = &#8220;start&#8221;)<\/span><\/strong> int start,<br \/>\n<span style=\"color: #ff0000;\"><strong>@Param(value = &#8220;pageSize&#8221;)<\/strong><\/span> int pageSize);<\/p>\n<p><strong>\u65b9\u5f0f3\uff1a\u4f7f\u7528Map<\/strong><\/p>\n<p><!--more--><\/p>\n<p>select*from users limit #{start},#{pageSize}<\/p>\n<p>List&lt;Users&gt; selectUsersPage3(Map&lt;String,Object&gt; map);<\/p>\n<pre>@Test\r\npublic void test9(){\r\n    SqlSession sqlSession = MybatisUtils.getSqlSession();\r\n    UsersDao mapper = sqlSession.getMapper(UsersDao.class);\r\n    <span style=\"color: #0000ff;\"><strong>Map&lt;String,Object&gt; map=new HashMap&lt;&gt;();<\/strong><\/span>\r\n<span style=\"color: #0000ff;\"><strong>    map.put(\"start\",2);<\/strong><\/span>\r\n<span style=\"color: #0000ff;\"><strong>    map.put(\"pageSize\",2);<\/strong><\/span>\r\n    List&lt;Users&gt; users = mapper.selectUsersPage3(map);\r\n    sqlSession.close();\r\n    System.out.println(users);\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>2020java\u6846\u67b6\u6559\u7a0b\u4e4bmybatis\u53c2\u6570\u4f20\u9012 \u4e00\u3001\u5206\u9875 \u65b9\u5f0f1\uff1a\u4f7f\u7528\u7d22\u5f15 \u6309\u7167\u53c2\u6570\u7684\u987a\u5e8f\uff0c\u4ece0\u5f00\u59cb sel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2776","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2776"}],"version-history":[{"count":3,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2776\/revisions"}],"predecessor-version":[{"id":2779,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2776\/revisions\/2779"}],"wp:attachment":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}