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

news2024/9/21 14:44:05

项目介绍

  • 企业的销售要进行培训,由技术人员进行辅导并考评检测培训效果,所以有了这个小系统。
  • 实现了系统的登录验证、请求拦截验证、基础模块(用户管理、角色管理、销售管理)、业务模块(评分管理、评分结果)。
  • 除了基本的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;
    }
}

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

ubuntu安装mysql(tar.xz)

0:本机Ubuntu的版本为 腾讯云 18.04 1&#xff1a;下载地址 MySQL &#xff1a;&#xff1a; 下载 MySQL 社区服务器 2&#xff1a;上传文件到服务器 3:解压 sudo sumv mysql-8.2.0-linux-glibc2.17-x86_64-minimal.tar.xz /usrtar -xvf mysql-8.2.0-linux-glibc2.17-x86_6…

Vue2.脚手架

全局安装&#xff1a;npm i vue/cli -g检查是否成功安装&#xff1a;vue --version新建项目&#xff1a;vue create 项目名 通过nodejs安装的时候&#xff0c;可以直接代理和仓库&#xff0c;~/.npmrc文件内容如下&#xff1a; proxysocks5://127.0.0.1:7897 registryhttps:/…

软件测试|使用Python抓取百度新闻的页面内容

简介 作为技术工程师&#xff0c;在繁忙的工作中我们不一定有时间浏览发生的热点新闻&#xff0c;但是懂技术的我们不需要访问网站来看当下发生的大事&#xff0c;我们可以使用网络爬虫的技术来获取当下最新最热的新闻&#xff0c;本文就来介绍一下使用Python抓取一下百度新闻…

【动态规划】【滑动窗口】C++算法:3003 执行操作后的最大分割数量

作者推荐 【动态规划】【字符串】扰乱字符串 本文涉及的基础知识点 C算法&#xff1a;滑动窗口总结 动态规划 LeetCode3003 执行操作后的最大分割数量 给你一个下标从 0 开始的字符串 s 和一个整数 k。 你需要执行以下分割操作&#xff0c;直到字符串 s 变为 空&#xff1…

[情商-11]:人际交流的心理架构与需求层次模型

目录 前言&#xff1a; 一、心理架构 1.1 个体生理层 1.2 个体心理层 1.3 点对点人际交流层 1.4 社会网络层 1.5 社会价值层 二、人的需求层次模型 2.1 需求&#xff08;欲望&#xff09;层次模型 2.2 基因与人需求之间的关系 2.3 个体生理需求 2.4 个体的心理需求…

kylin4.0.3升级问题

话接前文&#xff1a; kylin升级(3.0.1-&#xff1e;kylin-4.0.3)-CSDN博客文章浏览阅读941次&#xff0c;点赞29次&#xff0c;收藏12次。原本的cube太多了&#xff0c;换其他OLAP数据库太麻烦。相比之下&#xff0c;升级是一个很好的选择&#xff08;官网有说明内存降低和构…

计算机毕业设计 基于Java的综合小区管理系统的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍&#xff1a;✌从事软件开发10年之余&#xff0c;专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精…

Java反转单链表

/*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode() {}* ListNode(int val) { this.val val; }* ListNode(int val, ListNode next) { this.val val; this.next next; }* }*/ //核心思想&#xff0c;利用cur和Curnex…

网络安全B模块(笔记详解)- MYSQL信息收集

MYSQL信息收集 1.通过渗透机场景Kali中的渗透测试工具对服务器场景MySQL03进行服务信息扫描渗透测试(使用工具Nmap,使用必须要使用的参数),并将该操作显示结果中数据库版本信息作为Flag提交; Flag:MySQL 5.5.12 2.通过渗透机场景Kali中的渗透测试工具对服务器场景MySQL0…

RK3568驱动指南|第十二篇 GPIO子系统-第136章 实战:实现动态切换引脚复用功能

瑞芯微RK3568芯片是一款定位中高端的通用型SOC&#xff0c;采用22nm制程工艺&#xff0c;搭载一颗四核Cortex-A55处理器和Mali G52 2EE 图形处理器。RK3568 支持4K 解码和 1080P 编码&#xff0c;支持SATA/PCIE/USB3.0 外围接口。RK3568内置独立NPU&#xff0c;可用于轻量级人工…

C语言天花板——指针(进阶3)

篇接上文(http://t.csdnimg.cn/Tl42h)&#xff0c;今天我们来讲一些有趣的关于指针的问题&#x1f6a2;&#x1f6a2;&#x1f6a2; 首先我们来看个代码&#xff1a; int main() {//一维数组int a[] { 1,2,3,4 };//4个元素&#xff0c;每个元素使int类型(4个字节)printf(&qu…

【LeetCode】24. 两两交换链表中的节点(中等)——代码随想录算法训练营Day04

题目链接&#xff1a;24. 两两交换链表中的节点 题目描述 给你一个链表&#xff0c;两两交换其中相邻的节点&#xff0c;并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题&#xff08;即&#xff0c;只能进行节点交换&#xff09;。 示例 1&#xff1…

基于JAVA的民宿预定管理系统 开源项目

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 用例设计2.2 功能设计2.2.1 租客角色2.2.2 房主角色2.2.3 系统管理员角色 三、系统展示四、核心代码4.1 查询民宿4.2 新增民宿4.3 新增民宿评价4.4 查询留言4.5 新增民宿订单 五、免责说明 一、摘要 1.1 项目介绍 基于…

Centos7下升级gcc/g++版本(简单 + 避坑)

在 Centos7 下&#xff0c;使用 yum 安装高版本的 gcc/g 最简单&#xff1a; yum -y install centos-release-scl yum -y install devtoolset-11-gcc devtoolset-11-gcc-c devtoolset-11-binutils需要安装哪个个版本的gcc/g&#xff0c;就把数字替换成对应的版本号。例如上面代…

Velodyne 64E S3 硬件连接和 velodyne_driver ROS驱动安装

在当前的研究工作中&#xff0c;点云语义分割技术的应用显得尤为重要&#xff0c;而我选择了rangenet作为分割算法的核心。尽管课题组拥有一款80线激光雷达&#xff0c;但是在实际测试中&#xff0c;我们发现该算法模型在我们的数据集上的泛化表现并不理想。为了改善这一情况&a…

ubuntu22.04虚拟机安装教程

ubuntu22.04虚拟机安装教程 1.下载镜像&#xff1a; https://ubuntu.com/ 打开后点击Download: 或者用清华镜像源下载&#xff1a;滑到最底下&#xff0c;点击ubuntu-releases 选中这个版本ubuntu-22.04.3-desktop-amd64点击下载 2.虚拟机加载&#xff1a;打开VM&#xff0…

移动通信系统关键技术多址接入OFDM学习(7)

1.OFDM是一种多载波传输方案&#xff0c;可以将高速串行传输转换为低速并行传输&#xff0c;增加符号持续时间&#xff0c;抗多径干扰能力强。 串行和并行有着不同的比特持续时间&#xff0c;同时拥有相同的数据速率。因此&#xff0c;虽然OFDM将串行信号转换为并行信号&#…

Java项目:06 Springboot的进销存管理系统

作者主页&#xff1a;舒克日记 简介&#xff1a;Java领域优质创作者、Java项目、学习资料、技术互助 文中获取源码 进销存管理系统 介绍 进销存系统是为了对企业生产经营中进货、出货、批发销售、付款等全程进行&#xff08;从接获订单合同开 始&#xff0c;进入物料采购、入…

QT上位机开发(crc校验)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 crc校验是数据校验中一种常用的方法。我们在上位机和下位机沟通的时候&#xff0c;有的时候需要检验数据在传输的时候有&#xff0c;没有发生数据被…

uniapp-uniCloud的基本使用(编写云存储的地区级联选择器)

目录 新建项目&#xff0c;创建 uniCloud 服务空间并关联 1. 新建项目 2. 创建 uniCloud 服务空间并关联 manifest.json内未配置Appld,请重新获取后再 云数据库的使用 城市选择和云数据库 介绍 云端数据 DB Schema概述 新建项目&#xff0c;创建 uniCloud 服务空间并关…