키워드 : 협회 일대일 매핑 (한 수업은 한 수업 교사 만 있습니다)
< "getClass"ParameterType = "int"resultmap = "classeResultMap"> select * select * from class c, teacher t에서 c.teacher_id = t.t_id 및 c.c_id =#{id} </select> <resultmap type = "com.lcb.user.classes"id = "classresultMap"> <id id id id " 속성 = "이름"열 = "C_Name"/> <Association Property = "교사"javatype = "com.lcb.user.teacher"> <id property = "id"column = "t_id"/> <result property = "name"column = "t_name"/> </association> </resultmap>키워드 : 일대일 매핑 수집 (한 교사는 여러 학생이 있습니다)
<resultmap type = "교사"id = "j id = "getAllTeacher"ParameterType = "교사"resultMap = "TeacherMaps"> 교사에서 t.id, t.name, t.class_name select> <select> <select id = "getstudents"parametertype = "int"resultType = "student"> select s.id, s. name, s.class_name은 student s의 클래스 이름으로 whise teacher_id = #{id} </select>키워드 : 협회 다중 매핑 (여러 사람이 한 국가에 속함)
다중은 일대일과 동일하며 컬렉션도 사용할 수 있습니다.
<select id = "selectCountry"resultType = "Country"> CID, CID, CNAME SELECT CID =#{OOO} </select> <resultmap type = "people"id = "peoplemapper2"> <id councm = "pid"속성 = "pid"/> <result column = "pname"pname " select = "selectCountry"Column = "CountryID"/> </resultMap> <select id = "selectBeyid2"resultmap = "peoplemapper2"> pid = #{xxx} </select>의 pid, pname, countryid select pid, pname, countryid </select>요약
위의 내용은 편집자가 귀하에게 소개 한 일대일, 일대일 및 다수의 문의입니다. 나는 그것이 당신에게 도움이되기를 바랍니다. 궁금한 점이 있으면 메시지를 남겨 주시면 편집자가 제 시간에 답장을 드리겠습니다. Wulin.com 웹 사이트를 지원해 주셔서 대단히 감사합니다!