当前位置: 首页 > news >正文

springboot(ssm宠物美容机构CRM系统 宠物服务商城系统Java系统

springboot(ssm宠物美容机构CRM系统 客户关系管理系统Java系统

开发语言:Java

框架:ssm/springboot + vue

JDK版本:JDK1.8(或11)

服务器:tomcat

数据库:mysql 5.7(或8.0)

数据库工具:Navicat

开发软件:eclipse//idea

依赖管理包:Maven

如需了解更多代码细节或修改代码功能界面,本人都能提供技术支持。(声音嘎嘎好听喔!)

祝你早日找到合适的代码哦~

注:主页千套源码&文档,文章最下方获取源码哦


package com.controller;import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;import javax.servlet.http.HttpServletRequest;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;/*** 登录相关*/
@RequestMapping("users")
@RestController
public class UserController{@Autowiredprivate UserService userService;@Autowiredprivate TokenService tokenService;/*** 登录*/@IgnoreAuth@PostMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));if(user==null || !user.getPassword().equals(password)) {return R.error("账号或密码不正确");}String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());return R.ok().put("token", token);}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {return R.error("用户已存在");}userService.insert(user);return R.ok();}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 密码重置*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request){UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));if(user==null) {return R.error("账号不存在");}user.setPassword("123456");userService.update(user,null);return R.ok("密码已重置为:123456");}/*** 列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,UserEntity user){EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/list")public R list( UserEntity user){EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();ew.allEq(MPUtil.allEQMapPre( user, "user"));return R.ok().put("data", userService.selectListView(ew));}/*** 信息*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") String id){UserEntity user = userService.selectById(id);return R.ok().put("data", user);}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrUser(HttpServletRequest request){Long id = (Long)request.getSession().getAttribute("userId");UserEntity user = userService.selectById(id);return R.ok().put("data", user);}/*** 保存*/@PostMapping("/save")public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {return R.error("用户已存在");}userService.insert(user);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername()));if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {return R.error("用户名已存在。");}userService.updateById(user);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){userService.deleteBatchIds(Arrays.asList(ids));return R.ok();}
}

相关文章:

  • MySQL查询,条件查询、模糊查询、限制查询...
  • 二维差分详解
  • Uniapp/微信小程序授权设置并实现点击保存图片
  • 安路IP核应用举例(OSC、UART)
  • 互联网加竞赛 python+opencv+机器学习车牌识别
  • 四十二、Redis
  • 一些好用的VSCode扩展
  • C++:命名空间
  • input、el-input输入框输入规则
  • DevEco Studio 项目鸿蒙(HarmonyOS)资源引用(自定统和系统)
  • 【自定义Source、Sink】Flink自定义Source、Sink对ClickHouse进行读和批量写操作
  • 【模块化】 js 模块化(CommonJS, AMD, UMD, CMD, ES6)
  • linux系统命令
  • 基于OHTPPS实现网站HTTPS访问
  • 使用国内镜像源安装opencv
  • [译] 怎样写一个基础的编译器
  • C语言笔记(第一章:C语言编程)
  • Django 博客开发教程 16 - 统计文章阅读量
  • flutter的key在widget list的作用以及必要性
  • go语言学习初探(一)
  • HTTP那些事
  • IIS 10 PHP CGI 设置 PHP_INI_SCAN_DIR
  • js作用域和this的理解
  • markdown编辑器简评
  • node和express搭建代理服务器(源码)
  • PyCharm搭建GO开发环境(GO语言学习第1课)
  • Python - 闭包Closure
  • Python 反序列化安全问题(二)
  • python学习笔记-类对象的信息
  • Quartz初级教程
  • Spring Cloud Alibaba迁移指南(一):一行代码从 Hystrix 迁移到 Sentinel
  • 记一次删除Git记录中的大文件的过程
  • 看完九篇字体系列的文章,你还觉得我是在说字体?
  • 容器化应用: 在阿里云搭建多节点 Openshift 集群
  • 使用Tinker来调试Laravel应用程序的数据以及使用Tinker一些总结
  • 我感觉这是史上最牛的防sql注入方法类
  • 赢得Docker挑战最佳实践
  • 掌握面试——弹出框的实现(一道题中包含布局/js设计模式)
  • HanLP分词命名实体提取详解
  • 函数计算新功能-----支持C#函数
  • # 透过事物看本质的能力怎么培养?
  • #pragma once与条件编译
  • #ubuntu# #git# repository git config --global --add safe.directory
  • #Ubuntu(修改root信息)
  • (Note)C++中的继承方式
  • (二)Eureka服务搭建,服务注册,服务发现
  • (附源码)计算机毕业设计ssm基于B_S的汽车售后服务管理系统
  • (亲测成功)在centos7.5上安装kvm,通过VNC远程连接并创建多台ubuntu虚拟机(ubuntu server版本)...
  • (推荐)叮当——中文语音对话机器人
  • (转)Google的Objective-C编码规范
  • (转)利用ant在Mac 下自动化打包签名Android程序
  • *** 2003
  • ***汇编语言 实验16 编写包含多个功能子程序的中断例程
  • .net core 6 集成和使用 mongodb
  • .NET Core使用NPOI导出复杂,美观的Excel详解