本文介绍: 项目介绍物业管理系统,包含登录信息统计、物业人员管理,住户管理,房屋管理、车位管理等功能;环境要求JDK >= 1.8 (推荐1.8版本)Mysql >= 5.5.0 (推荐5.7版本)Maven >= 3.0开发工具:IDEA/EclipseTomcat: 8.0及以上技术栈:后端Spring+Spring MVC+MyBatis前端:html+JQuery适用课程设计,大作业,毕业设计,项目练习,学习演示等 return “login“; }
项目介绍
物业管理系统,包含登录信息统计、物业人员管理,住户管理,房屋管理、车位管理等功能;
技术栈:
后端Spring+Spring MVC+MyBatis
适用
return "login";
}
/**
* 用户登录
* @param request
* @return
*/
@RequestMapping("/login")
public String login(HttpServletRequest request,ModelMap model){
String username = request.getParameter("username");
String password = request.getParameter("password");
if(StringUtils.isEmpty(username)||StringUtils.isEmpty(password)){
return "login";
}
User user = userService.getUserByUsername(username);
HttpSession session = request.getSession();
session.setAttribute("user", user);
@RequestMapping(value="/caradd")
public String getcaradd(HttpServletRequest request){
return "userAddCar";
}
/**
* 添加车辆信息
* @param request
* @param model
* @return
*/
@RequestMapping(value="/addcar")
public String getAddCar(HttpServletRequest request,ModelMap model,HttpSession session){
String plateNum = request.getParameter("plateNum");
String brand = request.getParameter("brand");
String color = request.getParameter("color");
String idCardNum =request.getParameter("idCardNum");
User user = (User) session.getAttribute("user");
int userId = user.getId();
String realName = user.getRealName();
Room room = roomservice.getRoomByUserId(userId);
int roomId = room.getId();
Car addcar = new Car();
modelMap.put("msg", "更新成功!");
//人
User user = userService.getUserByUsername(username);
modelMap.put("user", user);
//车
Car car = carservice.getCarById(user2.getId());
modelMap.put("car", car);
//房
Room room = roomservice.getRoomByUserId(user2.getId());
modelMap.put("room", room);
return "user";
}else{
modelMap.put("msg", "原密码输入错误!");
return "pass";
}
}
return "userinfo";
}
/**
* 跳转修改密码页面
*/
@RequestMapping(value="/getupdatePassword")
public String getUpdatePassword(HttpServletRequest request,User user,
ModelMap model){
HttpSession session = request.getSession();
user = (User) session.getAttribute("user");
String username = user.getUserName();
model.put("username", username);
return "pass";
}
model.put("roomlist", roomlist);
return "adminRoom";
}
}
用户管理控制层:
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private CarService carservice;
@Autowired
private RoomService roomservice;
try{
String username = request.getParameter("username");
String password = request.getParameter("password");
String realname = request.getParameter("realname");
String idCardNum = request.getParameter("idCardNum");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
String settleTime = request.getParameter("settleTime");
Date date = sdf.parse(settleTime);
String sex = request.getParameter("sex");
String address = request.getParameter("address");
User user = new User();
user.setUserName(username);
user.setPassword(password);
user.setRealName(realname);
user.setIdCardNum(idCardNum);
user.setSettleTime(date);
user.setSex(sex);
user.setAddress(address);
userService.addUser(user);
/**
* 用户登录
* @param request
* @return
*/
@RequestMapping("/login")
public String login(HttpServletRequest request,ModelMap model){
String username = request.getParameter("username");
String password = request.getParameter("password");
if(StringUtils.isEmpty(username)||StringUtils.isEmpty(password)){
return "login";
}
User user = userService.getUserByUsername(username);
HttpSession session = request.getSession();
session.setAttribute("user", user);
if(user.getPassword().equals(password)){
if(user.getRole().equals(0)){
return "adminindex";
}else {
return "userindex";
}
}else{
model.put("msg", "用户名或者密码错误!");
return "login";
}
return "adminUserAll";
}
/**
* 获取单个用户信息
* @param request
* @return
*/
@RequestMapping("/getUserById")
public String getUserById(HttpServletRequest request,ModelMap model,HttpSession session){
User user1 = (User) session.getAttribute("user");
int id = user1.getId();
User user = userService.getUserById(id);
model.addAttribute("user", user);
return "user";
}
/**
* 用户注册
* @param user
* @param modelMap
* @return
*/
@RequestMapping("/register")
public String register(ModelMap modelMap,HttpServletRequest request){
try{
String username = request.getParameter("username");
String password = request.getParameter("password");
String realname = request.getParameter("realname");
/**
* 更新用户
* @param user
* @return
* @throws ParseException
*/
@RequestMapping("/updateUser")
public String updateUser(HttpServletRequest request,User user,ModelMap model,
HttpSession session) throws ParseException{
user = (User) session.getAttribute("user");
int id = user.getId();
String userName = request.getParameter("username");
String companyName = request.getParameter("companyname");
String phone = request.getParameter("phone");
String email = request.getParameter("email");
/*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss E");
String outmigrationTime = request.getParameter("outmigrationTime");
private CarService carservice;
@Autowired
private RoomService roomservice;
@RequestMapping("/welcome")
public String welcome(HttpServletRequest request,ModelMap model){
return "login";
}
/**
* 用户登录
* @param request
* @return
*/
@RequestMapping("/login")
public String login(HttpServletRequest request,ModelMap model){
原文地址:https://blog.csdn.net/m0_71416050/article/details/124994794
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_16663.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。