基于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等等
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
* Method name: addUserPage <BR>
* Description: 增加用户界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addUserPage")
public String addUserPage(Long userId, Model model) {
model.addAttribute("manageUser", userId);
if (null != userId) {
User user = userService.selectByPrimaryKey(userId);
model.addAttribute("manageUser", user);
}
return "sa/userAdd";
}
/**
* Method name: checkUserId <BR>
return "tu2";
}
@RequestMapping(value = "/demo/tu3", method = RequestMethod.GET)
public String tu3() {
return "tu3";
}
/**演示页面**/
/**
* Method name: logout <BR>
* Description: 退出登录 <BR>
* @return String<BR>
*/
@RequestMapping(value = "/logout", method = RequestMethod.GET)
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);
}
public Object getAllUserByRoleId(Integer roleId, String roleNot, Integer page, Integer limit) {
if (null == roleNot) {
return userService.getAllUserByRoleId(roleId, page, limit);
}
return userService.getAllUserByNotRoleId(roleId, page, limit);
}
/**
* Method name: delUserRoleByUserIdAndRoleId <BR>
* Description: 根据用户id权限id删除用户权限表 <BR>
*
* @param userId
* @param roleId
* @return ResultMap<BR>
*/
@RequestMapping("/delUserRoleByUserIdAndRoleId")
@ResponseBody
public ResultMap delUserRoleByUserIdAndRoleId(String userId, Integer roleId) {
return userRoleService.delUserRoleByUserIdAndRoleId(userId, roleId);
}
/**
* Method name: selectUserRole <BR>
* Description: 跳转到选择用户角色页面 <BR>
*
* @return List<Page><BR>
*/
@RequestMapping("/getAllPage")
@ResponseBody
public List<Page> getAllPage() {
return pageService.getAllPage();
}
/**
* Method name: getPageByRole <BR>
* Description: 获取某个角色的权限页面 <BR>
*/
@RequestMapping("/getPageByRole")
if (flag1 && flag2 && flag3) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: updateRole <BR>
* Description: 根据权限id修改权限信息 <BR>
*
* @param id
* @param name
* @return String<BR>
*/
@RequestMapping("/updateRole")
@ResponseBody
User u = userService.getUserByPhoneAndName(user.getPhone(), user.getName());
String[] ids = new String[1];
ids[0] = u.getId()+"";
// 医生角色
userRoleService.addUserRole(3, ids);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateUser <BR>
* Description: 更新用户 <BR>
*
* @param user
* @return String<BR>
*/
@RequestMapping(value = "/login")
@ResponseBody
public ResultMap login(String username, String password) {
return userService.login(username, password);
}
/**
* Method name: login <BR>
* Description: 登录页面 <BR>
*
* @return String login.html<BR>
*/
@RequestMapping(value = "/index")
public String login() {
return "login";
* Method name: addRole <BR>
* Description: 增加角色 <BR>
*
* @param name
* @return String<BR>
*/
@RequestMapping("/addRole")
@ResponseBody
public String addRole(String name) {
return roleService.addRole(name);
}
/**
* Method name: delManageRole <BR>
* Description: 根据角色id删除角色 <BR>
*
* @param id
@ResponseBody
public List<Page> getAllPage() {
return pageService.getAllPage();
}
/**
* Method name: getPageByRole <BR>
* Description: 获取某个角色的权限页面 <BR>
*/
@RequestMapping("/getPageByRole")
@ResponseBody
public Object getPageByRole(Integer roleId) {
return pageService.getAllPageByRoleId(roleId);
}
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
logger.info("{}---退出登录!", user.getName());
}
subject.logout();
return "login";
}
/**
* Method name: login <BR>
* Description: 获取所有页面 <BR>
*
* @return List<Page><BR>
*/
@RequestMapping("/getAllPage")
@ResponseBody
public List<Page> getAllPage() {
return pageService.getAllPage();
}
/**
* Description: 检测用户账号是否存在 <BR>
*
* @param userId
* @return User<BR>
*/
@ResponseBody
@RequestMapping("/checkUserId")
public User checkUserId(Long userId) {
return userService.selectByPrimaryKey(userId);
}
/**
* Method name: addUser <BR>
* Description: 用户添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addUser")
public String addUser(User user) {
*/
@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 {
return "login";
}
List<Page> pageList = pageService.getAllRolePageByUserId(user.getId()+"");
model.addAttribute("pageList", pageList);
return "index";
/**
* Method name: getAllDelUserByLimit <BR>
* Description: 获取所有删除用户 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllDelUserByLimit")
@ResponseBody
public Object getAllDelUserByLimit(UserParameter userParameter) {
return userService.getAllDelUserByLimit(userParameter);
}
/**
* Method name: delUser <BR>
* Description: 批量删除用户 <BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delUser")
@ResponseBody
@Transactional
}
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) {
}
登录控制类:
/**
* 登录控制类
*/
@Controller("OpenLogin")
@RequestMapping()
public class LoginController {
@Autowired
private ResultMap resultMap;
@Autowired
@ResponseBody
@RequestMapping("/checkUserId")
public User checkUserId(Long userId) {
return userService.selectByPrimaryKey(userId);
}
/**
* Method name: addUser <BR>
* Description: 用户添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addUser")
public String addUser(User user) {
try {
user.setPassword(MD5.md5(user.getPassword()));
user.setCreateTime(new Date());
userService.addUser(user);
}
return "user/userEdit";
}
/**
* 更新数据库
*/
@ResponseBody
@RequestMapping("/updateUser")
public String updateUser(User user) {
return userService.updateUser(user);
}
}
管理员权限控制类:
/**
* 管理员权限控制类
*/
}
return "sa/userAdd";
}
/**
* Method name: checkUserId <BR>
* Description: 检测用户账号是否存在 <BR>
*
* @param userId
* @return User<BR>
*/
@ResponseBody
@RequestMapping("/checkUserId")
public User checkUserId(Long userId) {
return userService.selectByPrimaryKey(userId);
}
/**
* Method name: addUser <BR>
* Description: 用户添加 <BR>
*
* @param user
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")
* @param password 密码
* @return ResultMap<BR>
*/
@RequestMapping(value = "/login")
@ResponseBody
public ResultMap login(String username, String password) {
return userService.login(username, password);
}
/**
* Method name: login <BR>
* Description: 登录页面 <BR>
*
* @return String login.html<BR>
*/
@RequestMapping(value = "/index")
// 删除某个角色的所有用户
boolean flag3 = userRoleService.delUserRoleByRoleId(id);
if (flag1 && flag2 && flag3) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: updateRole <BR>
* Description: 根据权限id修改权限信息 <BR>
if (n != 0) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: addPageRoleByRoleId <BR>
* Description: 增加某个角色的权限页面 <BR>
*
* @param roleId
* Description: 退出登录 <BR>
* @return String<BR>
*/
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
logger.info("{}---退出登录!", user.getName());
}
subject.logout();
return "login";
}
/**
* 管理员权限控制类
*/
@Controller("Admin")
@RequestMapping("/admin")
public class Adminontroller {
@Autowired
private PageService pageService;
@Autowired
private RoleService roleService;
@Autowired
private PageRoleService pageRoleService;
@Autowired
private UserRoleService userRoleService;
@Autowired
* @return String<BR>
*/
@RequestMapping(value = "delUser")
@ResponseBody
@Transactional
public String delUser(Long[] ids) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
try {
for (Long id : ids) {
if (id.equals(user.getId())) {
return "DontOP";
}
userService.delUserById(id);
}
return "SUCCESS";
} catch (Exception e) {
logger.error("根据用户id更新用户异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
/**
@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>
* Description: 退出登录 <BR>
* @return String<BR>
*/
}
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);
}
/**
* Method name: updatePassword <BR>
* Description: 更新密码 <BR>
*
* @param password 旧密码