码迷,mamicode.com
首页 > Web开发 > 详细

常用的分类json格式

时间:2021-06-24 17:37:47      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:dom   cheng   enc   parent   property   framework   lazy   英语音标   node   

{
    "category":[
            "id":"1",
            "isleaf":"0",
            "isshow":"1",
            "label":"根结点",
            "name":"根结点",
            "orderby":1,
            "parentid":"0",
            "children":[
                {
                    "id":"1-1",
                    "isleaf":"0",
                    "isshow":"1",
                    "label":"零基础",
                    "name":"零基础",
                    "orderby":1,
                    "parentid":"1",
                    "children":[
                        {
                                "id":"1-1-1",
                                "isleaf":"1",
                                "isshow":"1",
                                "label":"英语音标",
                                "name":"英语音标",
                                "orderby":1,
                                "parentid":"1-1"
                         },
					],
                },
            ],
        }
    ]
}

技术图片

自查询

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xuecheng.course.mapper.CategoryMapper">
    <resultMap type="com.xuecheng.framework.domain.course.ext.CategoryNode" id="CategoryMap" >
    <id property="id" column="one_id"/>
    <result property="name" column="one_name"/>
    <collection property="children"
                ofType="com.xuecheng.framework.domain.course.ext.CategoryNode">
        <id property="id" column="two_id"/>
        <result property="name" column="two_name"/>
        <collection property="children"
                    ofType="com.xuecheng.framework.domain.course.ext.CategoryNode">
            <id property="id" column="three_id"/>
            <result property="name" column="three_name"/>
        </collection>
    </collection>
    </resultMap>


    <select id="findCategoryList"  resultMap="CategoryMap">
        SELECT a.id one_id,
               a.name one_name ,
               b.id two_id,
               b.name two_name,
               c.id three_id,
               c.name three_name
        from
            category a
                LEFT JOIN
            category b
            on
                a.id=b.parentid
                LEFT JOIN
            category c
            on
                b.id=c.parentid
        where
            a.parentid=0
    </select>
</mapper>

常用的分类json格式

标签:dom   cheng   enc   parent   property   framework   lazy   英语音标   node   

原文地址:https://www.cnblogs.com/sehnen/p/14923986.html

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