項目介紹
- 企業(yè)的銷售要進行培訓,由技術(shù)人員進行輔導并考評檢測培訓效果,所以有了這個小系統(tǒng)。
- 實現(xiàn)了系統(tǒng)的登錄驗證、請求攔截驗證、基礎(chǔ)模塊(用戶管理、角色管理、銷售管理)、業(yè)務(wù)模塊(評分管理、評分結(jié)果)。
- 除了基本的CRUD之外,其中評分結(jié)果模塊實現(xiàn)了數(shù)據(jù)可視化及圖表的聯(lián)動。
主要角色有管理員、銷售、評委
環(huán)境要求
1.運行環(huán)境:最好是java jdk1.8,我們在這個平臺上運行的。其他版本理論上也可以。
2.IDE環(huán)境:IDEA,Eclipse,Myeclipse都可以。推薦IDEA;
3.tomcat環(huán)境:Tomcat7.x,8.X,9.x版本均可
4.硬件環(huán)境:windows7/8/10 4G內(nèi)存以上;或者Mac OS;
5.是否Maven項目:是;查看源碼目錄中是否包含pom.xml;若包含,則為maven項目,否則為非maven.項目
6.數(shù)據(jù)庫:MySql5.7/8.0等版本均可;
技術(shù)棧
- 技術(shù)框架:jQuery + MySQL5.7 + mybatis + shiro + Layui + HTML + CSS + JS + jpa
- 運行環(huán)境:jdk8 + IntelliJ IDEA + maven3 + mariaDB
使用說明
1.使用Navicati或者其它工具,在mysql中創(chuàng)建對應(yīng)sq文件名稱的數(shù)據(jù)庫,并導入項目的sql文件;
2.使用IDEA/Eclipse/MyEclipse導入項目,修改配置,運行項目;
3.將項目中config-propertiesi配置文件中的數(shù)據(jù)庫配置改為自己的配置,然后運行;
運行指導
idea導入源碼空間站頂目教程說明(Vindows版)-ssm篇:
http://mtw.so/5MHvZq
源碼地址:http://codegym.top。
運行截圖
界面
代碼
UserController文章來源:http://www.zghlxwxcb.cn/news/detail-794290.html
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");
// 創(chuàng)建查詢規(guī)格對象
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", "服務(wù)器內(nèi)部錯誤");
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文章來源地址http://www.zghlxwxcb.cn/news/detail-794290.html
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");
// 創(chuàng)建查詢規(guī)格對象
Specification<Score> specification = (Root<Score> root, CriteriaQuery<?> query, CriteriaBuilder cb) -> {
Predicate predicate = null;
Path path = null;
// 從session中取出當前用戶信息,獲取該用戶創(chuàng)建的數(shù)據(jù)
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", "服務(wù)器內(nèi)部錯誤");
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;
}
}
到了這里,關(guān)于Java項目:03 基于Springboot的銷售培訓考評管理系統(tǒng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!