Example Mybatis of commonly used functions and common interfaces Mapper

1.Example common function
        of reverse engineering mybatis will be generated in the corresponding Examples and Examples example, addition conditions for example, corresponding to the back part where.
        Example example = new Example (entity class .class);
        example.createCriteria () to add conditions
        common functions as follows:
        (. 1) example.setDistinct (to false) : deduplication, boolean type, true record indicating the selection does not overlap.
        (2) example.setOrderByClause ( "field name the ASC") : Add condition in ascending order, DESC descending.
        (. 3) . Example.createCriteria () andEqualTo ( "xxx field", value) : value equal to add xxx field conditions.
        (. 4) . Example.createCriteria () andNotEqualTo ( "xxx field", value) : is not equal to value added xxx field conditions.
        (. 5) example.createCriteria () andCreaterThan ( "xxx field", value). : Xxx addition condition field is greater than the value.
        (6). example.createCriteria () andLessThan ( "xxx field", value) : xxx addition condition field name value of less than.
        (. 7) . Example.createCriteria () andLessThanOrEqualTo ( "XXX field", value) : Add field name value less condition.
        (8) example.createCriteria () Andin (List <?>). : Add field values in the List of Conditions <?>.
        (9) example.createCriteria () andNotIn (List <?>). : Adding value is not in the field conditions List <?>.
        (10) . Example.createCriteria () andLike ( "xxx field", "%" + value + "%") : Add fuzzy query xxx field value is value.
        (11) . Example.createCriteria () andNotLike ( "xxx field", "%" + value + "%") : xxx field value is not added value of fuzzy query.
        (12) example.createCriteria (). AndBetween ( " value1, value2) : xxx addition condition field values value1 and value2 between the.
        (13)example.createCriteria () andNotBetween (. "value1, value2) : xxx addition condition field value is not between value1 and value2.
        (14) example.createCriteria () andIsNull. (" xxx field ", value) : Field value added xxx a null condition.
        (15) example.createCriteria () andIsNotNull ( "xxx field", value). : adding xxx field value is not null condition.
2.Mapper common Interface
        (. 1) int countByExample (Example) : conditional counts.
        (2) int updateByExample (entity class, Example) : updated conditional.
        (. 3) int updateByExampleSelective (entity class, Example) : conditional update portion null field.
        (. 4) int updateByPrimaryKey (entity classes) : by the primary key update.
        (. 5) int countByPrimaryKeySelective (entity classes) : update the primary key field is not null.
        (6) int deleteByPrimaryKey (the above mentioned id) : by the primary key to delete.
        (7) int deleteByExample (Example) : delete conditional.
        (. 8) String / Integer INSERT (entity classes) : inserting data (return value id).
        (9) return type selectByPrimaryKey (ID) : the query by the primary key.
        (10) Return Value Type selectByExample (Example) : conditional queries.
        (11) int selectByExampleWithBLOGS (Example) : query by the conditions (including BLOB) fields. Only when the field type data in the table will produce a binary promising.

Guess you like

Origin blog.51cto.com/13678728/2430491