In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to specify fuzzy query in mybatis-plus". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "mybatis-plus how to specify field fuzzy query" bar!
Mybatis-plus version: 3.3.0
Oracle version: 11g
A very common demand scenario: when a table is displayed at the front end, the name field often needs a fuzzy query in the query condition, otherwise the default mybatis-plus is a full-character matching query. How to minimize the modification of the code to achieve a fuzzy query of a field, in fact, the official mybatis-plus documentation gives the answer:
With the @ TableField annotated condition property, you can configure a field, always use fuzzy matching, and open the condition class to see what options are available:
There are five options, and the default is the first one: EQUAL.
Next, modify your own code:
However, an error will be reported when the database is oracle, and the printed SQL is as follows:
SELECT COUNT (1) FROM TEST_TABLE WHERE TITLE LIKE CONCAT ('%', 'laser','%')
An error occurred because the CONCAT function of oracle does not support concatenation of more than 2 parameters. So define an annotation class yourself, and the @ TableField annotation remains the same
Just note that the SqlCondition class introduced is your own newly defined class, or to avoid confusion, you might as well change your name to SqlCondition, as follows:
At this point, I believe you have a deeper understanding of "mybatis-plus how to specify field fuzzy query", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.