The query all return type needs to be a collection (list<>) or a class, because the query returns more than one data
List<> the add behind the collection. () Place the object, today innocently put in list = = Of course the error
The mapping of entities in MyBatis writes basic additions and deletions to the check operation. Note: When you need to query all you also need to write yourself in the map
Controller is written in the argument and returns the page
When using MyBatis, Mapper.java and Mapper.xml (his mapping), the ID of the SQL in the map must be the same as the name of the corresponding interface in Java. otherwise, it cannot be manipulated.
Note @requestmapping is a note used to process request address mappings, which can be used on classes or methods. Used on a class, the method that represents all the response requests in the class is the address as the parent path.
@RequestMapping has six properties
①value: Specifies the actual address of the request, and the specified address can be the URI Template mode (described later);
②method: Specifies the method type of the request, get, POST, put, delete, etc.
③consumes: Specifies the submitted content type (CONTENT-TYPE) of the processing request, such as Application/json, text/html;
④produces: Specifies the type of content returned, which is returned only if the specified type is included in the (Accept) type in the request header;
⑤params: Specifies that the request must contain certain parameter values to be processed by the method.
⑥headers: Specifies that some specified header value must be included in the request in order for the method to process the request.
And generatorconfig.xml This file this is the MyBatis of this framework generation (baby also do not know what good = =) mapping file of a gray often important thing
Use it to set up a directory of generated files (that is, the DAO interface that needs to be generated, the SQL entity, and the mapping that corresponds to them), and of course it can only generate a simple, slightly more complex mapper or it needs to be tapped by its own claws.
Today just opened my cabin, welcome you a lot of guests (na pastry is not [hum are my only reluctant to eat for you]), tea water pipe full O (∩_∩) o
For their own understanding, if there is a mistake please correct me (don't scold AH), small rookie began weaning. AW whining