当前位置 博文首页 > 文章内容

    mybatis中resultmap

    作者: 栏目:未分类 时间:2020-09-23 14:00:19

    本站于2023年9月4日。收到“大连君*****咨询有限公司”通知
    说我们IIS7站长博客,有一篇博文用了他们的图片。
    要求我们给他们一张图片6000元。要不然法院告我们

    为避免不必要的麻烦,IIS7站长博客,全站内容图片下架、并积极应诉
    博文内容全部不再显示,请需要相关资讯的站长朋友到必应搜索。谢谢!

    另祝:版权碰瓷诈骗团伙,早日弃暗投明。

    相关新闻:借版权之名、行诈骗之实,周某因犯诈骗罪被判处有期徒刑十一年六个月

    叹!百花齐放的时代,渐行渐远!



        <resultMap id="myMap" type="com.student.demo.domain.Student">
            <id property="id1" column="id"/>
            <result property="names" column="name"/>
            <result property="grades" column="grade"/>
            <collection property="list" ofType="com.student.demo.domain.StudentDetail">
                <id property="id" column="id2"/>
                <result property="address" column="address"/>
                <result property="student_id" column="student_id"/>
                <result property="fathers_name" column="fathers_name"/>
                <result property="mathers_name" column="mathers_name"/>
                <result property="phone_number" column="phone_number"/>
            </collection>
        </resultMap>
    
        <select id="selectAll" resultMap="myMap">
        SELECT
        s.id,
        s.name,
        s.grade,
        sd.id id2,
        sd.address,
        sd.student_id,
        sd.fathers_name,
        sd.mathers_name,
        sd.phone_number
    FROM
        student s,students_detail sd where s.id=sd.student_id
    </select>

     

     文件下载在->

     

    文件中包括数据库结构,下载地址在【文件中】student压缩包