赞
踩
基于java的停车管理系统,框架采用的是springboot
1.数据库:MySql
2.技术:java
3.框架:springboot
————————————————
项目效果图:
代码块:
package com.javapandeng.controller;
import com.javapandeng.base.BaseController;
import com.javapandeng.po.User;
import com.javapandeng.service.UserService;
import com.javapandeng.utils.Consts;
import com.javapandeng.utils.Pager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
/**
* 用户c层
*/
@Controller
@RequestMapping("/user")
public class UserController extends BaseController {
@Autowired
private UserService userService;
@RequestMapping("/findBySql")
public String findBySql(Model model,User user){
String sql = "select * from user where 1=1 ";
if(!isEmpty(user.getUserName())){
sql += " and userName like '%"+user.getUserName()+"%' ";
}
sql+=" order by id";
Pager<User> pagers = userService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers",pagers);
model.addAttribute("obj",user);
return "user/user";
}
/**
* 查看用户信息
* @param model
* @param request
* @return
*/
@RequestMapping("/view")
public String view(Model model, HttpServletRequest request){
Object attribute = request.getSession().getAttribute(Consts.USERID);
if(attribute==null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
User obj = userService.load(userId);
model.addAttribute("obj",obj);
return "user/view";
}
/**
* 执行修改用户信息的操作
*/
@RequestMapping("/exUpdate")
public String exUpdate(User user,HttpServletRequest request){
Object attribute = request.getSession().getAttribute(Consts.USERID);
if(attribute==null){
return "redirect:/login/uLogin";
}
user.setId(Integer.valueOf(attribute.toString()));
userService.updateById(user);
return "redirect:/user/view.action";
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。