{"id":7748,"date":"2024-11-14T15:54:20","date_gmt":"2024-11-14T07:54:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7748\/"},"modified":"2024-11-14T15:54:20","modified_gmt":"2024-11-14T07:54:20","slug":"%e5%a6%82%e4%bd%95%e9%ab%98%e6%95%88%e8%8e%b7%e5%8f%96%e7%94%a8%e6%88%b7%e8%a2%ab%e6%8e%88%e6%9d%83%e7%9a%84%e5%88%86%e7%ba%a7%e7%bb%93%e6%9e%84%ef%bc%8c%e5%b9%b6%e6%94%af%e6%8c%81%e5%88%86%e9%a1%b5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7748\/","title":{"rendered":"\u5982\u4f55\u9ad8\u6548\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784\uff0c\u5e76\u652f\u6301\u5206\u9875\u67e5\u8be2\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173121645838082.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u9ad8\u6548\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784\uff0c\u5e76\u652f\u6301\u5206\u9875\u67e5\u8be2\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u9ad8\u6548\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784\uff0c\u5e76\u652f\u6301\u5206\u9875\u67e5\u8be2\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u9ad8\u6548\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784<\/strong><\/p>\n<p>\u5728\u590d\u6742\u7684\u6388\u6743\u7ed3\u6784\u4e0b\uff0c\u67e5\u8be2\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784\u5341\u5206\u91cd\u8981\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u6709\u6548\u7387\u5730\u4ece mysql \u6570\u636e\u5e93\u4e2d\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684 f\u3001e \u548c d \u5217\u8868\uff0c\u5e76\u652f\u6301\u5206\u9875\u529f\u80fd\u3002<\/p>\n<p><strong>\u9700\u6c42\u5206\u6790<\/strong><\/p>\n<p>\u7528\u6237\u901a\u8fc7\u4e0d\u540c\u6388\u6743\u6a21\u5f0f\u53ef\u83b7\u6388\u6743\uff1a<\/p>\n<ul>\n<li>[1] \u5168\u90e8\u6388\u6743 d\u3001e\u3001f<\/li>\n<li>[2] \u6388\u6743 d\uff0c\u5305\u62ec d \u4e0b\u6240\u6709 e \u548c f<\/li>\n<li>[3] \u6388\u6743 d &gt; e\uff0c\u5305\u62ec e \u4e0b\u6240\u6709 f<\/li>\n<li>[4] \u6388\u6743 d &gt; e &gt; f<\/li>\n<li>[5] \u6388\u6743 area\uff0c\u5305\u62ec\u6240\u6709\u5c5e\u4e8e area \u7684 f\uff0c\u8de8 d\uff0c\u8de8 d &gt; e<\/li>\n<li>[6] \u6388\u6743 d \u4e0b\u7684 area \uff0c\u542b d \u4e0b\u6240\u6709\u5728 area \u7684 f\uff0c\u8de8 d &gt; e<\/li>\n<li>[7] \u6388\u6743 d &gt; e \u4e0b\u7684 area \uff0c\u542b e \u4e0b\u6240\u6709\u5728 area \u7684 f<\/li>\n<\/ul>\n<p><strong>\u67e5\u8be2\u7b56\u7565<\/strong><\/p>\n<p>\u9488\u5bf9\u7528\u6237\u88ab\u6388\u6743\u7684 f \u5217\u8868\uff0c\u6570\u91cf\u8f83\u591a\uff0c\u9700\u8981\u5206\u9875\uff0c\u4e14\u53bb\u91cd\u3002\u53ef\u91c7\u7528\u4ee5\u4e0b\u67e5\u8be2\u7b56\u7565\uff1a<\/p>\n<pre>select f.f_id, f.f_name, f.f_area\nfrom p\njoin f on p.f_id = f.f_id or p.f_id = 0\nwhere p.u_id = @user_id and (p.d_id = f.d_id or p.d_id = 0)\nand (p.e_id = f.e_id or p.e_id = 0)\nand (p.a_code = f.f_area or p.a_code = \"\")\norder by f.f_id\nlimit x, y<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff0cx \u4e3a\u8d77\u59cb\u7d22\u5f15\uff0cy \u4e3a\u6bcf\u9875\u7684\u6570\u91cf\u3002<\/p>\n<p>\u5bf9\u4e8e\u7528\u6237\u88ab\u6388\u6743\u7684 e \u548c d \u5217\u8868\uff0c\u53ef\u91c7\u7528\u7c7b\u4f3c\u67e5\u8be2\u7b56\u7565\uff1a<\/p>\n<pre>-- E \u5217\u8868\u67e5\u8be2\nSELECT E.E_id, E.E_name\nFROM P\nJOIN E ON P.E_id = E.E_id OR P.E_id = 0\nWHERE P.U_id = @user_id AND (P.D_id = E.D_id OR P.D_id = 0)\nORDER BY E.E_id\nLIMIT x, y\n\n-- D \u5217\u8868\u67e5\u8be2\nSELECT D.D_id, D.D_name\nFROM P\nJOIN D ON P.D_id = D.D_id OR P.D_id = 0\nWHERE P.U_id = @user_id\nORDER BY D.D_id\nLIMIT x, y<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u9ad8\u6548\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784\uff0c\u5e76\u652f\u6301\u5206\u9875\u67e5\u8be2\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>\u9ad8\u6548\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784 \u5728\u590d\u6742\u7684\u6388\u6743\u7ed3\u6784\u4e0b\uff0c\u67e5\u8be2\u7528\u6237\u88ab\u6388\u6743\u7684\u5206\u7ea7\u7ed3\u6784\u5341\u5206\u91cd\u8981\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u6709\u6548\u7387\u5730\u4ece mysql \u6570\u636e\u5e93\u4e2d\u83b7\u53d6\u7528\u6237\u88ab\u6388\u6743\u7684 f\u3001e \u548c d \u5217\u8868\uff0c\u5e76\u652f\u6301\u5206\u9875\u529f\u80fd\u3002 \u9700\u6c42\u5206\u6790 \u7528\u6237\u901a\u8fc7\u4e0d\u540c\u6388\u6743\u6a21\u5f0f\u53ef\u83b7\u6388\u6743\uff1a [1] \u5168\u90e8\u6388\u6743 d\u3001e\u3001f [2] \u6388\u6743 d\uff0c\u5305\u62ec d \u4e0b\u6240\u6709 e \u548c f [3] \u6388\u6743 d &gt; e\uff0c\u5305\u62ec e \u4e0b\u6240\u6709 f [4] \u6388\u6743 d &gt; e &gt; f [5] \u6388\u6743 area\uff0c\u5305\u62ec\u6240\u6709\u5c5e\u4e8e area \u7684 f\uff0c\u8de8 d\uff0c\u8de8 d &gt; e [6] \u6388\u6743 d \u4e0b\u7684 area \uff0c\u542b d \u4e0b\u6240\u6709\u5728 area [&hellip;]<\/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-7748","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7748","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=7748"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7748\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}