基於SSM開發餐飲業點餐系統php
開發環境: Windows操做系統
開發工具: MyEclipse+Jdk+Tomcat+MySql數據庫
運行效果圖java
@ResponseBody
@RequestMapping(value = "/checkUsername")
public String checkUsername(String username){
User user=userService.findByUsername(username);
if(user==null){
//容許註冊
return "1";
}else{
//不容許註冊
return "0";
}數據庫
}
/**
* 保存用戶
* @return
*/
@RequestMapping(value = "/saveUser")
public ModelAndView saveUser(User user,HttpServletRequest request) {
ModelAndView view = new ModelAndView();
boolean flag=userService.saveUser(user);
request.getSession().setAttribute("user", user);
if(flag==true){
//容許註冊
if(user.getStatus()==1){
view.setViewName("user/empInfoRegister");
}else{
view.setViewName("user/comInfoRegister");
}app
}else{
//不容許註冊
view.setViewName("user/comRegister");
}工具
return view;
}
@ResponseBody
@RequestMapping(value = "/updateUserInfo")
public String updateUserInfo(User user){
boolean flag=userService.updateUser(user);
if(flag){
Subject currentUser = SecurityUtils.getSubject();
currentUser.getSession().setAttribute("user", user);
return "1";
}else{
//不容許註冊
return "0";
}開發工具
}spa