码迷,mamicode.com
首页 > 其他好文 > 详细

关联查询之map的延伸用法

时间:2015-06-08 13:30:16      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:map      

<select id="front.sort.selectListall" parameterType="myshop.services.front.sort.bean.sort" resultMap="sortResultMap">
    select one.*,tw.id sid,tw.catlevel slevel,tw.name sname,tw.code scode,thr.id
    tid,thr.catlevel tlevel,thr.name as tname, thr.code as tcode 
    from tb_sort
    one join tb_sort tw on tw.pid=one.id join tb_sort thr on thr.pid=tw.id
    order by one.order1,tw.order1,thr.order1
</select>
<resultMap id="sortResultMap" type="myshop.services.front.sort.bean.Sort">
    <id property="id" column="id" />
    <result property="catlevel" column="catlevel" />
    <result property="code" column="code" />
    <result property="name" column="name" />
    <collection property="children" ofType="myshop.services.front.sort.bean.Sort">
        <id property="id" column="sid" />
        <id property="catlevel" column="slevel" />
        <id property="code" column="scode" />
        <id property="name" column="sname" />
        <collection property="children" ofType="myshop.services.front.sort.bean.Sort">
            <id property="id" column="tid" />
            <id property="catlevel" column="tlevel" />
            <id property="name" column="tname" />
            <id property="code" column="tcode" />
        </collection>
    </collection>
</resultMap>


实体类接收数据:

private List<Sort> children;


关联查询之map的延伸用法

标签:map      

原文地址:http://blog.csdn.net/baidu_25310663/article/details/46410545

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!