{"id":7437,"date":"2024-11-14T08:31:41","date_gmt":"2024-11-14T00:31:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7437\/"},"modified":"2024-11-14T08:31:41","modified_gmt":"2024-11-14T00:31:41","slug":"mybatis-plus-%e4%b8%ad%e5%a6%82%e4%bd%95%e7%b2%be%e5%87%86%e5%8c%b9%e9%85%8d%e7%ba%af%e6%95%b0%e7%bb%84%e5%92%8c%e5%af%b9%e8%b1%a1%e6%95%b0%e7%bb%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7437\/","title":{"rendered":"Mybatis Plus \u4e2d\u5982\u4f55\u7cbe\u51c6\u5339\u914d\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173085466686469.jpg\" class=\"aligncenter\" title=\"Mybatis Plus \u4e2d\u5982\u4f55\u7cbe\u51c6\u5339\u914d\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4\uff1f\u63d2\u56fe\" alt=\"Mybatis Plus \u4e2d\u5982\u4f55\u7cbe\u51c6\u5339\u914d\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>mybatis plus\u7cbe\u51c6\u5339\u914d\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4<\/strong><\/p>\n<p>\u5728 mybatis plus \u4e2d\uff0c\u5339\u914d\u6570\u7ec4\u9700\u8981\u8003\u8651\u6570\u7ec4\u7684\u7c7b\u578b\uff0c\u5206\u4e3a\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4\u3002<\/p>\n<p><strong>\u7eaf\u6570\u7ec4<\/strong><\/p>\n<p>\u7eaf\u6570\u7ec4\u662f\u6307\u5143\u7d20\u7c7b\u578b\u4e3a\u57fa\u672c\u7c7b\u578b\uff08\u5982 int\u3001float\uff09\u7684\u6570\u7ec4\u3002\u5bf9\u4e8e\u7eaf\u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528 like \u65b9\u6cd5\u8fdb\u884c\u5339\u914d\uff0c\u4f46\u662f\u9700\u8981\u6ce8\u610f\u6f5c\u5728\u7684\u4e0d\u7cbe\u786e\u5339\u914d\u95ee\u9898\u3002\u63a8\u8350\u4f7f\u7528\u6570\u636e\u5e93\u539f\u751f json \u652f\u6301\u51fd\u6570\u8fdb\u884c\u7cbe\u786e\u5339\u914d\u3002\u4f8b\u5982\uff0c\u5728  \u4e2d\u53ef\u4ee5\u4f7f\u7528 json_contns \u51fd\u6570\uff1a<\/p>\n<pre>string tipid = \"1617784249885577217\";\nwrapper.and(new consumer&lt;querywrapper&lt;object&gt;&gt;() {\n    @override\n    public void accept(querywrapper&lt;object&gt; querywrapper) {\n        querywrapper.last(\"json_contains(goods_tips_id_list,'\" + tipid + \"')\");\n    }\n});<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5bf9\u8c61\u6570\u7ec4<\/strong><\/p>\n<p>\u5bf9\u8c61\u6570\u7ec4\u662f\u6307\u5143\u7d20\u7c7b\u578b\u4e3a\u5bf9\u8c61\u7684\u6570\u7ec4\u3002\u5bf9\u4e8e\u5bf9\u8c61\u6570\u7ec4\uff0c\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528 like \u65b9\u6cd5\u8fdb\u884c\u5339\u914d\u3002\u9700\u8981\u6839\u636e\u5bf9\u8c61\u5c5e\u6027\u8fdb\u884c\u5355\u72ec\u5339\u914d\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>List&lt;Long&gt; tipIdList = new ArrayList&lt;&gt;();\ntipIdList.add(1617784249885577217L);\ntipIdList.add(1615226392250040321L);\nwrapper.in(\"goods_tips_id_list\", tipIdList);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMybatis Plus \u4e2d\u5982\u4f55\u7cbe\u51c6\u5339\u914d\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4\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>mybatis plus\u7cbe\u51c6\u5339\u914d\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4 \u5728 mybatis plus \u4e2d\uff0c\u5339\u914d\u6570\u7ec4\u9700\u8981\u8003\u8651\u6570\u7ec4\u7684\u7c7b\u578b\uff0c\u5206\u4e3a\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4\u3002 \u7eaf\u6570\u7ec4 \u7eaf\u6570\u7ec4\u662f\u6307\u5143\u7d20\u7c7b\u578b\u4e3a\u57fa\u672c\u7c7b\u578b\uff08\u5982 int\u3001float\uff09\u7684\u6570\u7ec4\u3002\u5bf9\u4e8e\u7eaf\u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528 like \u65b9\u6cd5\u8fdb\u884c\u5339\u914d\uff0c\u4f46\u662f\u9700\u8981\u6ce8\u610f\u6f5c\u5728\u7684\u4e0d\u7cbe\u786e\u5339\u914d\u95ee\u9898\u3002\u63a8\u8350\u4f7f\u7528\u6570\u636e\u5e93\u539f\u751f json \u652f\u6301\u51fd\u6570\u8fdb\u884c\u7cbe\u786e\u5339\u914d\u3002\u4f8b\u5982\uff0c\u5728 \u4e2d\u53ef\u4ee5\u4f7f\u7528 json_contns \u51fd\u6570\uff1a string tipid = &#8220;1617784249885577217&#8221;; wrapper.and(new consumer&lt;querywrapper&lt;object&gt;&gt;() { @override public void accept(querywrapper&lt;object&gt; querywrapper) { querywrapper.last(&#8220;json_contains(goods_tips_id_list,'&#8221; + tipid + &#8220;&#8216;)&#8221;); } }); \u767b\u5f55\u540e\u590d\u5236 \u5bf9\u8c61\u6570\u7ec4 \u5bf9\u8c61\u6570\u7ec4\u662f\u6307\u5143\u7d20\u7c7b\u578b\u4e3a\u5bf9\u8c61\u7684\u6570\u7ec4\u3002\u5bf9\u4e8e\u5bf9\u8c61\u6570\u7ec4\uff0c\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528 like \u65b9\u6cd5\u8fdb\u884c\u5339\u914d\u3002\u9700\u8981\u6839\u636e\u5bf9\u8c61\u5c5e\u6027\u8fdb\u884c\u5355\u72ec\u5339\u914d\u3002\u4f8b\u5982\uff1a List&lt;Long&gt; tipIdList = new ArrayList&lt;&gt;(); tipIdList.add(1617784249885577217L); tipIdList.add(1615226392250040321L); wrapper.in(&#8220;goods_tips_id_list&#8221;, tipIdList); \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662fMybatis Plus \u4e2d\u5982\u4f55\u7cbe\u51c6\u5339\u914d\u7eaf\u6570\u7ec4\u548c\u5bf9\u8c61\u6570\u7ec4\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-7437","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7437","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=7437"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7437\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}