In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.