美文网首页Mybatis
mybatis递归查询

mybatis递归查询

作者: 丶君为红颜酔 | 来源:发表于2018-09-14 14:33 被阅读0次

    https://blog.csdn.net/janet796/article/details/79500349

    <resultMap id="getSelf" type="net.chunxiao.vo.GoodsCategoryVo">
            <id column="goodscateid" property="goodscateid"></id>
            <result column="name" property="name"></result>
            <collection property="catelist" select="getCategory" column="goodscateid"></collection>
            <!--查到的cid作为下次的pid-->
        </resultMap>
     
        <select id="getCategory" resultMap="getSelf">
            select * from goods_category where status=0 AND parentid=#{pid}
            ORDER BY displayorder,goodscateid
        </select>
    
    public class GoodsCategoryVo {
        private Integer goodscateid;
        private String name;
        private Integer parentid;
        private String description;
        private Integer displayorder;
        private Double commissionrate;
        private Integer enabled;
        private List<GoodsCategoryVo> catelist;
    ……
    
    

    相关文章

      网友评论

        本文标题:mybatis递归查询

        本文链接:https://www.haomeiwen.com/subject/jkeogftx.html