基于javaweb+jsp的宠物医院管理系统(java+Springboot+ssm+mysql+jsp+maven)
一、项目简述
功能描叙: 医生信息,客户信息,宠物管理,浏览管理,诊断管理, 医生管理,用户管理等等模块。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Springboot+ SpringMVC + MyBatis + ThymeLeaf + HTML+ JavaScript + JQuery + Ajax + maven等等
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
private final Logger logger = LoggerFactory.getLogger(UserController.class);
private final ResultMap resultMap;
@Autowired
private UserService userService;
@Autowired
private UserRoleService userRoleService;
@Autowired
public UserController(ResultMap resultMap) {
this.resultMap = resultMap;
}
/**
* 返回有权限信息
*/
@RequestMapping(value = "/getMessage", method = RequestMethod.GET)
public ResultMap getMessage() {
return resultMap.success().message("您拥有用户权限,可以获得该接口的信息!");
}
/**
* 修改用户信息页面user/userEdit.html
*/
@RequestMapping(value = "/editUserPage")
public String editUserPage(Long userId, Model model) {
model.addAttribute("manageUser", userId);
if (null != userId) {
User user = userService.selectByPrimaryKey(userId);
model.addAttribute("manageUser", user);
}
return "login";
}
List<Page> pageList = pageService.getAllRolePageByUserId(user.getId()+"");
model.addAttribute("pageList", pageList);
return "index";
}
/**
* Method name: checkUserPassword <BR>
* Description: 检测旧密码是否正确 <BR>
*
* @param password 旧密码
* @return boolean 是否正确<BR>
*/
@RequestMapping(value = "/user/checkUserPassword")
@ResponseBody
public boolean checkUserPassword(String password) {
return userService.checkUserPassword(password);
}
@RequestMapping("/getPageByRole")
@ResponseBody
public Object getPageByRole(Integer roleId) {
return pageService.getAllPageByRoleId(roleId);
}
/**
* Method name: updatePageById <BR>
* Description: 根据页面id更新页面 <BR>
*
* @param page
* @return ResultMap<BR>
*/
@RequestMapping("/updatePageById")
@ResponseBody
public ResultMap updatePageById(Page page) {
return pageService.updatePageById(page);
}
/**
* Method name: addPage <BR>
* Description: 添加页面 <BR>
*
* @param page
* @return Page<BR>
*/
@RequestMapping("/addPage")
if (u != null){
return resultMap.success().message("该手机号已注册!");
}
try {
user.setPassword(MD5.md5(user.getPassword()));
user.setCreateTime(new Date());
userService.save(user);
String[] ids = new String[1];
ids[0] = user.getId()+"";
// 普通用户
userRoleService.addUserRole(2, ids);
return resultMap.success().message("注册成功");
}catch (Exception e){
e.printStackTrace();
return resultMap.fail().message("注册失败");
}
}
/**
* Method name: index <BR>
* Description: 登录页面 <BR>
*/
@RequestMapping(value = "/user/updatePassword")
@ResponseBody
public String updatePassword(String password) {
return userService.updatePassword(password);
}
}
用户信息控制层:
/**
* 用户控制
*/
@Controller("User")
@RequestMapping("/user")
public class UserController {
private final Logger logger = LoggerFactory.getLogger(UserController.class);
private final ResultMap resultMap;
@Autowired
private UserService userService;
@Autowired
private UserRoleService userRoleService;
@Autowired
public UserController(ResultMap resultMap) {
this.resultMap = resultMap;
*
* @return String<BR>
*/
@RequestMapping(value = "/userAddPage")
public String userAddPage() {
return "sa/userAdd";
}
/**
* Method name: userPage <BR>
* Description: 用户管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userPage")
public String userPage() {
return "sa/userList";
}
/**
* Method name: getAllUserByLimit <BR>
* Description: 根据条件获取所有用户 <BR>
*
* @param userParameter
* @return Object<BR>
*/
return userRoleService.delUserRoleByUserIdAndRoleId(userId, roleId);
}
/**
* Method name: selectUserRole <BR>
* Description: 跳转到选择用户角色页面 <BR>
*
* @return String<BR>
*/
@RequestMapping("/selectUserRole")
public String selectUserRole() {
return "sa/selectUserRole";
}
/**
List<Page> pageList = pageService.getAllRolePageByUserId(user.getId()+"");
model.addAttribute("pageList", pageList);
return "index";
} else {
return "login";
}
}
/**
* Method name: main <BR>
* Description: 进入主页面 <BR>
* index.html
*/
@RequestMapping(value = "/main")
public String main(Model model) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
model.addAttribute("user", user);
} else {
* @param roleId
* @param userIds
* @return String<BR>
*/
@RequestMapping("/addUserRole")
@ResponseBody
public String addUserRole(Integer roleId, String[] userIds) {
return userRoleService.addUserRole(roleId, userIds);
}
/**
* Method name: userAddPage <BR>
* Description: 用户添加页面 <BR>
*
@RequestMapping(value = "/demo/table", method = RequestMethod.GET)
public String demoTable() {
return "table";
}
@RequestMapping(value = "/demo/tu", method = RequestMethod.GET)
public String demoTu() {
return "tu";
}
@RequestMapping(value = "/demo/tu1", method = RequestMethod.GET)
public String tu1() {
return "tu1";
}
@RequestMapping(value = "/demo/tu2", method = RequestMethod.GET)
public String tu2() {
return "tu2";
}
@RequestMapping(value = "/demo/tu3", method = RequestMethod.GET)
public String tu3() {
return "tu3";
}
/**演示页面**/
/**
* Method name: logout <BR>