{"id":7018,"date":"2024-11-14T14:29:05","date_gmt":"2024-11-14T06:29:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7018\/"},"modified":"2024-11-14T14:29:05","modified_gmt":"2024-11-14T06:29:05","slug":"spring-boot-%e4%bd%bf%e7%94%a8-pagehelper-%e5%88%86%e9%a1%b5%e6%97%b6%ef%bc%8c%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e6%97%a0%e5%86%85%e5%ae%b9%e9%a1%b5%e9%9d%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7018\/","title":{"rendered":"Spring Boot \u4f7f\u7528 PageHelper \u5206\u9875\u65f6\uff0c\u5982\u4f55\u5904\u7406\u65e0\u5185\u5bb9\u9875\u9762\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173028282078560.jpg\" class=\"aligncenter\" title=\"Spring Boot \u4f7f\u7528 PageHelper \u5206\u9875\u65f6\uff0c\u5982\u4f55\u5904\u7406\u65e0\u5185\u5bb9\u9875\u9762\uff1f\u63d2\u56fe\" alt=\"Spring Boot \u4f7f\u7528 PageHelper \u5206\u9875\u65f6\uff0c\u5982\u4f55\u5904\u7406\u65e0\u5185\u5bb9\u9875\u9762\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5728 spring boot \u4f7f\u7528 pagehelper \u5206\u9875\u65f6\u5982\u4f55\u5904\u7406\u65e0\u5185\u5bb9\u9875\u9762\uff1f<\/strong><\/p>\n<p>\u5728 spring boot \u4e2d\u4f7f\u7528 pagehelper \u5206\u9875\u65f6\uff0c\u5f53\u8f93\u5165\u7684\u9875\u7801\u8d85\u51fa\u6570\u636e\u603b\u9875\u6570\u65f6\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5b83\u4ecd\u4f1a\u8fd4\u56de\u6700\u540e\u4e00\u9875\u7684\u5185\u5bb9\u3002\u4f46\u662f\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u5408\u7406\u7684\u5206\u9875\u53c2\u6570\u6765\u5b9e\u73b0\u8f93\u5165\u8d85\u51fa\u9875\u7801\u8303\u56f4\u65f6\u8fd4\u56de\u7a7a\u7ed3\u6784\u7684\u76ee\u6807\u3002<\/p>\n<p><strong>\u5982\u4f55\u8bbe\u7f6e\u5408\u7406\u7684\u5206\u9875\u53c2\u6570\uff1f<\/strong><\/p>\n<p>pagehelper \u4e2d\u63d0\u4f9b\u4e86 reasonable \u53c2\u6570\uff0c\u9ed8\u8ba4\u503c\u4e3a false\u3002\u5f53\u8be5\u53c2\u6570\u8bbe\u7f6e\u4e3a true \u65f6\uff0c\u5f53 pagenum pages\uff08\u8d85\u8fc7\u603b\u6570\u65f6\uff09\uff0c\u67e5\u8be2\u6700\u540e\u4e00\u9875\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06 reasonable \u53c2\u6570\u8bbe\u7f6e\u4e3a true\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>PageHelper.startPage(currentPage, pageSize, true);\nList&lt;T&gt; list = selectList(example);<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u901a\u8fc7\u8bbe\u7f6e\u5408\u7406\u5206\u9875\u53c2\u6570\uff0c\u5f53\u8f93\u5165 page=10 \u65f6\uff0c\u5982\u679c\u53ea\u6709 3 \u9875\u6570\u636e\uff0cpagehelper \u4f1a\u5c06\u7ed3\u679c\u96c6\u8bbe\u5b9a\u4e3a\u7a7a\u5217\u8868\u6765\u8fd4\u56de\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fSpring Boot \u4f7f\u7528 PageHelper \u5206\u9875\u65f6\uff0c\u5982\u4f55\u5904\u7406\u65e0\u5185\u5bb9\u9875\u9762\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 spring boot \u4f7f\u7528 pagehelper \u5206\u9875\u65f6\u5982\u4f55\u5904\u7406\u65e0\u5185\u5bb9\u9875\u9762\uff1f \u5728 spring boot \u4e2d\u4f7f\u7528 pagehelper \u5206\u9875\u65f6\uff0c\u5f53\u8f93\u5165\u7684\u9875\u7801\u8d85\u51fa\u6570\u636e\u603b\u9875\u6570\u65f6\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5b83\u4ecd\u4f1a\u8fd4\u56de\u6700\u540e\u4e00\u9875\u7684\u5185\u5bb9\u3002\u4f46\u662f\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u5408\u7406\u7684\u5206\u9875\u53c2\u6570\u6765\u5b9e\u73b0\u8f93\u5165\u8d85\u51fa\u9875\u7801\u8303\u56f4\u65f6\u8fd4\u56de\u7a7a\u7ed3\u6784\u7684\u76ee\u6807\u3002 \u5982\u4f55\u8bbe\u7f6e\u5408\u7406\u7684\u5206\u9875\u53c2\u6570\uff1f pagehelper \u4e2d\u63d0\u4f9b\u4e86 reasonable \u53c2\u6570\uff0c\u9ed8\u8ba4\u503c\u4e3a false\u3002\u5f53\u8be5\u53c2\u6570\u8bbe\u7f6e\u4e3a true \u65f6\uff0c\u5f53 pagenum pages\uff08\u8d85\u8fc7\u603b\u6570\u65f6\uff09\uff0c\u67e5\u8be2\u6700\u540e\u4e00\u9875\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06 reasonable \u53c2\u6570\u8bbe\u7f6e\u4e3a true\uff0c\u5982\u4e0b\u6240\u793a\uff1a PageHelper.startPage(currentPage, pageSize, true); List&lt;T&gt; list = selectList(example); \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u8bbe\u7f6e\u5408\u7406\u5206\u9875\u53c2\u6570\uff0c\u5f53\u8f93\u5165 page=10 \u65f6\uff0c\u5982\u679c\u53ea\u6709 3 \u9875\u6570\u636e\uff0cpagehelper \u4f1a\u5c06\u7ed3\u679c\u96c6\u8bbe\u5b9a\u4e3a\u7a7a\u5217\u8868\u6765\u8fd4\u56de\u3002 \u4ee5\u4e0a\u5c31\u662fSpring Boot \u4f7f\u7528 PageHelper \u5206\u9875\u65f6\uff0c\u5982\u4f55\u5904\u7406\u65e0\u5185\u5bb9\u9875\u9762\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\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-7018","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7018","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=7018"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7018\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}