1.建立实体类和数据库映射
@Select("select * from user")
@Results(id = "resultMap",value = {
@Result(id = true,property = "userId",column ="id"),
@Result(property = "userName",column ="username"),
@Result(property = "userSex",column ="sex"),
@Result(property = "userAddress",column ="address"),
})
List<User> findAll();
2.其他mapper对其进行引用
@Select("select * from user where id=#{id}")
@ResultMap(value={"resultMap"})
User getUserById(Integer id);