1 <?xml version="1.0" encoding="UTF-8" ?> 2 <!DOCTYPE mapper 3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 5 <mapper namespace="com.mapper.StudentMapper"> 6 <cache/> 7 8 <select id="selAll" resultType="Student"> 9 select s.id, s.name, s.age, s.gender, s.cid, c.id `clazz.id`, c.name `clazz.name`, c.room `clazz.room` 10 from t_student s 11 left join t_class c 12 on s.cid=c.id 13 </select> 14 </mapper>