//
//
//
package com.car.controller;
import org.springframework.web.bind.annotation.PathVariable;
import com.car.pojo.Page;
import org.springframework.ui.Model;
import javax.servlet.http.HttpSession;
import com.car.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import com.car.service.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
@Controller
@RequestMapping({ "/api/user/" })
public class UserController
{
@Autowired
private UserService userService;
@RequestMapping({ "login.html" })
public String login(final User user, final HttpSession session, final Model model) {
final User u = this.userService.getUserByUsername(user.getUsername());
if (u == null) {
model.addAttribute("error", (Object)"\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef!");
return "login";
}
if (!user.getPassword().equals(u.getPassword())) {
model.addAttribute("error", (Object)"\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef!");
return "login";
}
session.setAttribute("user", (Object)u);
return "redirect:/index.html";
}
@RequestMapping({ "register.html" })
public String register(final User user, final Model model) {
User u = this.userService.getUserByUsername(user.getUsername());
if (u != null) {
model.addAttribute("error", (Object)"\u7528\u6237\u5df2\u5b58\u5728\uff01");
return "register";
}
u = this.userService.getByUserTelephone(user.getUserTelephone());
if (u != null) {
model.addAttribute("error", (Object)"\u624b\u673a\u53f7\u5df2\u88ab\u6ce8\u518c\uff01");
return "register";
}
this.userService.insertUser(user);
return "login";
}
@RequestMapping({ "logout.html" })
public String logout(final HttpSession session) {
session.removeAttribute("user");
return "login";
}
@RequestMapping({ "userList.html" })
public String userList(final Page<User> page, final Model model) {
final Page<User> p = this.userService.getUserList(page);
model.addAttribute("page", (Object)p);
return "/user/userList";
}
@RequestMapping({ "addUser.html" })
public String addUser(final User user, final Model model) {
User u = this.userService.getUserByUsername(user.getUsername());
if (u != null) {
model.addAttribute("error", (Object)"\u7528\u6237\u5df2\u5b58\u5728\uff01");
return "/user/addUser";
}
u = this.userService.getByUserTelephone(user.getUserTelephone());
if (u != null) {
model.addAttribute("error", (Object)"\u624b\u673a\u53f7\u5df2\u88ab\u6ce8\u518c\uff01");
return "/user/addUser";
}
this.userService.insertUser(user);
return "redirect:/api/user/userList.html";
}
@RequestMapping({ "getUser/{userId}.html" })
public String getUser(@PathVariable final String userId, final Model model) {
final User user = this.userService.getUserById(userId);
model.addAttribute("user", (Object)user);
return "/user/editUser";
}
@RequestMapping({ "updateUser.html" })
public String updateUser(final User user) {
this.userService.updateUser(user);
return "redirect:/api/user/userList.html";
}
@RequestMapping({ "toRecharge/{userId}.html" })
public String toRecharge(@PathVariable final String userId, final Model model) {
final User user = this.userService.getUserById(userId);
model.addAttribute("user", (Object)user);
return "/user/rechargeUser";
}
@RequestMapping({ "deleteUser{userId}.html" })
public String deleteTeacher(@PathVariable final String userId, final String[] userIds) {
if (userIds == null) {
this.userService.deleteById(userId);
}
else {
for (final String id : userIds) {
this.userService.deleteById(id);
}
}
return "redirect:/api/user/userList.html";
}
@RequestMapping({ "recharge.html" })
public String recharge(final User user) {
final User u = this.userService.getUserById(user.getUserId());
u.setUserTime(u.getUserTime() + user.getUserTime());
this.userService.updateUser(u);
return "redirect:/api/user/userList.html";
}
@RequestMapping({ "adopt/{userId}.html" })
public String adopt(@PathVariable final String userId) {
final User u = this.userService.getUserById(userId);
u.setUserState(2);
this.userService.updateUser(u);
return "redirect:/api/user/userList.html";
}
@RequestMapping({ "myInfo.html" })
public String myInfo(final Model model, final HttpSession session) {
final User user = (User)session.getAttribute("user");
model.addAttribute("user", (Object)user);
return "/user/myInfo";
}
@RequestMapping({ "updateMyInfo.html" })
public String updateMyInfo(final User user, final HttpSession session) {
this.userService.updateUser(user);
session.removeAttribute("user");
return "redirect:/login.jsp";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于SSM+Layui开发的驾校预约管理系统+sql数据库(毕设源码).zip
共319个文件
gif:75个
jar:41个
png:40个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 46 浏览量
2023-06-12
14:05:34
上传
评论 1
收藏 19.99MB ZIP 举报
温馨提示
【资源说明】 该项目是个人毕设项目源码,综合评分达到95分,经过严格调试,确保可以运行!放心下载使用。 该项目资源主要针对计算机、自动化等相关专业的学生或从业者下载使用,也可作为期末课程设计、课程大作业、毕业设计等。 具有较高的学习借鉴价值!基础能力强的可以在此基础上修改调整,以实现类似其他功能。 ## 功能实现: 学员角色包含以下功能:学员注册,学员登录,查看教练列表,预约教练,查看我的预约,评价教练,评论列表,个人信息管理等功能。 管理员角色包含以下功能:登录界面,车辆管理,教练管理,编辑教练,预约管理,评论管理,学员管理,充值学时等功能。 用了技术框架: HTML+CSS+JavaScript+jsp+mysql+Spring+mybatis 管理员账号/密码:admin/admin 学员账号/密码: user1/123456 ## 运行环境:jdk1.8/jdk1.9 ## IDE环境: Eclipse,Myeclipse,IDEA都可以 ## tomcat环境: Tomcat8.x/9.x
资源推荐
资源详情
资源评论
收起资源包目录
基于SSM+Layui开发的驾校预约管理系统+sql数据库(毕设源码).zip (319个子文件)
UserController.class 6KB
AppointController.class 6KB
CommentController.class 5KB
Result.class 4KB
TeacherController.class 4KB
UserServiceImpl.class 4KB
Page.class 4KB
AppointServiceImpl.class 4KB
TeacherServiceImpl.class 3KB
User.class 3KB
CarServiceImpl.class 3KB
CommentServiceImpl.class 3KB
CarController.class 3KB
FileController.class 3KB
LoginInterceptor.class 2KB
Appoint.class 2KB
Teacher.class 2KB
Car.class 2KB
Comment.class 1KB
CarTest.class 1KB
DateUtils.class 1KB
UserMapper.class 720B
CarMapper.class 703B
AppointMapper.class 679B
CommentMapper.class 634B
IndexController.class 629B
TeacherMapper.class 627B
CarService.class 576B
UserService.class 522B
CommentService.class 499B
TeacherService.class 492B
AppointService.class 475B
.classpath 841B
org.eclipse.wst.common.component 485B
org.eclipse.wst.jsdt.ui.superType.container 49B
layui.css 59KB
_all.css 14KB
layer.css 14KB
layui.mobile.css 10KB
laydate.css 7KB
purple.css 2KB
orange.css 2KB
yellow.css 2KB
login.css 2KB
green.css 2KB
pink.css 1KB
blue.css 1KB
grey.css 1KB
aero.css 1KB
red.css 1KB
minimal.css 1KB
code.css 1KB
tp5page.css 511B
global.css 39B
iconfont.eot 40KB
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
4.gif 6KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
3.gif 4KB
23.gif 4KB
34.gif 4KB
41.gif 4KB
38.gif 4KB
65.gif 3KB
32.gif 3KB
45.gif 3KB
7.gif 3KB
12.gif 3KB
26.gif 3KB
60.gif 3KB
2.gif 3KB
40.gif 3KB
25.gif 3KB
19.gif 3KB
66.gif 3KB
18.gif 3KB
46.gif 3KB
10.gif 3KB
共 319 条
- 1
- 2
- 3
- 4
资源评论
manylinux
- 粉丝: 4411
- 资源: 2491
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功