General mapper summary

Query a user with selectOne() via a unique attribute (name or the like) Query multiple methods with select() Query the number with selectCount() Pass in null in the selectCount(null) method if you want to query all users. Query by the primary key selectByPrimaryKey() Be sure to set the primary key in the bean with @id

user registration generally use insert() How many fields are placed when the user registers? insertSelective() Try to use this (The meaning of the role of seletvice is a valued attribute)

delete Delete There are multiple attributes in the object as parameters. sql statement will be deleted according to these conditions. deleteByPrimaryKey() When you delete the database part data by deleting the

updateByPrimaryKey with the primary key, other data will become empty. updateByPrimaryKeySelective This method will only modify part of the data to be changed in the database part of the data. Other data will not move (used in development)

selectByExample() method First build a case template New Example(User.class); Build a query condition New Example().createCriteria();

1.General mapper dependency Tk.mybatis 2. Use The mapper interface inherits the generic mapper 3. Entity class field     1. The table name defaults to the class name, and the hump is underlined.     2. The table name can be specified using @Table(name=”...”), which is specified in this way for non-compliance with the first rule.     3. The default field is the same as @Column, and will be used as a table field. The table field defaults to the attribute name of the java object. The hump is underlined.     4. You can use @Column(name=”...”) to specify field names that do not comply with the third rule.     5. Use the @Transient annotation to ignore the field, and add the annotation's field will not be used as a table field.     6. It is recommended that there must be a @Id annotation as the primary key field, and there can be multiple @Id annotated fields as the union primary key.     7. By default, if there is no @Id annotation field in the entity class, all fields will be used as primary key fields (inefficient)     8. Entity classes can be inherited     9. It is recommended not to use the basic type in the entity class, because the basic type has a default value

4. Part of the method     1.selectone: will take the non-empty property in the received object as the query condition, return an object that matches, and the relationship between multiple query conditions is and relationship. If the result of the query is more than one, an exception will be thrown. will use the non-empty property in the object as the query condition, return the List collection of multiple users matching, And relationship, if you want to query all, you can pass in null     3.selectCount: Query the total number of pieces of information according to the condition, and also receive the object as the query condition, and return the total number of pieces.     4.selectByPrimaryKey: According to the primary key query, refers to the field with the @Id annotation added to the bean.     5.insert: add a piece of data, insert the received object into the database, regardless of whether the field is null     6.insertSelective: add a piece of data, only insert non-null fields, receive objects     7.delete: delete according to the condition, receive an object, and use the non-empty field of the object as a condition     8.deleteByPrimaryKey: delete according to the primary key     9.updateByPrimaryKeySelective: Receive an object with the primary key id as the modified condition, and the non-null field attribute of the object will be modified

Special conditional query can be implemented by the Example class
Create an Example object and make the class object of the entity class to be manipulated
Create a conditional query object, you can use and relationship, or relationship, or implement sort