前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SSM框架(spring+spring mvc+mybatis)+Mysql实现的星星少儿教育系统(功能包含前台:首页少儿早教知识、资讯、英语课程、视频、专家,

SSM框架(spring+spring mvc+mybatis)+Mysql实现的星星少儿教育系统(功能包含前台:首页少儿早教知识、资讯、英语课程、视频、专家,

原创
作者头像
用户6334815
发布2022-07-24 15:49:49
1941
发布2022-07-24 15:49:49
举报
文章被收录于专栏:java系统java系统java系统

@TOC

SSM框架(spring+spring mvc+mybatis)+Mysql实现的星星少儿教育系统

本系统为了解决少儿教育线上的发展,分为前后台,前台对少儿资讯、少儿的英语课程、视频、音乐、专家、知识做了分类汇总展示,后台对文章资讯、类别、来源等进行管理,大大提高了少儿教育的科学化、效率化、知识普及最大化。

实现功能截图

小星星少儿教育系统

首页

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

少儿资讯内容

请添加图片描述
请添加图片描述

英语知识

请添加图片描述
请添加图片描述

英语音乐

请添加图片描述
请添加图片描述

英语视频

请添加图片描述
请添加图片描述

英语视频小猪佩奇播放

请添加图片描述
请添加图片描述

英语专家

请添加图片描述
请添加图片描述

英语专家介绍

请添加图片描述
请添加图片描述

后台登录

请添加图片描述
请添加图片描述

后台首页

请添加图片描述
请添加图片描述

后台文章管理

请添加图片描述
请添加图片描述

文章添加

请添加图片描述
请添加图片描述

文章类别管理

请添加图片描述
请添加图片描述

文章类别添加

请添加图片描述
请添加图片描述

文章来源管理

请添加图片描述
请添加图片描述

文章来源添加

请添加图片描述
请添加图片描述

系统功能

本少儿教育系统实现了以下功能:

前台

1、首页

2、早教知识

3、英语课程

4、英语音乐

5、英语视频

6、英语知识

7、英语专家

后台

8、登录

9、文章管理

10、文章添加

11、文章来源管理

12、文章来源添加

13、文章类别管理

14、文章类别添加

15、返回前台首页

使用技术

数据库:mysql

开发工具:Idea(Myeclispe、Eclipse也可以)

知识点:spring+spring mvc+mybatis+bootstrap+jquery

代码

实体类

Source.java

package com.smart.domain;

/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
public class Source {

  private long id;
  private String sourceName;


  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }


  public String getSourceName() {
    return sourceName;
  }

  public void setSourceName(String sourceName) {
    this.sourceName = sourceName;
  }

}

Admin.java

package com.smart.domain;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */

public class Admin {

  private long id;
  private String userName;
  private String passWord;


  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }


  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }


  public String getPassWord() {
    return passWord;
  }

  public void setPassWord(String passWord) {
    this.passWord = passWord;
  }

}

service层

SourceService.java

package com.smart.service;

import com.smart.dao.SourceDao;
import com.smart.domain.Source;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Service
public class SourceService {

    @Autowired
    private SourceDao sourceDao;

    /*添加*/
   public void addSource(Source source){
        sourceDao.addSource(source);
    }
    /*修改*/
    public void updateSource(Source source){
        sourceDao.updateSource(source);
    }
    /*删除*/
    public void deleteSource(Source source){
        sourceDao.deleteSource(source);
    }
    /*查找*/
    public Source selectSource(Source source){
        return sourceDao.selectSource(source);
    }

    public List getAll(){
        return sourceDao.getAll();
    }
}

AdminService.java

package com.smart.service;

import com.smart.dao.AdminDao;
import com.smart.domain.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Service
public class AdminService {
    @Autowired
    private AdminDao adminDao;

    /*添加*/
    public void addAdmin(Admin admin){

    }
    /*修改*/
    public void updateAdmin(Admin admin){

    }
    /*删除*/
    public void deleteAdmin(Admin admin){

    }
    /*查找*/
    public Admin selectAdmin(Admin admin){
        return adminDao.selectAdmin(admin);
    }
}

controller层

AdminController.java

package com.smart.controller;

import com.smart.dao.AdminDao;
import com.smart.dao.ContentDao;
import com.smart.dao.SourceDao;
import com.smart.dao.TypeDao;
import com.smart.domain.Admin;
import com.smart.domain.Content;
import com.smart.domain.Source;
import com.smart.domain.Type;
import com.smart.service.AdminService;
import com.smart.service.ContentService;
import com.smart.service.SourceService;
import com.smart.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Controller
public class AdminController {

    @Autowired
    private SourceService sourceService;

    @Autowired
    private TypeService typeService;

    @Autowired
    private ContentService contentService;

    @Autowired
    private AdminService adminService;

    @RequestMapping("test")
    public String toTest(){return "test";}


    @RequestMapping("toLogin")
    public String toLogin(){return "/admin/login";}

    @RequestMapping("login")
    public ModelAndView Login(Admin admin){
        ModelAndView modelAndView=new ModelAndView();
        Admin admin2=adminService.selectAdmin(admin);
        if (admin2!=null){
            modelAndView.setViewName("/admin/manager");
        }else {
            modelAndView.setViewName("/admin/login");
            modelAndView.addObject("tips","<script>alert('用户名或密码错误')</script>");
        }
        return modelAndView;
    }

    @RequestMapping("toMain")
    public String toAdminMain(){
        return "/admin/manager";
    }

    @RequestMapping("toaddLaiyuan")
    public String toaddLaiyuan(){
        return "/admin/addLaiyuan";
    }

    @RequestMapping("toAddType")
    public String toAddType(){
        return "/admin/addType";
    }

    @RequestMapping("toContent")
    public ModelAndView toContent(){
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("/admin/content");
        List list=contentService.getAll();
        modelAndView.addObject("contents",list);
        return modelAndView;
    }

    @RequestMapping("toaddContent")
    public ModelAndView toaddContent(){
        ModelAndView modelAndView=new ModelAndView();
        List types=typeService.getAll();
        List sources=sourceService.getAll();
        modelAndView.addObject("types",types);
        modelAndView.addObject("sources",sources);
        modelAndView.setViewName("/admin/addContent");
        return modelAndView;
    }

    @RequestMapping("tolaiyuan")
    public ModelAndView tolaiyuan(){
        ModelAndView modelAndView =new ModelAndView();
        List list=sourceService.getAll();
        modelAndView.setViewName("/admin/laiyuan");
        modelAndView.addObject("sources",list);
        return modelAndView;
    }

    @RequestMapping("toType")
    public ModelAndView toType(){
        List lists=typeService.getAll();
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.addObject("types",lists);
        modelAndView.setViewName("/admin/type");
        return modelAndView;
    }

    @RequestMapping("addLaiyuan")
    public ModelAndView addLaiyuan(Source source){
        ModelAndView modelAndView=new ModelAndView();
        sourceService.addSource(source);
        modelAndView.addObject("tips", "<script>alert('添加成功!')</script>");
        modelAndView.setViewName("/admin/addLaiyuan");
        return modelAndView;
    }

    @RequestMapping("addType")
    public ModelAndView addType(Type type){
        ModelAndView modelAndView=new ModelAndView();
        typeService.addType(type);
        modelAndView.addObject("tips","<script>alert('添加成功!')</script>");
        modelAndView.setViewName("/admin/addType");
        return modelAndView;
    }

    @RequestMapping("addContent")
    public ModelAndView addContent(MultipartFile file,String editorValue,Content content) throws IOException {
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("redirect:toContent");
        System.out.println(content.getTitle());
        System.out.println(content.getFromName());
        //保存数据库的路径
        String sqlPath = null;
        //定义文件保存的本地路径
        String localPath="";
        //定义 文件名
        String filename=null;
        if(!file.isEmpty()){
            //生成uuid作为文件名称 防止重复上传
            String uuid = UUID.randomUUID().toString().replaceAll("-","");
            //获得文件类型(可以判断如果不是图片,禁止上传)
            String contentType=file.getContentType();
            //获得文件后缀名
            String suffixName=contentType.substring(contentType.indexOf("/")+1);
            //得到 文件名
            filename=uuid+"."+suffixName;

            //根据后缀判断文件的

            switch (suffixName){
                case "mp3":localPath="E:\\WorkShop\\EED\\src\\main\\webapp\\static\\music\\";
                break;
                case "mp4": localPath="E:\\WorkShop\\EED\\src\\main\\webapp\\static\\video\\";
                break;
                case "jpg":
                case  "png":localPath="E:\\WorkShop\\EED\\src\\main\\webapp\\static\\picture\\";
                break;
                default:localPath="E:\\WorkShop\\EED\\src\\main\\webapp\\static\\other\\";
            }

            //文件保存路径
            file.transferTo(new File(localPath+filename));
            content.setUrlContext(filename);
        }
        content.setText(editorValue);
        contentService.addContent(content);
        return modelAndView;
    }

    @RequestMapping("deleteOne")
    public String deleteOne(int id){
        contentService.deleteContent(id);
        return "redirect:toContent";
    }

    @RequestMapping("updateOne")
    public ModelAndView updateOne(int id){
        Content content=contentService.selectContent(id);
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.addObject("content",content);
        modelAndView.setViewName("/admin/updateContent");
        return  modelAndView;
    }
}

MainController.java

package com.smart.controller;


import com.smart.domain.Content;
import com.smart.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Controller
public class MainController {

    @Autowired
    private ContentService contentService;


    @RequestMapping("toMusic")
    public String toMusic(){
        return "testMusic";
    }

    @RequestMapping("toCommonContent")
    public ModelAndView toCommonContent(int id){
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("commonContent");
        Content content=contentService.selectContent(id);
        /*访问量加1*/
        content.setVisitNum(content.getVisitNum()+1);
        contentService.updateContent(content);
        /*判断文章类型*/
        /*视频类型为1 音乐类型为2 其他为0*/
        int contentType=0;
        switch (content.getTypeName()){
            case "英语视频":contentType=1;
            break;
            case "英语音乐":contentType=2;
                break;
             default:   contentType=0;
        }
        modelAndView.addObject("contentType",contentType);
        modelAndView.addObject("content",content);
        List tops=contentService.selectContentByTypeTop("英语知识");
        List zhuanjia=contentService.selectContentByType("英语专家");
        modelAndView.addObject("experts",zhuanjia);
        modelAndView.addObject("tops",tops);
        return  modelAndView;
    }


    @RequestMapping("toVideoContent")
    public ModelAndView toVideoContent(int id){ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("videoContent");
        Content content=contentService.selectContent(id);
        /*访问量加1*/
        content.setVisitNum(content.getVisitNum()+1);
        contentService.updateContent(content);
        modelAndView.addObject("content",content);
        return  modelAndView;}

    @RequestMapping("index")
    public ModelAndView toIndex(){
        /*获取早教网知识排行*/
        ModelAndView modelAndView=new ModelAndView();
        List tops=contentService.selectContentByTypeTop("英语知识");
        modelAndView.addObject("tops",tops);
        modelAndView.setViewName("index");
        /*获取专家信息*/
        List zhuanjia=contentService.selectContentByType("英语专家");
        modelAndView.addObject("experts",zhuanjia);
        return modelAndView;}

    @RequestMapping("kecheng")
    public ModelAndView toKecheng(){ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("zhishi");
        modelAndView.addObject("type","英语课程");
        List list=contentService.selectContentByType("英语课程");
        List tops=contentService.selectContentByTypeTop("英语知识");
        List zhuanjia=contentService.selectContentByType("英语专家");
        modelAndView.addObject("experts",zhuanjia);
        modelAndView.addObject("tops",tops);
        modelAndView.addObject("zhishis",list);
        return modelAndView;}

    @RequestMapping("zhishi")
    public ModelAndView toZhishi(){
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("zhishi");
        modelAndView.addObject("type","英语知识");
        List list=contentService.selectContentByType("英语知识");
        List tops=contentService.selectContentByTypeTop("英语知识");
        List zhuanjia=contentService.selectContentByType("英语专家");
        modelAndView.addObject("experts",zhuanjia);
        modelAndView.addObject("tops",tops);
        modelAndView.addObject("zhishis",list);
        return modelAndView;
    }

    @RequestMapping("shipin")
    public ModelAndView toShipin(){ ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("zhishi");
        modelAndView.addObject("type","英语视频");
        List list=contentService.selectContentByType("英语视频");
        List tops=contentService.selectContentByTypeTop("英语知识");
        List zhuanjia=contentService.selectContentByType("英语专家");
        modelAndView.addObject("experts",zhuanjia);
        modelAndView.addObject("tops",tops);
        modelAndView.addObject("zhishis",list);
        return modelAndView;}

    @RequestMapping("yinyue")
    public ModelAndView toYinyue(){ ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("zhishi");
        modelAndView.addObject("type","英语音乐");
        List list=contentService.selectContentByType("英语音乐");
        List tops=contentService.selectContentByTypeTop("英语知识");
        List zhuanjia=contentService.selectContentByType("英语专家");
        modelAndView.addObject("experts",zhuanjia);
        modelAndView.addObject("tops",tops);
        modelAndView.addObject("zhishis",list);
        return modelAndView;}

    @RequestMapping("zhuanjia")
    public ModelAndView toZhuanjia(){ ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("zhishi");
        modelAndView.addObject("type","英语专家");
        List list=contentService.selectContentByType("英语专家");
        List tops=contentService.selectContentByTypeTop("英语知识");
        List zhuanjia=contentService.selectContentByType("英语专家");
        modelAndView.addObject("experts",zhuanjia);
        modelAndView.addObject("tops",tops);
        modelAndView.addObject("zhishis",list);
        return modelAndView;}

    @RequestMapping("detail")
    public String toDetail(){return "detail";}

    @RequestMapping("report404")
    public String toReport404(){
        return "report404";
    }

}

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • SSM框架(spring+spring mvc+mybatis)+Mysql实现的星星少儿教育系统
    • 实现功能截图
      • 系统功能
        • 使用技术
          • 代码
          相关产品与服务
          云数据库 SQL Server
          腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档