关联查询之map的延伸用法

来源:互联网 发布:企业网络管理软件 编辑:程序博客网 时间:2024/06/14 03:50
<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;


0 0
原创粉丝点击