{"id":853,"date":"2020-03-25T15:46:15","date_gmt":"2020-03-25T07:46:15","guid":{"rendered":"http:\/\/toradora.xyz\/?p=853"},"modified":"2020-07-30T16:31:38","modified_gmt":"2020-07-30T08:31:38","slug":"%e5%88%a4%e6%96%ad%e4%b8%80%e4%b8%aa%e9%9d%9e%e4%b8%bb%e9%94%ae%e5%ad%97%e6%ae%b5%e6%98%af%e5%90%a6%e5%ad%98%e5%9c%a8%e6%95%b0%e6%8d%ae%e7%9a%84%e4%b8%89%e6%ac%a1%e6%94%b9%e8%bf%9b","status":"publish","type":"post","link":"https:\/\/diuut.com\/?p=853","title":{"rendered":"\u5224\u65ad\u4e00\u4e2a\u975e\u4e3b\u952e\u5b57\u6bb5\u662f\u5426\u5b58\u5728\u6570\u636e\u7684\u4e09\u6b21\u6539\u8fdb"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>\u7b2c\u4e00\u6b21<\/p><\/blockquote>\n\n\n\n<p>\u5c01\u88c5\u4e00\u4e2aHashMap\uff0c\u5c06\u67e5\u8be2\u6761\u4ef6put\u8fdb\u53bb\uff0c\u7136\u540e\u4f7f\u7528MyBites\u7684\u9ed8\u8ba4\u65b9\u6cd5SelectByMap\uff0c\u67e5\u51fa\u6765\u4e00\u4e2aList,\u7136\u540e\u6839\u636eList.size\uff01=0\uff0c\u5224\u65ad\u8be5\u6761\u6570\u636e\u662f\u5426\u5b58\u5728\u5b58\u5728\u95ee\u9898<\/p>\n\n\n\n<p><strong>\u5b58\u5728\u95ee\u9898\uff1a<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u6570\u636e\u5e93\u8868\u4e2d\u5b58\u572810W\u6761\u6570\u636e\uff0c\u901a\u8fc7\u9ed8\u8ba4\u65b9\u6cd5\u67e5\u8be2\u4e00\u4e2aList\uff0c\u5373\u4f7f\u67e5\u5230\u4e86\u4e00\u4e2a\u91cd\u590d\u7684\uff0c\u6570\u636e\u5e93\u8fd8\u662f\u4f1a\u7ee7\u7eed\u67e5\u4e0b\u53bb\uff0c\u76f4\u81f3\u8d70\u5b8c10W\u6761\u6570\u636e\uff0c\u5bfc\u81f4\u6d6a\u8d39\u6570\u636e\u5e93\u8d44\u6e90\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u7b2c\u4e8c\u6b21<\/p><\/blockquote>\n\n\n\n<p>\u901a\u8fc7MyBites\u6ce8\u89e3\u81ea\u5b9a\u4e49SQL\u8bed\u53e5\u5199\u5230Dao\u5c42\u63a5\u53e3\u4e2d,\u52a0\u4e0a@SELECT\u6ce8\u89e3\uff0c\u5728\u6ce8\u89e3\u540e\u53c2\u6570\u4e2d\u5199\u5165SQL\u8bed\u53e5<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: sql; title: ; notranslate\" title=\"\">\nSELECT * \nFROM \u6570\u636e\u5e93\u8868 \nWHERE #\u5b57\u6bb5\u540d={\u53c2\u6570} \nLIMTE 1\n<\/pre><\/div>\n\n\n<p>\u540c\u6837\u8fd4\u56de\u4e00\u4e2aList\uff0c\u7136\u540e\u6839\u636eList.size\uff01=0\uff0c\u5224\u65ad\u8be5\u6761\u6570\u636e\u662f\u5426\u5b58\u5728,LIMIT 1 \u9650\u5b9a\u4e86\u53ea\u67e5\u4e00\u6761\uff0c\u67e5\u5230\u4e86\u4e00\u6761\u7b26\u5408\u6761\u4ef6\u7684\u6570\u636e\u540e\u5c31\u8fd4\u56de\uff0c\u4e0d\u4f1a\u7ee7\u7eed\u8d70\u5b8c\u6574\u4e2a\u8868\u3002<\/p>\n\n\n\n<p><strong>\u5b58\u5728\u95ee\u9898\uff1a<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u6570\u636e\u5e93\u8868\u5b57\u6bb5\u7279\u522b\u957f\uff0c\u6bcf\u6b21\u67e5\u8be2\uff0c\u5373\u4f7f\u52a0\u4e86LIMIT 1\uff0c\u53ea\u67e5\u8be2\u4e00\u6761\uff0c\u4f46\u662f\u4e5f\u4f1a\u628a\u6240\u6709\u5b57\u6bb5\u52a0\u8f7d\u51fa\u6765\uff0c\u5bfc\u81f4\u6d6a\u8d39\u6570\u636e\u5e93\u8d44\u6e90\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u7b2c\u4e09\u6b21<\/p><\/blockquote>\n\n\n\n<p>\u540c\u7b2c\u4e8c\u6b21\u4e00\u6837\u81ea\u5b9a\u4e49SQL\u8bed\u53e5<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: sql; title: ; notranslate\" title=\"\">\nSELECT * \nFROM \u6570\u636e\u5e93\u8868 \nWHERE #\u5b57\u6bb5\u540d={\u53c2\u6570} \nLIMTE 1\n<\/pre><\/div>\n\n\n<p>count(1)\uff0c\u5176\u5b9e\u5c31\u662f\u8ba1\u7b97\u4e00\u5171\u6709\u591a\u5c11\u7b26\u5408\u6761\u4ef6\u7684\u884c\u3002<br>1\u5e76\u4e0d\u662f\u8868\u793a\u7b2c\u4e00\u4e2a\u5b57\u6bb5\uff0c\u800c\u662f\u8868\u793a\u4e00\u4e2a\u56fa\u5b9a\u503c\u3002 <\/p>\n\n\n\n<p><strong>\u6700\u540e\u4e00\u6b21\u89e3\u51b3\u4e86\u6570\u636e\u5e93\u8868\u4e2d\u6570\u636e\u7279\u522b\u591a\uff0c\u5b57\u6bb5\u7279\u522b\u957f\u7684\u60c5\u51b5\u4e0b\u7684\u6570\u636e\u5e93\u8d44\u6e90\u6d6a\u8d39\uff0c\u5e76\u4e14\u7b80\u5316\u4e86\u5224\u65ad\u6570\u636e\u5b58\u5728\u7684\u65b9\u5f0f\uff0c\u76f4\u63a5\u8fd4\u56de\u4e00\u4e2aint\u6570\u503c\uff0c\u901a\u8fc7\u5224\u65ad\u8fd9\u4e2a\u6570\u503c\uff01=0\uff0c\u5c31\u53ef\u4ee5\u5224\u65ad\u51fa\u8be5\u6761\u6570\u636e\u662f\u5426\u5b58\u5728\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u4e00\u6b21 \u5c01\u88c5\u4e00\u4e2aHashMap\uff0c\u5c06\u67e5\u8be2\u6761\u4ef6put\u8fdb\u53bb\uff0c\u7136\u540e\u4f7f\u7528MyBites\u7684\u9ed8\u8ba4\u65b9\u6cd5SelectByMap\uff0c<span class=\"more-button\"><a href=\"https:\/\/diuut.com\/?p=853\" class=\"more-link\">view all . . .<span class=\"screen-reader-text\">\u5224\u65ad\u4e00\u4e2a\u975e\u4e3b\u952e\u5b57\u6bb5\u662f\u5426\u5b58\u5728\u6570\u636e\u7684\u4e09\u6b21\u6539\u8fdb<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":867,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/853"}],"collection":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=853"}],"version-history":[{"count":1,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions"}],"predecessor-version":[{"id":1124,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions\/1124"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/media\/867"}],"wp:attachment":[{"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}