{"id":7683,"date":"2024-11-14T09:47:27","date_gmt":"2024-11-14T01:47:27","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7683\/"},"modified":"2024-11-14T09:47:27","modified_gmt":"2024-11-14T01:47:27","slug":"%e5%88%a0%e9%99%a4%e9%a2%98%e7%9b%ae%e5%90%8e%ef%bc%8c%e5%a6%82%e4%bd%95%e4%bf%9d%e8%af%81%e8%87%aa%e5%8a%a8%e6%8a%bd%e9%a2%98%e7%b3%bb%e7%bb%9f%e4%b8%ad%e9%a2%98%e7%9b%ae%e6%95%b0%e9%87%8f%e5%92%8c","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7683\/","title":{"rendered":"\u5220\u9664\u9898\u76ee\u540e\uff0c\u5982\u4f55\u4fdd\u8bc1\u81ea\u52a8\u62bd\u9898\u7cfb\u7edf\u4e2d\u9898\u76ee\u6570\u91cf\u548c\u6570\u636e\u5e93 ID \u4e00\u81f4\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173114190417878.jpg\" class=\"aligncenter\" title=\"\u5220\u9664\u9898\u76ee\u540e\uff0c\u5982\u4f55\u4fdd\u8bc1\u81ea\u52a8\u62bd\u9898\u7cfb\u7edf\u4e2d\u9898\u76ee\u6570\u91cf\u548c\u6570\u636e\u5e93 ID \u4e00\u81f4\uff1f\u63d2\u56fe\" alt=\"\u5220\u9664\u9898\u76ee\u540e\uff0c\u5982\u4f55\u4fdd\u8bc1\u81ea\u52a8\u62bd\u9898\u7cfb\u7edf\u4e2d\u9898\u76ee\u6570\u91cf\u548c\u6570\u636e\u5e93 ID \u4e00\u81f4\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5220\u9664\u81ea\u52a8\u751f\u6210\u4e3b\u952e id \u540e\u5982\u4f55\u89e3\u51b3\u6570\u636e\u5e93 id \u95ee\u9898\uff1f<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5728\u4e00\u4e2a\u81ea\u52a8\u62bd\u9898\u7cfb\u7edf\u4e2d\uff0c\u6570\u636e\u5e93\u4f7f\u7528\u4e3b\u952e\u81ea\u589e\u957f\uff0c\u4e14\u7cfb\u7edf\u63d0\u4f9b\u4e86\u5220\u9664\u529f\u80fd\u3002\u5728\u5220\u9664\u67d0\u4e9b\u9898\u76ee\u540e\uff0c\u9898\u76ee\u6570\u91cf\u548c\u6570\u636e\u5e93 id \u4e4b\u95f4\u51fa\u73b0\u4e0d\u4e00\u81f4\u3002\u5982\u4f55\u89e3\u51b3\u6b64\u95ee\u9898\uff1f<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u76f4\u63a5\u67e5\u8be2\u6240\u6709\u5269\u4f59\u7684\u9898\u76ee\uff0c\u7136\u540e\u4ece\u4e2d\u968f\u673a\u9009\u62e9\u5373\u53ef\u3002\u65e0\u9700\u5173\u6ce8\u6570\u636e\u5e93 id \u662f\u5426\u8fde\u7eed\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>select * from questions;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b64\u67e5\u8be2\u5c06\u8fd4\u56de\u6240\u6709\u5269\u4f59\u7684\u9898\u76ee\uff0c\u7136\u540e\u60a8\u53ef\u4ee5\u4f7f\u7528 random \u51fd\u6570\u4ece\u4e2d\u968f\u673a\u9009\u62e9\u4e00\u4e2a\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>\/\/ \u83b7\u53d6\u6240\u6709\u5269\u4f59\u9898\u76ee\nList&lt;Question&gt; questions = jdbcTemplate.query(\"SELECT * FROM questions\", Question.class);\n\n\/\/ \u4ece\u9898\u76ee\u5217\u8868\u4e2d\u968f\u673a\u9009\u62e9\u4e00\u4e2a\nQuestion question = questions.get(new Random().nextInt(questions.size()));<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4f1a\u53d7\u6570\u636e\u5e93 id \u53d8\u5316\u7684\u5f71\u54cd\uff0c\u59cb\u7ec8\u53ef\u4ee5\u786e\u4fdd\u62bd\u53d6\u5230\u6709\u6548\u9898\u76ee\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5220\u9664\u9898\u76ee\u540e\uff0c\u5982\u4f55\u4fdd\u8bc1\u81ea\u52a8\u62bd\u9898\u7cfb\u7edf\u4e2d\u9898\u76ee\u6570\u91cf\u548c\u6570\u636e\u5e93 ID \u4e00\u81f4\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>\u5220\u9664\u81ea\u52a8\u751f\u6210\u4e3b\u952e id \u540e\u5982\u4f55\u89e3\u51b3\u6570\u636e\u5e93 id \u95ee\u9898\uff1f \u95ee\u9898\uff1a \u5728\u4e00\u4e2a\u81ea\u52a8\u62bd\u9898\u7cfb\u7edf\u4e2d\uff0c\u6570\u636e\u5e93\u4f7f\u7528\u4e3b\u952e\u81ea\u589e\u957f\uff0c\u4e14\u7cfb\u7edf\u63d0\u4f9b\u4e86\u5220\u9664\u529f\u80fd\u3002\u5728\u5220\u9664\u67d0\u4e9b\u9898\u76ee\u540e\uff0c\u9898\u76ee\u6570\u91cf\u548c\u6570\u636e\u5e93 id \u4e4b\u95f4\u51fa\u73b0\u4e0d\u4e00\u81f4\u3002\u5982\u4f55\u89e3\u51b3\u6b64\u95ee\u9898\uff1f \u89e3\u51b3\u65b9\u6848\uff1a \u76f4\u63a5\u67e5\u8be2\u6240\u6709\u5269\u4f59\u7684\u9898\u76ee\uff0c\u7136\u540e\u4ece\u4e2d\u968f\u673a\u9009\u62e9\u5373\u53ef\u3002\u65e0\u9700\u5173\u6ce8\u6570\u636e\u5e93 id \u662f\u5426\u8fde\u7eed\u3002\u4f8b\u5982\uff1a select * from questions; \u767b\u5f55\u540e\u590d\u5236 \u6b64\u67e5\u8be2\u5c06\u8fd4\u56de\u6240\u6709\u5269\u4f59\u7684\u9898\u76ee\uff0c\u7136\u540e\u60a8\u53ef\u4ee5\u4f7f\u7528 random \u51fd\u6570\u4ece\u4e2d\u968f\u673a\u9009\u62e9\u4e00\u4e2a\uff0c\u5982\u4e0b\u6240\u793a\uff1a \/\/ \u83b7\u53d6\u6240\u6709\u5269\u4f59\u9898\u76ee List&lt;Question&gt; questions = jdbcTemplate.query(&#8220;SELECT * FROM questions&#8221;, Question.class); \/\/ \u4ece\u9898\u76ee\u5217\u8868\u4e2d\u968f\u673a\u9009\u62e9\u4e00\u4e2a Question question = questions.get(new Random().nextInt(questions.size())); \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4f1a\u53d7\u6570\u636e\u5e93 id \u53d8\u5316\u7684\u5f71\u54cd\uff0c\u59cb\u7ec8\u53ef\u4ee5\u786e\u4fdd\u62bd\u53d6\u5230\u6709\u6548\u9898\u76ee\u3002 \u4ee5\u4e0a\u5c31\u662f\u5220\u9664\u9898\u76ee\u540e\uff0c\u5982\u4f55\u4fdd\u8bc1\u81ea\u52a8\u62bd\u9898\u7cfb\u7edf\u4e2d\u9898\u76ee\u6570\u91cf\u548c\u6570\u636e\u5e93 ID \u4e00\u81f4\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-7683","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7683","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=7683"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7683\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}