Java项目:家校信息共享系统(java+SpringBoot+Mybatis+jQuery+mysql)

源码获取:俺的博客首页 "资源" 里下载!

项目介绍

本项目包含管理员、教师、家长用户三种角色;
管理员角色包含以下功能:
管理员登录,用户注册申请,学校用户账号管理,学校管理员管理,网站介绍管理,系统公告管理,网站新闻发布,新闻审核管理,公告审核管理等功能。

教师角色包含以下功能:
教师登录,学生管理,考试管理,沟通交流管理,布置作业等功能。

家长用户角色包含以下功能:
用户首页,网站新闻,公告信息,用户登录,家长互动等功能。


环境需要

1.运行环境:jdk必须使用JDK7,其它版本暂不支持。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
5.数据库:MySql 5.7版本;
6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目


技术栈

1. 后端:SpringBoot+Mybatis
2. 前端:mysql+css+javascript+jQuery


使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址 登录

首页展示:

注册界面展示:

课程安排展示:

个人信息管理展示:

校园资讯管理展示:

学生管理展示:

模块管理展示:

留言信息展示:

课程信息展示:

校园资讯展示:

用户管理控制层:

@Controller
@RequestMapping("UsersServlet")
public class UsersController {
    private UsersDao usersDao = new UsersDao();

    @Autowired
    private HttpServletRequest request;


    @RequestMapping("/loginadmin")
    public String loginadmin() {
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        Users users = usersDao.login(username, password);

        if (users != null) {
            request.getSession().setAttribute("loginUsers", users);
            return "admin_index";

        } else {
            request.setAttribute("msg", "登录失败,账号密码不匹配");
            return "admin_login";

        }

    }

    @RequestMapping("/userlogin")
    public String userlogin() {
        String userName = request.getParameter("username");
        String password = request.getParameter("password");
        String clientCheckcode = request.getParameter("validateCode");
        String serverCheckcode = (String) request.getSession().getAttribute("checkcode");
        if (clientCheckcode.equals(serverCheckcode)) {
            // 2. 去访问dao , 看看是否满足登录。

            Users Users = usersDao.userlogin(userName, password);

            // 3. 针对dao的返回结果,做出响应
            if (Users != null) {


                request.getSession().setAttribute("usersLogin", Users);
                CategoryDao categoryDao = new CategoryDao();
                List<Category> categoryList = categoryDao.queryAll();
                request.setAttribute("categoryList", categoryList.stream().filter(x -> x.getState().equals("1")).collect(Collectors.toList()));
                return "index";


            } else {
                request.setAttribute("error", "用户名或密码错误!");
                return "login";


            }
        } else {
            request.setAttribute("error", "登录失败,验证码不正确!");
            return "login";

        }
    }

    @RequestMapping("/userreg")
    public String userreg() {
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        String account = request.getParameter("account");
        String email = request.getParameter("email");
        String password2 = request.getParameter("password2");
        if (!password.equals(password2)) {
            request.setAttribute("error", "注册失败,密码与确认密码不一致!");
            return "reg";
        } else {

            boolean isSuccess = usersDao.isReg(account);

            if (!isSuccess) {

                request.setAttribute("error", "注册失败,该用户名已存在!");
                return "reg";

            } else {
                usersDao.reg(username, account, password, email);
                request.setAttribute("error", "注册成功!");

                return "reg";
            }
        }

    }

    @RequestMapping("/listforadmin")
    public String listforadmin() {


            List<Users> list = usersDao.getUsers();
            request.setAttribute("list", list);
            return "listusers";

    }
    @RequestMapping("/del")
    public String del(Integer id) {

        usersDao.del(id);

        List<Users> list = usersDao.getUsers();
        request.setAttribute("list", list);
        return "listusers";

    }
}

新闻管理控制层: 

@Controller
@RequestMapping("NewsServlet")
public class NewsController {
    @Autowired
    private HttpServletRequest request;
    private NewsDao newsDao = new NewsDao();
    private CategoryDao categoryDao = new CategoryDao();
    private CommentsDao commentsDao = new CommentsDao();
    @RequestMapping("/publish")
    public String publish(){
        String title = request.getParameter("title");
        String content = request.getParameter("content");
        String categoryid = request.getParameter("categoryid");

        Users users = (Users) request.getSession().getAttribute("loginUsers");
        Integer usersId = users.getId();

        Integer deptid = users.getDeptid();

        News news = new News();
        news.setCategoryid(Integer.parseInt(categoryid));
        news.setClicks(0);
        news.setContent(content);
        news.setPbdate(new Date());
        news.setPbdeptid(deptid);
        news.setPublisher(usersId);
        news.setCategoryid(Integer.parseInt(categoryid));
        news.setTitle(title);
        newsDao.save(news);
        return "redirect:listforadmin";
    }


    @RequestMapping("/listforadmin")
    public String listforadmin(){
        List<News> newsList = newsDao.queryAll();
        request.setAttribute("list", newsList);
        return "listnews";
    }





    @RequestMapping("/toaddnews")
    public String toaddnews(){
        List<News> newsList = newsDao.queryAll();
        request.setAttribute("list", newsList);
        List<Category> categoryList = categoryDao.queryAll();
        request.setAttribute("categoryList", categoryList);
        return "addnews";
    }


    @RequestMapping("/edit")
    public String edit(){
        String title = request.getParameter("title");
        String content = request.getParameter("content");
        String categoryid = request.getParameter("categoryid");

        News news = new News();
        news.setCategoryid(Integer.parseInt(categoryid));
        news.setContent(content);
        news.setPbdate(new Date());
        news.setId(Integer.parseInt(request.getParameter("id")));

        news.setTitle(title);
        newsDao.edit(news);
        return "redirect:listforadmin";
    }



    @RequestMapping("/del")
    public String del(){
        newsDao.deleteById(Integer.parseInt(request.getParameter("id")));
        List<News> newsList = newsDao.queryAll();
        request.setAttribute("list", newsList);
        return "listnews";

    }


    @RequestMapping("/toeditnews")
    public String toeditnews(){
        News news = newsDao.queryByid(Integer.parseInt(request.getParameter("id")));
        request.setAttribute("v", news);
        List<Category> categoryList = categoryDao.queryAll();
        request.setAttribute("categoryList", categoryList);
        return "editnews";
    }


    @RequestMapping("/queryByType")
    public String queryByType(){
        String categoryid = request.getParameter("categoryid");

        List<News> newsList = newsDao.queryAll();
        request.setAttribute("list", newsList.stream()
                .filter(x -> x.getCategoryid().equals(Integer.parseInt(categoryid))).collect(Collectors.toList()));
        List<Category> categoryList = categoryDao.queryAll();
        request.setAttribute("categoryList",
                categoryList.stream().filter(x -> x.getState().equals("1")).collect(Collectors.toList()));

        return "typenews";
    }


    @RequestMapping("/detail")
    public String detail(){
        //测试
        String id =  request.getParameter("id");
        if(id.contains(".jsp"))
        {
           id= request.getParameter("id").replaceAll(".jsp","");

        }

        News news = newsDao.queryByid(Integer.parseInt(id));

        news.setClicks(news.getClicks() + 1);

        newsDao.setClicksIncrement(news);

        NewsDetail detail = new NewsDetail();
        detail.setNews(news);

        Category category = categoryDao.queryById(news.getCategoryid());

        detail.setCategory(category);

        String content = news.getContent();
        int length = content.length();

        length = length / 60;

        length = length * 27 + 10;

        request.setAttribute("length", length);

        request.setAttribute("v", detail);

        List<Category> categoryList = categoryDao.queryAll();

        List<Comments> commentsList = commentsDao.getByNewsId(news.getId());
        request.setAttribute("commentsList", commentsList);

        request.setAttribute("contentstr", content);

        request.setAttribute("categoryList",
                categoryList.stream().filter(x -> x.getState().equals("1")).collect(Collectors.toList()));

        return "detailnews";
    }

    @RequestMapping("/search")
    public String search(){
        String search = request.getParameter("search");

        request.setAttribute("searchStr", search);

        List<News> newsList = newsDao.queryAll();
        newsList=newsList.stream().filter(x -> x.getTitle().contains(search)).collect(Collectors.toList());

        newsList=	newsList.stream().map(x->{

            String title = x.getTitle();

            /*			String[] split = title.split(search);
             */
			/*if(split.length>=2){
				for(int i=0;i<split.length-1;i++){
			title=split[i]+"<font color='red'>"+search+"</font>"+split[i+1];

				}
			}else{
				title=split[0]+"<font color='red'>"+search+"</font>";
			}*/
            title=title.replace(search, "<font color='red'>"+search+"</font>");


            System.out.println(title);

            x.setTitle(title);

            return x;
        }).collect(Collectors.toList());

        request.setAttribute("list",newsList
        );
        List<Category> categoryList = categoryDao.queryAll();
        request.setAttribute("categoryList",
                categoryList.stream().filter(x -> x.getState().equals("1")).collect(Collectors.toList()));

        return "searchnews";
    }

}

公告管理控制层:

@Controller
@RequestMapping("CategoryServlet")
public class CategoryController {
    @Autowired
    private HttpServletRequest request;
    private CategoryDao categoryDao=new CategoryDao();

    @RequestMapping("/listforadmin")
    public String listforadmin(){
        List<Category> categoryList = categoryDao.queryAll();
        request.setAttribute("list", categoryList);
        return "listcategory";
    }
    @RequestMapping("/show")
    public String show(){
        List<Category> categoryList = categoryDao.queryAll();
        categoryList=categoryList.stream().filter(x->x.getState().equals("1")).collect(Collectors.toList());

        if(categoryList.size()>=5)
        {

            request.setAttribute("list", categoryDao.queryAll());
            request.setAttribute("msg","设置栏目显示失败,前台栏目最多显示5个");
            return "listcategory";
        }else {
            categoryDao.show(Integer.parseInt(request.getParameter("id")));
            return "redirect:listforadmin";
        }
    }
    @RequestMapping("/hidden")
    public String hidden(){

        categoryDao.hidden(Integer.parseInt(request.getParameter("id")));
        return "redirect:listforadmin";
    }
    @RequestMapping("/add")
    public String add(){
        String name=request.getParameter("name");
        String state=request.getParameter("state");
        Category category=new Category();
        category.setName(name);
        category.setState(state);
        categoryDao.save(category);
        return "redirect:listforadmin";
    }



}

源码获取:俺的博客首页 "资源" 里下载!

  • 6
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: Java是一种编程语言,Vue是一种前端框架,Spring Boot是一种后端框架,Maven是一种构建工具,MyBatis是一种ORM框架,MySQL是一种关系型数据库。这些技术可以一起使用来开发Web应用程序。 ### 回答2: Java、Vue、SpringBoot、Maven、MyBatisMySQL 是现代软件开发中常见的工具和技术。Java 是一门强大的编程语言,非常适合构建企业级应用程序。Vue 是一种现代的 JavaScript 框架,用于构建可交互的单页应用程序。SpringBoot 是一种基于 Spring 框架的服务端开发解决方案,可用于构建 RESTful Web 服务或基于微服务体系结构的应用程序。Maven 是一个构建工具,可用于自动化构建和管理软件项目的依赖项。MyBatis 是一个数据持久化框架,可以方便地将 Java 应用程序连接到各种关系型数据库中。MySQL 是一个流行的、开源的关系型数据库管理系统,是许多 Web 应用程序的默认选择。 在软件开发中,Java、Vue、SpringBoot、Maven、MyBatisMySQL 可以相互配合使用,以构建跨平台、云端部署、高效稳定的应用程序。JavaSpringBoot 可用于构建 Web 服务和 RESTful API,而 Vue 和 SpringBoot 可用于构建面向用户的 Web 应用程序。Maven 可用于管理项目依赖项和自动化构建过程,而 MyBatis 可以方便地将数据从数据库中提取并转换为对象。MySQL 可用于存储应用程序生成的数据。 总之,在软件开发中,选择适合您团队和项目需求的工具和技术非常重要。Java、Vue、SpringBoot、Maven、MyBatisMySQL 已经得到了广泛的应用和实践验证,并且可以帮助您轻松地构建高效、可靠和安全的应用程序。 ### 回答3: Java是一种面向对象的高级编程语言,被广泛使用于开发各种应用程序,从桌面应用程序到企业级应用程序。它具有强大的编程能力、跨平台兼容性和开源社区的支持。Java中有很多库、框架和工具,可以简化编程任务并提高应用程序的性能和稳定性。 Vue是一个流行的JavaScript前端框架,用于构建用户界面。它被设计为轻量级、高效和灵活,可以用来建立单页应用程序和大型复杂应用程序。Vue提供了许多有用的工具和组件,可以帮助开发人员快速建立优秀的用户界面。 Spring Boot是一个基于Spring框架的轻量级应用程序开发框架,目的是简化企业级应用程序的开发过程。Spring Boot具有自动配置、快速启动、简单的部署和许多其他特性,可以快速构建高性能应用程序。它还具有用于构建RESTful API和微服务的功能。 Maven是一个强大的项目管理和构建工具,用于构建Java应用程序。Maven可以帮助开发人员自动化项目构建过程,并可以帮助组织项目结构和管理库依赖。Maven具有许多插件和工具,可以帮助开发人员编译、测试和打包应用程序。 MyBatis是一个流行的Java持久层框架,用于简化与关系型数据库的交互。它使用SQL映射文件将Java对象映射到数据库表中,提供了一种简单而强大的方式来处理数据库操作。MyBatis还提供了许多有用的特性,如动态SQL、事务管理和缓存。 MySQL是一个开源的关系型数据库管理系统,被广泛使用于Web应用程序和企业级应用程序。MySQL具有可靠的性能、高度可扩展性和广泛的API支持,可以处理大型数据集和高并发访问。它还拥有丰富的特性和工具,支持多种编程语言和操作系统

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq1334611189

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值