A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

2.1 需求分析
用户操作流程如下:
1、用户进入“我的课程”页面,点击“新增课程”,进入新增课程页面

2、填写课程信息,选择课程分类、课程等级、学习模式等。
3、信息填写完毕,点击“提交”,课程添加成功或课程添加失败并提示失败原因。  
需要解决的是在新增页面上输入的信息:
1、课程分类
多级分类,需要方便用户去选择。

2、课程等级、学习模

2.2 课程分类查询
2.2.1介绍

在新增课程界面需要选择课程所属分类, 分类信息是整个项目非常重要的信息,课程即商品,分类信息设置的好 坏直接影响用户访问量。
分类信息在哪里应用?
1、首页分类导航


2、课程的归属地
添加课程时要选择课程的所属分类。
  2.2.2数据结构
分类表category的结构如下:


2.2.3分类查询 2.2.3.1数据格式
在添加课程时需要选择课程所属的分类,这里需要定义课程分类查询接口。
接口格式要根据前端需要的数据格式来定义,前端展示课程分类使用elemenet-ui的cascader(级联选择器)组 件。


数据格式例子如下:

[AppleScript] 纯文本查看 复制代码
  [
 {      
   value: 'zhinan',      
   label: '指南',    
     children: [{      
     value: 'shejiyuanze',       
    label: '设计原则',  
         children: [{      
       value: 'yizhi',     
        label: '一致'       
    }, {         
    value: 'fankui',    
         label: '反馈'    
       }, {      
       value: 'xiaolv',   
          label: '效率'    
       }, {       
      value: 'kekong',  
           label: '可控'     
      }]    
     }]  
 } ] 

2.2.3.2 数据模型
1)定义category的模型
category模型对数据字段对应,如下:

[AppleScript] 纯文本查看 复制代码
@Data 
@ToString 
@Entity
 @Table(name="category") 
@GenericGenerator(name = "jpa‐assigned", strategy = "assigned") public class Category implements Serializable {     private static final long serialVersionUID = ‐906357110051689484L;  
   @Id    
 @GeneratedValue(generator = "jpa‐assigned") 
    @Column(length = 32)   
  private String id;    
 private String name; 
    private String label;  
   private String parentid;  
   private String isshow;   
  private Integer orderby; 
    private String isleaf;  
 }

1)定义数据返回格式

[AppleScript] 纯文本查看 复制代码
@Data
 @ToString public class CategoryNode extends Category {    
   List<CategoryNode> children;  
 }

2.2.4 Api接口
[AppleScript] 纯文本查看 复制代码
package com.xuecheng.api.web.controller.api.course;
   import com.xuecheng.framework.domain.course.ext.CategoryNode;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation; 
import org.springframework.web.bind.annotation.GetMapping; 
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;  
   @Api(value = "课程分类管理",description = "课程分类管理",tags = {"课程分类管理"}) public interface CategoryControllerApi {  
     @ApiOperation("查询分类")    
 public CategoryNode findList();  
 }



0 个回复

您需要登录后才可以回帖 登录 | 加入黑马