mybatis 不同Mapper文件引用resultMap

时间:2025-01-27 08:49:15
<resultMap type="Classes" id="classesMap"> <id property="id" column="c_id" javaType="int"/> <result property="name" column="c_name" javaType="String"/> <!-- <association property="teacher" javaType="Teacher" > <id property="id" column="t_id" javaType="int"/> <result property="name" column="t_name" javaType="String"/> <result property="age" column="t_age" javaType="int"/> </association> --> <association property="teacher" javaType="Teacher" resultMap="" ></association> <collection property="studentList" ofType="Student" resultMap="" ></collection> </resultMap> <sql id="selectAllClassesSql"> SELECT c.id as c_id,c.name as c_name,teacher_id, t.id as t_id,t.name as t_name, as t_age, s.id as stu_id,s.name as stu_name,s.classes_id from classes c,teacher t,student s </sql>