基于javaweb+mysql的springboot客户管理系统(java+springboot+jsp+layui+jq+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot客户管理系统(java+springboot+jsp+layui+jq+mysql)
项目介绍
本项目为后管系统,主要功能包括:
登录、修改密码、客户模块、充值模块、消费模块、对账单模块等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 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项目:是;
技术栈
-
后端:SpringBoot+Mybatis
-
前端:JSP+LayUI+jQuery
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
- 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 修改logback-spring.xml文件中,第16行 5. 运行项目,输入http://localhost:8081/ 登录
Map<String, Object> map = new HashMap<String,Object>(16);
//创建用户模板类
UserExample userExample = new UserExample();
//创建查询准则
Criteria criteria = userExample.createCriteria();
if(page == null || page <= 0) {
page = 1;
if(limit == null || limit <= 0) {
limit = 10;
//判断user类的条件是否为空
if(user.getRealName() != null) {
@RequiresPermissions("1004")
@RequestMapping("/deleteUser")
@ResponseBody
public Map<String, Object> deleteUser(Integer id){
Map<String, Object> map = new HashMap<String, Object>(16);
boolean success = false;
//删除成功
if(userService.deleteById(id) == true) {
success = true;
map.put("success", success);
map.put("code", 0);
return map;
/**
* @return Map<String,Object>
* @exception Nothing
* @since 1.8
*/
@Operation(name="后台查找角色列表")
@RequiresAuthentication
@RequestMapping("/findRoles")
@ResponseBody
public Map<String, Object> findRoles(){
Map<String, Object> map = new HashMap<String, Object>(16);
List<Role> roles = roleService.selectByRoleExample(new RoleExample());
return map;
CustomerExample example = new CustomerExample();
Criteria criteria = example.createCriteria();
//设置分页参数
if(page == null || page <= 0) {
page = 1;
if(limit == null || limit <= 0) {
limit = 10;
String all = "all";
if(!all.equals(findtype)) {
example.setLimit(limit);
Long offset = new Long((page-1)*limit);
public Map<String, Object> findUserById(Integer id){
Map<String, Object> map = new HashMap<String, Object>(16);
boolean success = false;
String msg = "";
User user = userService.findById(id);
if(user != null){
user.setPassword(null);
user.setSalt(null);
success = true;
}else{
msg = "读取用户数据出错,请稍后再试!";
map.put("success", success);
map.put("user", user);
return false;
@RequiresPermissions("5003")
@Operation(name="更新客户信息")
@RequestMapping("update")
@ResponseBody
public Map<String, Object> updateCustomer(Customer customer){
Map<String, Object> map = new HashMap<String,Object>(16);
if(customerService.updateCustomerByPrimaryKeySelective(customer)) {
map.put("msg", "更新成功");
map.put("success", true);
}else {
@Operation(name="查找当前登录的用户")
@RequiresPermissions("13001")
@RequestMapping("/findCurrentUser")
@ResponseBody
public Map<String, Object> findCurrentUser(Integer id){
Map<String, Object> map = new HashMap<String, Object>(16);
boolean success = false;
String msg = "";
//根据ID查找用户
User user = userService.findById(id);
String msg = "";
User user = userService.findById(id);
if(user != null){
user.setPassword(null);
user.setSalt(null);
success = true;
}else{
msg = "读取用户数据出错,请稍后再试!";
map.put("success", success);
map.put("user", user);
map.put("msg",msg);
map.put("code", 0);
if( sessionCode == null || "".equals(sessionCode)){
maps.put("code", 200);
maps.put("msg", "验证码获取失败! 请刷新页面!");
return maps;
sessionCode = sessionCode.toLowerCase();
if(!sessionCode.equals(verifyCode)) {
maps.put("code", 200);
maps.put("msg", "验证码不正确!");
return maps;
//2.判断用户账号密码
Subject subject = SecurityUtils.getSubject();
System.err.println("==============================" +subject.isAuthenticated());
//判断用户是否已经登陆
@ResponseBody
public Map<String, Object> addCustomer(Customer customer,Linkman linkman,String customerName,String linkmanName,String customerLevel,HttpServletRequest request){
Map<String, Object> map = new HashMap<String,Object>(16);
this.getUser(request);
//检测是否存在customer对象
if(customer == null || linkman == null) {
map.put("msg", "参数为空");
map.put("success", false);
return map;
//检测客户名是否存在
if(customerName == null || "".equals(customerName)) {
map.put("msg", "用户名称参数不能为空");
* @exception Nothing
* @since 1.8
*/
@Operation(name="修改用户")
@RequiresPermissions(value={"1002","13002"}, logical=Logical.OR)
@RequestMapping("/editUser")
@ResponseBody
public Map<String, Object> editUser(User user){
Map<String, Object> map = new HashMap<String, Object>(16);
boolean success = false;
String msg = "";
user.setSalt(null);
success = true;
msg = "查找成功!";
}else{
success = false;
msg = "查找失败!";
map.put("success", success);
map.put("code",0);
map.put("data", user);
map.put("msg", msg);
return map;
/**
* 描述:用户修改密码
Long count = userService.countByExample(userExample);
userExample.setLimit(limit);
userExample.setOffset(offset);
List<User> list = userService.findByExample(userExample);
logger.info(list.toString());
map.put("data", list);
map.put("code", 0);
map.put("msg", "success");
map.put("count", count);
return map;
/**
* 描述:根据编号查找用户
//登出
subject.logout();
//同时删除session中的用户信息
request.getSession().removeAttribute("user");
request.getSession().invalidate();
//重定向到登陆页面
view.setViewName("redirect:/pages/login.jsp");
return view;
系统用户管理控制层:
@Controller
@RequestMapping("/user")
public class UserController {
if(page == null || page <= 0) {
page = 1;
if(limit == null || limit <= 0) {
limit = 10;
//判断user类的条件是否为空
if(user.getRealName() != null) {
criteria.andRealNameLike("%"+user.getRealName()+"%");
if(user.getRoleId() != null) {
logger.info("获得到的角色编号为:" + user.getRoleId());
criteria.andRoleIdEqualTo(user.getRoleId());
if(user.getAccount() != null) {
criteria.andAccountLike("%"+user.getAccount()+"%");
Long offset = new Long((page - 1) * limit);
maps.put("code",200);
maps.put("msg","账号已被锁定,请联系管理员进行处理!");
//不存在的账号
} catch(UnknownAccountException e) {
maps.put("code",200);
maps.put("msg","账号或密码错误!");
//密码错误
} catch(IncorrectCredentialsException e) {
maps.put("code",200);
maps.put("msg","账号或密码错误!");
}catch (Exception e) {
e.printStackTrace();
/**
* 描述:检查用户邮箱是否可用
* @version 1.0
* @param email
* @return Map<String,Object>
* @exception Nothing
* @since 1.8
*/
@Operation(name="检查用户邮箱")
@RequestMapping("/checkUserEmail")
@ResponseBody