当前位置: 首页 > news >正文

多用户商城源码下载147seo采集工具

多用户商城源码下载,147seo采集工具,企业电话认证,珠海网站建设网络推广需求 得到树结构数据也可以用lambda表达式也行,也可以直接循环递归也行,本文采用的是直接在Mybatis层得到结果,各有各的优势。 代码 1、实体类 Data public class CourseChapterVO implements Serializable {private static final long s…

需求

得到树结构数据也可以用lambda表达式也行,也可以直接循环递归也行,本文采用的是直接在Mybatis层得到结果,各有各的优势。

代码

1、实体类

@Data
public class CourseChapterVO implements Serializable {private static final long serialVersionUID = -67718827554034368L;/*** 主键ID*/private Integer id;/*** 课程ID*/private Integer courseId;/*** 课程章节名称*/private String chapterName;/*** 父ID*/private Integer chapterParent;/*** 层级*/private Integer chapterLevel;@JsonInclude(JsonInclude.Include.NON_EMPTY)  //当children为空时不返回    private List<CourseChapterVO> children;}

2、mapper.xml

<resultMap type="com.ruoyi.manager.vo.CourseChapterVO" id="CourseChapterMap2"><result property="id" column="id" jdbcType="INTEGER"/><result property="courseId" column="course_id" jdbcType="INTEGER"/><result property="chapterName" column="chapter_name" jdbcType="VARCHAR"/><result property="chapterParent" column="chapter_parent" jdbcType="INTEGER"/><result property="chapterLevel" column="chapter_level" jdbcType="INTEGER"/><collection property="children" ofType="com.ruoyi.manager.vo.CourseChapterVO" column="id" select="selectListTree2"/></resultMap><select id="selectListTree1" resultMap="CourseChapterMap2">select id , course_id, chapter_name, chapter_parent, chapter_levelfrom course_chapter where chapter_parent =0 </select><select id="selectListTree2" resultMap="CourseChapterMap2">select id , course_id, chapter_name, chapter_parent, chapter_level from course_chapter where chapter_parent =#{id}</select>

3、mapper.java

List<CourseChapterVO> selectListTree1(CourseChapter courseChapter);

4、serviceImpl.java

 @Overridepublic List<CourseChapterVO> queryAll(CourseChapter courseChapter) {return this.courseChapterMapper.selectListTree1(courseChapter);}

5、service.java

List<CourseChapterVO> queryAll(CourseChapter courseChapter);

6、controller.java

 @GetMapping("list")public R queryAll(CourseChapter courseChapter) {return R.data(this.courseChapterService.queryAll(courseChapter));}

7、实现效果

{"msg": "","code": 0,"data": [{"id": 1,"courseId": 5,"chapterName": "第一章节学习","chapterParent": 0,"chapterLevel": 1,"children": [{"id": 2,"courseId": 5,"chapterName": "第一章节学习子1","chapterParent": 1,"chapterLevel": 2},{"id": 3,"courseId": 5,"chapterName": "第一章节学习子2","chapterParent": 1,"chapterLevel": 2},{"id": 4,"courseId": 5,"chapterName": "第一章节学习子3","chapterParent": 1,"chapterLevel": 2}]},{"id": 5,"courseId": 5,"chapterName": "第二章节学习","chapterParent": 0,"chapterLevel": 1,"children": [{"id": 6,"courseId": 5,"chapterName": "第二章节学习子","chapterParent": 5,"chapterLevel": 2,"children": [{"id": 9,"courseId": 5,"chapterName": "第二章节学习子1子1","chapterParent": 6,"chapterLevel": 3}]},{"id": 7,"courseId": 5,"chapterName": "第二章节学习子1","chapterParent": 5,"chapterLevel": 2},{"id": 8,"courseId": 5,"chapterName": "第二章节学习子2","chapterParent": 5,"chapterLevel": 2}]},{"id": 10,"courseId": 5,"chapterName": "第三章节学习gfdgdf","chapterParent": 0,"chapterLevel": 1}]
}
http://www.yayakq.cn/news/886066/

相关文章:

  • 做网站简单做百度移动网站点击软
  • 设计一套企业网站多少钱免费网站制作
  • 宾利棋牌在哪个网站做的广告wordpress+整合js
  • 南京做网站南京乐识权威WordPress不显示缓存头像
  • 昆明哪有做网站的wordpress 预览 word
  • 用笔记本做网站服务器新网网站
  • 做三角渐变用哪个网站分销平台官网
  • 弄个做网站公司网站关键词怎样修改
  • 网站验收认识电子商务网站建设技术
  • 红杭州网站建设网站上线需要哪些步骤
  • 郑州做网站公司排名移动网站建设动态
  • 哈尔滨网站建设制作费用织梦网站后台视频教程
  • 网站合作推广方案zencart网站管理 1.5
  • 做杂志的网站有哪些内容中国人事建设部网站
  • 无锡专业做网站的网页设计与制作教程第2版
  • 更换dns能上国外网站吗wordpress代币社交
  • 百度统计app做seo网站的公司哪家好
  • 公司网站建设总结报告建设银行网站邮箱
  • 做网站的属于什么专业?网站的功能建设
  • 长沙知名网站js网站变灰色代码
  • 有意思网站推荐珠海关键词优化软件
  • 网站推广渠道有哪些电子商务服务平台
  • 哈尔滨网站建设报价wordpress企业建站流程
  • 网站设计费用明细网站收录不增加
  • 怎么样做一家装修竞标网站网站设计常州
  • 制作一个网站就等于制作一个网页网络公司经营范围包括哪些
  • 余姚网站建设在哪里适合个人网站
  • 成都网站建设582013年四川省泸州市技能竞赛网站建设样稿
  • 建设企业网站平台做代刷主站网站
  • 苏州手机网站建设公司灰色行业关键词推广