根据下面的配置信息,写出Classes,Teacher和Student这三个POJO的全部代码。<mapper namespace="com.lcb.mapping.userMapper"> <l--association—对—关联查询--> <select id="getClass" parameterType="int" resultMap="ClassesResultMap">select * from class c,teacher t where c.teacher_id=t.t_id and c.c_id=#{id} </select> <resultMap type="com.lcb.user.Classes" id="ClassesResultMap"><l--实体类的字段名和数据表的字段名映射--> <id property="id" column="c_id"/> <result property="name" column="c_name"/><association property="teacher" javaType="com.Icb.user.Teacher"><id property="id" column="t_id" l> <result property="name" column="t_name"/></association> </resultMap> <l--collection—对多关联查询--> <select id="getClass2" parameterType="int"resultMap="ClassesResultMap2"> select * from class c,teacher t,student s where c.teacher_id=t.t_idand c.c_id=s.class_id and c.c_id=#{ id} </select> <resultMap type="com.lcb.user.Classes" id="ClassesResultMap2"><id property=""id" column="c_id"/> <result property="name" column="c_name"/><association property="teacher" javaType="com.Icb.user.Teacher"><id property="id" column="t_id"l> <result property="name" column="t_name"/></association> <collection property="student" ofType="com.Icb.user.Student"><id property="id" column="s_id"/> cresult property="name" column="s_name"/></collection> </resultMap></mapper>
时间: 2023-06-02 14:04:38 浏览: 112
图书管理系统的开发毕业论文.doc
Classes POJO代码:
public class Classes {
private int c_id;
private String c_name;
private int teacher_id;
private Teacher teacher;
public int getC_id() {
return c_id;
}
public void setC_id(int c_id) {
this.c_id = c_id;
}
public String getC_name() {
return c_name;
}
public void setC_name(String c_name) {
this.c_name = c_name;
}
public int getTeacher_id() {
return teacher_id;
}
public void setTeacher_id(int teacher_id) {
this.teacher_id = teacher_id;
}
public Teacher getTeacher() {
return teacher;
}
public void setTeacher(Teacher teacher) {
this.teacher = teacher;
}
}
Teacher POJO代码:
public class Teacher {
private int t_id;
private String t_name;
private int age;
public int getT_id() {
return t_id;
}
public void setT_id(int t_id) {
this.t_id = t_id;
}
public String getT_name() {
return t_name;
}
public void setT_name(String t_name) {
this.t_name = t_name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
Student POJO代码:
无相关信息,无法完成代码编写。
阅读全文