{"id":7274,"date":"2024-11-14T13:45:29","date_gmt":"2024-11-14T05:45:29","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7274\/"},"modified":"2024-11-14T13:45:29","modified_gmt":"2024-11-14T05:45:29","slug":"springboot%e5%a6%82%e4%bd%95%e6%9f%a5%e8%af%a2mysql-date%e5%ad%97%e6%ae%b5%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7274\/","title":{"rendered":"Springboot\u5982\u4f55\u67e5\u8be2MySQL DATE\u5b57\u6bb5\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173067859570747.jpg\" class=\"aligncenter\" title=\"Springboot\u5982\u4f55\u67e5\u8be2MySQL DATE\u5b57\u6bb5\uff1f\u63d2\u56fe\" alt=\"Springboot\u5982\u4f55\u67e5\u8be2MySQL DATE\u5b57\u6bb5\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>springboot\u65e5\u671f\u67e5\u8be2 date\u5b57\u6bb5\u65f6\u7684\u95ee\u9898<\/strong><\/p>\n<p>\u5728\u4f7f\u7528springboot\u67e5\u8be2mysql date\u5b57\u6bb5\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u65e5\u671f\u7c7b\u578b\u4e0d\u5339\u914d\u7684\u95ee\u9898\u3002\u8fd9\u662f\u56e0\u4e3aspringboot\u63a5\u6536\u65f6\u95f4\u65f6\u9ed8\u8ba4\u4e3atimestamp\u7c7b\u578b\uff0c\u800cmysql date\u5b57\u6bb5\u662f\u65e5\u671f\u7c7b\u578b\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\u662f\u5c06\u524d\u7aef\u4f20\u6765\u7684\u65e5\u671f\u5b57\u7b26\u4e32\u76f4\u63a5\u8f6c\u6362\u6210date\u7c7b\u578b\uff0c\u7136\u540e\u4f7f\u7528mybatis-plus\u8fdb\u884c\u67e5\u8be2\u3002\u4ee3\u7801\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre>\/\/ \u540e\u7aef\u53c2\u6570\u63a5\u6536\nprivate Date lessonDate;\n\n\/\/ \u4f7f\u7528MyBatis-Plus\u67e5\u8be2\nwrapper.eq(\"lesson_date\", lessonDate);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u67e5\u8be2mysql date\u5b57\u6bb5\u4e86\u3002<\/p>\n<p><strong>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff1a<\/strong><\/p>\n<ul>\n<li>mysql date\u5b57\u6bb5\u4f7f\u7528yy-mm-dd\u683c\u5f0f\u5b58\u50a8\u3002<\/li>\n<li>springboot\u63a5\u6536\u65f6\u95f4\u5b57\u7b26\u4e32\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7@datetimeformat\u6ce8\u89e3\u6307\u5b9a\u65f6\u95f4\u683c\u5f0f\u3002<\/li>\n<li>mybatis-plus\u4f1a\u81ea\u52a8\u5c06date\u7c7b\u578b\u53c2\u6570\u8f6c\u6362\u6210jdbc\u7c7b\u578b\uff0c\u8fdb\u884c\u67e5\u8be2\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fSpringboot\u5982\u4f55\u67e5\u8be2MySQL DATE\u5b57\u6bb5\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>springboot\u65e5\u671f\u67e5\u8be2 date\u5b57\u6bb5\u65f6\u7684\u95ee\u9898 \u5728\u4f7f\u7528springboot\u67e5\u8be2mysql date\u5b57\u6bb5\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u65e5\u671f\u7c7b\u578b\u4e0d\u5339\u914d\u7684\u95ee\u9898\u3002\u8fd9\u662f\u56e0\u4e3aspringboot\u63a5\u6536\u65f6\u95f4\u65f6\u9ed8\u8ba4\u4e3atimestamp\u7c7b\u578b\uff0c\u800cmysql date\u5b57\u6bb5\u662f\u65e5\u671f\u7c7b\u578b\u3002 \u89e3\u51b3\u65b9\u6848 \u89e3\u51b3\u65b9\u6cd5\u662f\u5c06\u524d\u7aef\u4f20\u6765\u7684\u65e5\u671f\u5b57\u7b26\u4e32\u76f4\u63a5\u8f6c\u6362\u6210date\u7c7b\u578b\uff0c\u7136\u540e\u4f7f\u7528mybatis-plus\u8fdb\u884c\u67e5\u8be2\u3002\u4ee3\u7801\u793a\u4f8b\u5982\u4e0b\uff1a \/\/ \u540e\u7aef\u53c2\u6570\u63a5\u6536 private Date lessonDate; \/\/ \u4f7f\u7528MyBatis-Plus\u67e5\u8be2 wrapper.eq(&#8220;lesson_date&#8221;, lessonDate); \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u67e5\u8be2mysql date\u5b57\u6bb5\u4e86\u3002 \u9700\u8981\u6ce8\u610f\u7684\u662f\uff1a mysql date\u5b57\u6bb5\u4f7f\u7528yy-mm-dd\u683c\u5f0f\u5b58\u50a8\u3002 springboot\u63a5\u6536\u65f6\u95f4\u5b57\u7b26\u4e32\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7@datetimeformat\u6ce8\u89e3\u6307\u5b9a\u65f6\u95f4\u683c\u5f0f\u3002 mybatis-plus\u4f1a\u81ea\u52a8\u5c06date\u7c7b\u578b\u53c2\u6570\u8f6c\u6362\u6210jdbc\u7c7b\u578b\uff0c\u8fdb\u884c\u67e5\u8be2\u3002 \u4ee5\u4e0a\u5c31\u662fSpringboot\u5982\u4f55\u67e5\u8be2MySQL DATE\u5b57\u6bb5\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-7274","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7274","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=7274"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7274\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}