Java项目:03 基于Springboot的销售培训考评管理系统

项目介绍

  • 企业的销售要进行培训,由技术人员进行辅导并考评检测培训效果,所以有了这个小系统。
  • 实现了系统的登录验证、请求拦截验证、基础模块(用户管理、角色管理、销售管理)、业务模块(评分管理、评分结果)。
  • 除了基本的CRUD之外,其中评分结果模块实现了数据可视化及图表的联动。

主要角色有管理员、销售、评委

环境要求

1.运行环境:最好是java jdk1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.tomcat环境:Tomcat7.x,8.X,9.x版本均可

4.硬件环境:windows7/8/10 4G内存以上;或者Mac OS;

5.是否Maven项目:是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven.项目

6.数据库:MySql5.7/8.0等版本均可;

技术栈

  • 技术框架:jQuery + MySQL5.7 + mybatis + shiro + Layui + HTML + CSS + JS + jpa
  • 运行环境:jdk8 + IntelliJ IDEA + maven3 + mariaDB

使用说明

1.使用Navicati或者其它工具,在mysql中创建对应sq文件名称的数据库,并导入项目的sql文件;

2.使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;

3.将项目中config-propertiesi配置文件中的数据库配置改为自己的配置,然后运行;

运行指导

idea导入源码空间站顶目教程说明(Vindows版)-ssm篇:

http://mtw.so/5MHvZq

源码地址:http://codegym.top。

运行截图

界面QQ截图20240113113107

QQ截图20240113113148

QQ截图20240113113155

QQ截图20240113113206

QQ截图20240113113217

QQ截图20240113113225

代码

UserController

package cn.temptation.web;

import cn.temptation.dao.RoleDao;
import cn.temptation.dao.UserDao;
import cn.temptation.domain.Role;
import cn.temptation.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.persistence.criteria.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class UserController {
    @Autowired
    private UserDao userDao;
    @Autowired
    private RoleDao roleDao;

    @RequestMapping("/user")
    public String index() {
        return "user";
    }

    @RequestMapping("/user_list")
    @ResponseBody
    public Map<String, Object> userList(@RequestParam Map<String, Object> queryParams) {
        Map<String, Object> result = new HashMap<>();

        try {
            Integer page = Integer.parseInt(queryParams.get("page").toString());
            Integer limit = Integer.parseInt(queryParams.get("limit").toString());
            String condition = (String) queryParams.get("condition");
            String keyword = (String) queryParams.get("keyword");

            // 创建查询规格对象
            Specification<User> specification = (Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) -> {
                Predicate predicate = null;
                Path path = null;

                if (condition != null && !"".equals(condition) && keyword != null && !"".equals(keyword)) {
                    switch (condition) {
                        case "username":    // 用户名称
                            path = root.get("username");
                            predicate = cb.like(path, "%" + keyword + "%");
                            break;
                        case "rolename":    // 角色名称
                            path = root.join("role", JoinType.INNER);
                            predicate = cb.like(path.get("rolename"), "%" + keyword + "%");
                            break;
                    }
                }

                return predicate;
            };

            Pageable pageable = PageRequest.of(page - 1, limit, Sort.Direction.ASC, "userid");

            Page<User> users = userDao.findAll(specification, pageable);

            result.put("code", 0);
            result.put("msg", "查询OK");
            result.put("count", users.getTotalElements());
            result.put("data", users.getContent());
        } catch (Exception e) {
            e.printStackTrace();
            result.put("code", 500);
            result.put("msg", "服务器内部错误");
            result.put("count", 0);
            result.put("data", new ArrayList());
        }

        return result;
    }

    @RequestMapping("/user_delete")
    @ResponseBody
    public Integer userDelete(@RequestParam String userid) {
        try {
            userDao.deleteById(Integer.parseInt(userid));
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return -1;
    }

    @RequestMapping("/user_view")
    public String view(Integer userid, Model model) {
        User user = new User();
        if (userid != null) {
            user = userDao.getOne(userid);
        }
        model.addAttribute("user", user);
        return "user_view";
    }

    @RequestMapping("/role_load")
    @ResponseBody
    public List<Role> roleList() {
        return roleDao.findAll();
    }

    @RequestMapping("/user_update")
    @ResponseBody
    public Integer userUpdate(User user) {
        try {
            userDao.save(user);
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return -1;
    }
}

ScoreController

package cn.temptation.web;

import cn.temptation.dao.SalesDao;
import cn.temptation.dao.ScoreDao;
import cn.temptation.domain.Sales;
import cn.temptation.domain.Score;
import cn.temptation.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.persistence.criteria.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class ScoreController {
    @Autowired
    private ScoreDao scoreDao;
    @Autowired
    private SalesDao salesDao;

    @RequestMapping("/score")
    public String index() {
        return "score";
    }

    @RequestMapping("/score_list")
    @ResponseBody
    public Map<String, Object> scoreList(@RequestParam Map<String, Object> queryParams, HttpServletRequest request) {
        Map<String, Object> result = new HashMap<>();

        try {
            HttpSession session = request.getSession();
            User user = (User) session.getAttribute("user");

            Integer page = Integer.parseInt(queryParams.get("page").toString());
            Integer limit = Integer.parseInt(queryParams.get("limit").toString());
            String condition = (String) queryParams.get("condition");
            String keyword = (String) queryParams.get("keyword");

            // 创建查询规格对象
            Specification<Score> specification = (Root<Score> root, CriteriaQuery<?> query, CriteriaBuilder cb) -> {
                Predicate predicate = null;
                Path path = null;

                // 从session中取出当前用户信息,获取该用户创建的数据
                if (null != user) {
                    path = root.join("user", JoinType.INNER);
                    predicate = cb.equal(path.get("userid"), user.getUserid());
                }

                if (condition != null && !"".equals(condition) && keyword != null && !"".equals(keyword)) {
                    switch (condition) {
                        case "salesname":    // 销售名称
                            path = root.join("sales", JoinType.INNER);
                            predicate = cb.like(path.get("salesname"), "%" + keyword + "%");
                            break;
                    }
                }

                return predicate;
            };

            Pageable pageable = PageRequest.of(page - 1, limit, Sort.Direction.ASC, "scoreid");

            Page<Score> scores = scoreDao.findAll(specification, pageable);

            result.put("code", 0);
            result.put("msg", "查询OK");
            result.put("count", scores.getTotalElements());
            result.put("data", scores.getContent());
        } catch (Exception e) {
            e.printStackTrace();
            result.put("code", 500);
            result.put("msg", "服务器内部错误");
            result.put("count", 0);
            result.put("data", new ArrayList());
        }

        return result;
    }

    @RequestMapping("/score_delete")
    @ResponseBody
    public Integer scoreDelete(@RequestParam String scoreid) {
        try {
            scoreDao.deleteById(Integer.parseInt(scoreid));
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return -1;
    }

    @RequestMapping("/score_view")
    public String view(Integer scoreid, Model model) {
        Score score = new Score();
        if (scoreid != null) {
            score = scoreDao.findByScoreid(scoreid);
        }
        model.addAttribute("score", score);
        return "score_view";
    }

    @RequestMapping("/sales_load")
    @ResponseBody
    public List<Sales> salesList() {
        return salesDao.findAll();
    }

    @RequestMapping("/score_update")
    @ResponseBody
    public Integer scoreUpdate(Score score, HttpServletRequest request) {
        try {
            HttpSession session = request.getSession();
            User user = (User) session.getAttribute("user");

            if (null != user) {
                score.setUser(user);
            }

            scoreDao.save(score);
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return -1;
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/319424.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

springboot 企业微信 网页授权

html 引入jquery $(function () {// alert("JQ onready");// 当前企业的 corp_idconst corp_id xxxxxx;// 重定向 URL → 最终打开的画面地址&#xff0c;域名是在企业微信上配置好的域名const redirect_uri encodeURI(http://xxxxx.cn);//企业的agentId 每个应用都…

基于SpringBoot的房屋交易平台的设计与实现

&#x1f345;点赞收藏关注 → 私信领取本源代码、数据库&#x1f345; 本人在Java毕业设计领域有多年的经验&#xff0c;陆续会更新更多优质的Java实战项目希望你能有所收获&#xff0c;少走一些弯路。&#x1f345;关注我不迷路&#x1f345;一 、设计说明 1.1 研究背景 互…

Nightingale 夜莺监控系统 - 部署篇(1)

Author&#xff1a;rab 官方文档&#xff1a;https://flashcat.cloud/docs 目录 一、概述二、架构2.1 中心机房架构2.2 边缘下沉式混杂架构 三、环境四、部署4.1 中心机房架构部署4.1.1 MySQL4.1.2 Redis4.1.3 Prometheus4.1.4 n9e4.1.5 Categraf4.1.6 验证4.1.7 配置数据源 4…

安装、运行和控制AI apps在您的计算机上一键式

pinokio 你是否曾为安装、运行和自动化 AI 应用程序和大模型而感到困惑&#xff1f;是否希望有一个简单而强大的工具来满足你的需求&#xff1f;如果是这样&#xff0c;那么 Pinokio 将会是你的理想选择&#xff01;Pinokio 是一款革命性的人工智能浏览器&#xff0c;是一个开…

专业课140+总分410+电子科技大学858信号与系统考研经验,电子信息通信

我的初试备考从4月末&#xff0c;持续到初试前&#xff0c;这中间没有中断。 我是二战考生&#xff0c;准备的稍微晚一些&#xff0c;如果是一战考生&#xff0c;建议在2、3月份开始。 总的时间分配上&#xff0c;是数学>专业课>英语>政治&#xff0c;虽然大家可支配…

Python如何免费调用微软Bing翻译API

一、引言 现在免费的机器翻译越来越少了&#xff0c;随着有道翻译开始收费&#xff0c;百度降低用户的免费机器翻译额度(目前只有实名认证过的高级用户才能获得100万字符的免费翻译额度)&#xff0c;而亚马逊、腾讯等机器翻译调用相对比较麻烦&#xff0c;需要下载各种插件包&…

【代码随想录05】242.有效的字母异位词 349. 两个数组的交集 202. 快乐数 1. 两数之和

目录 242.有效的字母异位词题目描述做题思路参考代码 349. 两个数组的交集题目描述做题思路参考代码 202. 快乐数题目描述做题思路参考代码 1.两数之和题目描述参考代码 242.有效的字母异位词 题目描述 给定两个字符串 *s* 和 *t* &#xff0c;编写一个函数来判断 *t* 是否是…

使用swift创建第一个ios程序

一、安装xcode 先到app store中下载一个Xcode app 二、创建项目 1、项目设定 创建ios app 2、工程结构 三、修改代码实现按键联动 四、运行测试

时序预测 | MATLAB实现GRNN广义回归神经网络时间序列未来多步预测(程序含详细预测步骤)

时序预测 | MATLAB实现GRNN广义回归神经网络时间序列未来多步预测(程序含详细预测步骤) 目录 时序预测 | MATLAB实现GRNN广义回归神经网络时间序列未来多步预测(程序含详细预测步骤)预测效果基本介绍程序设计参考资料预测效果 基本介绍 MATLAB实现GRNN广义回归神经网络时间序列…

【Windows】基于Hyper-V安装Ubuntu虚拟机

&#x1f60f;★,:.☆(&#xffe3;▽&#xffe3;)/$:.★ &#x1f60f; 这篇文章主要介绍基于Hyper-V安装Ubuntu虚拟机。 学其所用&#xff0c;用其所学。——梁启超 欢迎来到我的博客&#xff0c;一起学习&#xff0c;共同进步。 喜欢的朋友可以关注一下&#xff0c;下次更新…

使用kibana来创建ElasticSearch的索引库与文档的命令

文章目录 &#x1f412;个人主页&#x1f3c5;JavaEE系列专栏&#x1f4d6;前言&#xff1a;&#x1f380;使用kibana来为ElasticSearch创建索引库&#x1f380;使用kibana来为ElasticSearch创建修改文档 &#x1f412;个人主页 &#x1f3c5;JavaEE系列专栏 &#x1f4d6;前言…

粒子群算法优化RBF神经网络回归分析

目录 完整代码和数据下载链接:粒子群算法优化RBF神经网络回归分析(代码完整,数据齐全)资源-CSDN文库 https://download.csdn.net/download/abc991835105/88738570 RBF的详细原理 RBF的定义 RBF理论 易错及常见问题 RBF应用实例,基于rbf的空调功率预测 代码 结果分析 展望…

MySQL-多表连接查询

&#x1f389;欢迎您来到我的MySQL基础复习专栏 ☆* o(≧▽≦)o *☆哈喽~我是小小恶斯法克&#x1f379; ✨博客主页&#xff1a;小小恶斯法克的博客 &#x1f388;该系列文章专栏&#xff1a;重拾MySQL &#x1f379;文章作者技术和水平很有限&#xff0c;如果文中出现错误&am…

行为型设计模式——中介者模式

中介者模式 中介者模式主要是将关联关系由一个中介者类统一管理维护&#xff0c;一般来说&#xff0c;同事类之间的关系是比较复杂的&#xff0c;多个同事类之间互相关联时&#xff0c;他们之间的关系会呈现为复杂的网状结构&#xff0c;这是一种过度耦合的架构&#xff0c;即…

二、MySQL安装

目录 1、双击mysql8的安装向导 2、分为首次安装和再安装 1&#xff09;、首次安装 &#xff08;1&#xff09;如果是首次安装mysql系列的产品&#xff0c;需要先安装mysql产品的安装向导 &#xff08;2&#xff09;选择安装模式 2&#xff09;、不是首次安装 &#xff0…

每日一博 - 使用APIFOX调测 @RequestBody标注的对象

文章目录 概述发送 post 请求步骤1.新建接口&#xff0c;设置为 post 请求2. 填写 URL 和参数3.发送请求 实战 RequestBody 概述 APIFOX&#xff08;类似Postman&#xff09;提供了丰富的功能来支持用户发送包含各种信息的 POST 请求&#xff0c;如文本数据、JSON 或 XML 数据…

centos7下搭建ldap服务器

参考&#xff1a; 全网最全Centos7.9搭建LDAP服务器图形界面_ldap服务器搭建-CSDN博客 LDAP服务搭建 - 简书 https://www.cnblogs.com/netsa/p/16017326.html 安装 #安装ldap服务 yum install -y openldap-servers openldap-clients openldap openldap-devel compat-openl…

FlinkAPI开发之窗口(Window)

案例用到的测试数据请参考文章&#xff1a; Flink自定义Source模拟数据流 原文链接&#xff1a;https://blog.csdn.net/m0_52606060/article/details/135436048 窗口的概念 Flink是一种流式计算引擎&#xff0c;主要是来处理无界数据流的&#xff0c;数据源源不断、无穷无尽。…

【教3妹学编程-算法题】最大频率元素计数

2哥 : 3妹&#xff0c;最近有个电视剧《繁花》非常火&#x1f525;&#xff0c;你听说了吗&#xff1f; 3妹&#xff1a;没有&#xff0c;最近一直在忙着找工作&#xff0c;哪有时间看电视啊 2哥 : 啊&#xff1f;大周末还不休息一下啊&#xff0c;这么辛苦。 3妹&#xff1a;当…

一、MySQL 卸载

目录 1、软件的卸载准备 2、软件的卸载 方式一&#xff1a;通过控制面板卸载 方式二&#xff1a;通过mysql8的安装向导卸载 1、双击mysql8的安装向导 2、取消更新 3、选择要卸载的mysql服务器软件的具体版本 4、确认删除数据目录 5、执行删除 6、完成删除 3、清理残…