First, the development of norms
You need to write the Mapper.xml mapping file (this project is usermapper.xml, similar to the previous user.xml).
Writing mapper interfaces requires following some development specifications, so that MyBatis can automatically generate mapper interfaces to implement proxy objects.
1. Namespace equals Mapper interface address in Usermapper
namespace in "Usermapper.xml":
The ID of the statement in the 2.UserMapper interface is the same as that of the method name in Usermapper.xml
"Usermapper.java"
"Usermapper.xml"
The method input parameter type in the 3.usermapper.java interface is the same as the ParameterType specified type in Usermapper.xml. Statement.
"Usermapper.java"
"Usermapper.xml"
The return value type of the method in the 4.usermapper.java interface is consistent with the Resulttype specified by the statement in the Usermapper.xml
"Usermapper.java"
"Usermapper.xml"
"The important role of the above development norms"
The development specification will produce a unified build of the code:
.........
09_mybatis development of DAO Method--mapper Agent Development specification