{"id":792,"date":"2023-06-28T15:01:15","date_gmt":"2023-06-28T07:01:15","guid":{"rendered":"https:\/\/www.furyblog.com\/?p=792"},"modified":"2023-06-28T15:01:16","modified_gmt":"2023-06-28T07:01:16","slug":"%e6%b5%b7%e5%ba%b7%e5%a8%81%e8%a7%86pms%e6%9f%a5%e8%af%a2%e6%9c%88%e5%ba%a6%e5%81%9c%e5%9c%ba%e6%97%b6%e9%95%bf%e5%88%86%e5%b8%83","status":"publish","type":"post","link":"https:\/\/www.furyblog.com\/?p=792","title":{"rendered":"\u6d77\u5eb7\u5a01\u89c6PMS\u67e5\u8be2\u6708\u5ea6\u505c\u573a\u65f6\u957f\u5206\u5e03"},"content":{"rendered":"\n<p>\u5728\u73b0\u5728\u7684PMS5.0.1\u7248\u672c\u4e2d\uff0c\u5229\u7528SQL\u67e5\u8be2\u6bcf\u4e2a\u6708\u7684\u505c\u8f66\u65f6\u957f\u5206\u5e03\uff0c\u53ef\u5229\u7528\u8be5\u6570\u636e\u5206\u6790\u8f66\u573a\u8fd0\u8425\u60c5\u51b5\uff0c\u9488\u5bf9\u73b0\u6709\u7684\u6536\u8d39\u89c4\u5219\u8fdb\u884c\u8c03\u6574\uff0c\u6700\u5927\u5316\u5b9e\u73b0\u8425\u6536\u4e0e\u4fbf\u6c11\u7684\u5e73\u8861\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>WITH ranges AS (\n    SELECT 0 AS start, 60 AS end, '0-1\u5c0f\u65f6' AS label, 1 AS sort_order\n    UNION ALL\n    SELECT 61 AS start, 120 AS end, '1-2\u5c0f\u65f6' AS label, 2 AS sort_order\n    UNION ALL\n    SELECT 121 AS start, 180 AS end, '2-3\u5c0f\u65f6' AS label, 3 AS sort_order\n    UNION ALL\n    SELECT 181 AS start, 240 AS end, '3-4\u5c0f\u65f6' AS label, 4 AS sort_order\n    UNION ALL\n    SELECT 241 AS start, 300 AS end, '4-5\u5c0f\u65f6' AS label, 5 AS sort_order\n    UNION ALL\n    SELECT 301 AS start, 360 AS end, '5-6\u5c0f\u65f6' AS label, 6 AS sort_order\n    UNION ALL\n    SELECT 361 AS start, 420 AS end, '6-7\u5c0f\u65f6'AS label ,7 as sort_order \n    UNION ALL \n    SELECT 421 as start ,480 as end,'7-8\u5c0f\u65f6'AS label ,8 as sort_order \n    UNION ALL \n    SELECT 481 as start ,540 as end,'8-9\u5c0f\u65f6'AS label ,9 as sort_order \n    UNION ALL \n    SELECT 541 as start ,600 as end,'9-10\u5c0f\u65f6'AS label ,10 as sort_order \n    UNION ALL \n    SELECT 601 as start ,660 as end,'10-11\u5c0f\u65f6'AS label ,11 as sort_order \n    UNION ALL \n    SELECT 661 as start ,720 as end,'11-12\u5c0f\u65f6'AS label ,12 as sort_order \n    UNION ALL \n    SELECT 721 as start ,780 as end,'12-13\u5c0f\u65f6'AS label ,13 as sort_order \n    UNION ALL \n    SELECT 781 as start ,840 as end,'13-14\u5c0f\u65f6'AS label ,14 as sort_order \n    UNION ALL \n    SELECT 841 as start ,900 as end,'14-15\u5c0f\u65f6'AS label ,15 as sort_order \n    UNION ALL \n    SELECT 901 as start ,960 as end,'15-16\u5c0f\u65f6'AS label ,16 as sort_order \n    UNION ALL \n    SELECT 961 as start ,1020 as end,'16-17\u5c0f\u65f6'AS label ,17 as sort_order \n    UNION ALL \n    SELECT 1021 as start ,1080 as end,'17-18\u5c0f\u65f6'AS label ,18 as sort_order \n    UNION ALL \n    SELECT 1081 as start ,1140 as end,'18-19\u5c0f\u65f6'AS label ,19 as sort_order \n    UNION ALL \n    SELECT 1141 as start ,1200 as end,'19-20\u5c0f\u65f6'AS label ,20 as sort_order \n    UNION ALL \n    SELECT 1201 as start ,1260 as end,'20-21\u5c0f\u65f6'AS label ,21 as sort_order \n    UNION ALL \n    SELECT 1261 as start ,1320 as end,'21-22\u5c0f\u65f6'AS label ,22 as sort_order  \n    UNION ALL  \n    SELECT 1321 as start ,1380 as end,'22-23\u5c0f\u65f6'AS label ,23 as sort_order  \n    UNION ALL  \n    SELECT 1381 as start, 1440 as end,'23-24\u5c0f\u65f6'AS label ,24 as sort_order  \n\t\tUNION ALL  \n\t\tSELECT 1441 as start, null as end,'24\u5c0f\u65f6\u4ee5\u4e0a'AS label ,25 as sort_order \n)\nSELECT\n\tranges.label AS \"\u65f6\u95f4\u533a\u95f4\",\n\tCOUNT ( * ) AS \"\u6570\u91cf\" \nFROM\n\tcharginginfo\n\tJOIN ranges ON parkingduration >= ranges.START \n\tAND ( parkingduration &lt;= ranges.END OR ranges.END IS NULL ) \nWHERE\n\tTO_CHAR( intime, 'YYYY-MM' ) = '2023-06' --\u67e5\u8be2\u6708\u4efd\uff0c\u53ef\u81ea\u884c\u53d8\u66f4\n\tAND parkingtype != 0 --\u6392\u9664\u56fa\u5b9a\u8f66\uff0c\u53ef\u6839\u636e\u73b0\u573a\u5b9e\u9645\u60c5\u51b5\u53d8\u66f4\nGROUP BY\n\tranges.label,\n\tranges.sort_order \nORDER BY\n\tranges.sort_order;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u73b0\u5728\u7684PMS5.0.1\u7248\u672c\u4e2d\uff0c\u5229\u7528SQL\u67e5\u8be2\u6bcf\u4e2a\u6708\u7684\u505c\u8f66\u65f6\u957f\u5206\u5e03\uff0c\u53ef\u5229\u7528\u8be5\u6570\u636e\u5206\u6790\u8f66\u573a\u8fd0\u8425\u60c5\u51b5\uff0c\u9488\u5bf9\u73b0\u6709\u7684\u6536\u8d39\u89c4\u5219\u8fdb\u884c\u8c03\u6574\uff0c\u6700\u5927\u5316\u5b9e\u73b0\u8425\u6536\u4e0e\u4fbf\u6c11\u7684\u5e73\u8861\u3002<\/p>\n","protected":false},"author":1,"featured_media":634,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[49,48],"topic":[],"class_list":["post-792","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-21","tag-pms","tag-48"],"_links":{"self":[{"href":"https:\/\/www.furyblog.com\/index.php?rest_route=\/wp\/v2\/posts\/792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.furyblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.furyblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=792"}],"version-history":[{"count":2,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=\/wp\/v2\/posts\/792\/revisions"}],"predecessor-version":[{"id":794,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=\/wp\/v2\/posts\/792\/revisions\/794"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=\/wp\/v2\/media\/634"}],"wp:attachment":[{"href":"https:\/\/www.furyblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=792"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.furyblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}