In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Common functions of 1.Example
In the reverse engineering of mybatis, the instance and the corresponding example,example of the instance are generated to add conditions, which is equivalent to the following part of where.
Example example = new Example (entity class .class)
Example.createCriteria (). Add condition
Common functions are as follows:
(1) example.setDistinct (false): remove duplicates, boolean type, true means to select records that are not duplicated.
(2) example.setOrderByClause ("field name ASC"): add ascending sort condition, and DESC is descending order.
(3) example.createCriteria () .andEqualTo ("xxx field", value): add the condition that the xxx field is equal to value.
(4) example.createCriteria () .andNotEqualTo ("xxx field", value): add a condition that the xxx field is not equal to value.
(5) example.createCriteria () .andCreaterThan ("xxx field", value): add a condition that the xxx field is greater than value.
(6) example.createCriteria () .andLessThan ("xxx field", value): add a condition that the xxx field name is less than value.
(7) example.createCriteria () .andLessThanOrEqualTo ("xxx field", value): add a condition that the field name is less than or equal to value.
(8) example.createCriteria () .andIn (List): add a condition for the field value in the List.
(9) example.createCriteria () .andNotIn (List): add a condition that the field value is not in the List.
(10) example.createCriteria () .andLike ("xxx field", "%" + value+ "%"): add a fuzzy query with the value of the xxx field value.
(11) example.createCriteria () .andNotLike ("xxx field", "%" + value+ "%"): add a fuzzy query whose xxx field value is not value.
(12) example.createCriteria (). AndBetween ("value1,value2): add a condition for the value of the xxx field between value1 and value2.
(13) example.createCriteria () .andNotBetween ("value1,value2): add a condition that the value of the xxx field is not between value1 and value2.
(14) example.createCriteria () .andIsNull ("xxx field", value): add a condition where the value of the xxx field is null.
(15) example.createCriteria () .andIsNotNull ("xxx field", value): add a condition whose xxx field value is not null.
2.Mapper common interface
(1) int countByExample (example): count by condition.
(2) int updateByExample (entity class, example): update according to conditions.
(3) int updateByExampleSelective (entity class, example): update the field of the part null according to the condition.
(4) int updateByPrimaryKey (entity class): press the primary key to update.
(5) int countByPrimaryKeySelective (entity class): press the primary key to update fields that are not null.
(6) int deleteByPrimaryKey (id): press the primary key to delete.
(7) int deleteByExample (example): delete according to conditions.
(8) String/Integer insert (entity class): insert data (return value is id).
(9) return value type selectByPrimaryKey (id): query by primary key.
(10) return value type selectByExample (example): query by condition.
(11) int selectByExampleWithBLOGS (example): query fields (including BLOB) by condition. Occurs only if the field type in the data table is binary.
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.