the input and output mappings complete the input mappings through ParameterType, and the output mappings are done through Resulttype and Resultmap. 1. 1parameterType Pass Pojo Wrapper object can define the contents of the Pojo wrapper type extension Mapper interface input parameters. Requirements: Custom query criteria Query user information, you need to enter query criteria to statement, query criteria can have user information, commodity information .... 1.1.1 Package Type
1.1.1mapper.xml
1.1.1mapper.java interface
Test
exception if parametertype specified property error, exception, getter method not found: org.apache.ibatis.exceptions.PersistenceException: # # # Error querying Database. for property named ' Usercusto ' in ' Class Cn.itcast.mybatis.po.UserQueryVo ' for property Named ' Usercusto ' in ' Class Cn.itcast.mybatis.po.UserQueryVo ' Note: If future integration with spring is not done by calling the Getter method to get the property value, The Pojo property value is read strongly by reflection.
1. 1resultType Specifies the type of output result (Pojo, simple Type, hashmap). ) to map SQL query results to Java objects. 1.1. 1 return Simple Type Mapper.xml
Mapper.java
Note If the query records the result set as a record and a column is reused, the return simple type is returned.
MYBATIS12 Usermapper.xml