In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to generate sorting statements automatically by mybatis example". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Mybatis example automatically generates code sort statements UserExample ue= new UserExample (); String classLevel = "1"; ue.createCriteria (). AndUserIdEqualTo (classLevel); / / ts is the timestamp ue.setOrderByClause ("ts desc"); List uList = userMapper.selectByExample (ne); example usage of mybatis automatic generation
Example is used to add conditions, which is equivalent to the part after where.
SelectByExample can solve almost all queries.
For example, Example example = new Example (); Example.Criteria criteria = example.createCriteria (); criteria.andStatusEqualTo (1); List list = this.skuMapper.selectByExample (example); list.get (0) is all the data needed for the object query table
SelectByExample (example) returns all the data in the table if it doesn't write the example condition: if it doesn't write example.createCriteria ().
Method description / / 1. Add ascending sort condition, DESC is descending example.setOrderByClause ("field name ASC") / / 2. Remove repetition, boolean type, true to select non-duplicate records example.setDistinct (false) / / 3. Add the condition criteria.andXxxIsNull// 4. 0 where the field xxx is null. Add the condition criteria.andXxxIsNotNull// 5. 0 that field xxx is not null. Add the xxx field equal to the value condition criteria.andXxxEqualTo (value) / / 6. Adding xxx field is not equal to value condition criteria.andXxxNotEqualTo (value) / / 7. Add xxx field greater than value condition criteria.andXxxGreaterThan (value) / / 8. Add xxx field greater than or equal to value condition criteria.andXxxGreaterThanOrEqualTo (value) / / 9. Add xxx field less than value condition criteria.andXxxLessThan (value) / / 10. Add xxx field less than or equal to value condition criteria.andXxxLessThanOrEqualTo (value) / / 11. Add the xxx field value in Listcriteria.andXxxIn (List) / / 12. Do not add xxx field values in Listcriteria.andXxxNotIn (List) / / 13. Add xxx field values between criteria.andXxxBetween (value1,value2) / / 14. Add xxx field value is not between criteria.andXxxNotBetween (value1,value2) "how to automatically generate mybatis example sort statement" content here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.