当前位置:   article > 正文

基于javaweb+jsp的宠物医院管理系统设计和实现(java+Springboot+ssm+mysql+jsp+maven)_基于jsp的宠物诊所管理系统的设计与实现

基于jsp的宠物诊所管理系统的设计与实现

基于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: userAddPage <BR>
	 * Description: 用户添加页面 <BR>
	 * 
	 * @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() {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
	public String userPage() {
		return "sa/userList";
	}
	/**
	 * Method name: getAllUserByLimit <BR>
	 * Description: 根据条件获取所有用户 <BR>
	 * 
	 * @param userParameter
	 * @return Object<BR>
	 */
	@RequestMapping("/getAllUserByLimit")
	@ResponseBody
	public Object getAllUserByLimit(UserParameter userParameter) {
		return userService.getAllUserByLimit(userParameter);
	}
	/**
	 * Method name: getAllDelUserByLimit <BR>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
	 */
	@RequestMapping(value = "/")
	public String index(Model model) {
		Subject subject = SecurityUtils.getSubject();
		User user = (User) subject.getPrincipal();
		if (null != user) {
			model.addAttribute("user", user);
			List<Page> pageList = pageService.getAllRolePageByUserId(user.getId()+"");
			model.addAttribute("pageList", pageList);
			return "index";
		} else {
			return "login";
		}
	}
	/**
	 * Method name: main <BR>
	 * Description: 进入主页面 <BR>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
 */
@Controller("Admin")
@RequestMapping("/admin")
public class Adminontroller {
	@Autowired
	private PageService pageService;
	@Autowired
	private RoleService roleService;
	@Autowired
	private PageRoleService pageRoleService;
	@Autowired
	private UserRoleService userRoleService;
	@Autowired
	private UserService userService;
	private final Logger logger = LoggerFactory.getLogger(Adminontroller.class);
	/**
	 * Method name: page <BR>
	 * Description: 跳转到页面设置页面 <BR>
	 * 
	 * @param model
	 * @return String<BR>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
	 * 
	 * @param name
	 * @return String<BR>
	 */
	@RequestMapping("/addRole")
	@ResponseBody
	public String addRole(String name) {
		return roleService.addRole(name);
	}
	/**
	 * Method name: delManageRole <BR>
	 * Description: 根据角色id删除角色 <BR>
	 * 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
	 * Description: 获取所有权限 <BR>
	 * 
	 * @return List<Role><BR>
	 */
	@RequestMapping("/getAllRole")
	@ResponseBody
	public List<Role> getAllRole() {
		return roleService.getAllRole();
	}
	/**
	 * Method name: getAllPage <BR>
	 * Description: 获取所有页面 <BR>
	 * 
	 * @return List<Page><BR>
	 */
	@RequestMapping("/getAllPage")
	@ResponseBody
	public List<Page> getAllPage() {
		return pageService.getAllPage();
	}
	/**
	 * Method name: getPageByRole <BR>
	 * Description: 获取某个角色的权限页面 <BR>
	 */
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
	@ResponseBody
	public ResultMap updatePageById(Page page) {
		return pageService.updatePageById(page);
	}
	/**
	 * Method name: addPage <BR>
	 * Description: 添加页面 <BR>
	 * 
	 * @param page
	 * @return Page<BR>
	 */
	@RequestMapping("/addPage")
	@ResponseBody
	public Page addPage(Page page) {
		return pageService.addPage(page);
	}
	/**
	 * Method name: delPageById <BR>
	 * Description: 根据页面id删除页面 <BR>
	 * 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
	@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")
	@ResponseBody
	public Page addPage(Page page) {
		return pageService.addPage(page);
	}
	/**
	 * Method name: delPageById <BR>
	 * Description: 根据页面id删除页面 <BR>
	 * 
	 * @param id
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
		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() {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
	}
	/**
	 * 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>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
登录控制类:
/**
 * 登录控制类
 */
@Controller("OpenLogin")
@RequestMapping()
public class LoginController {
	@Autowired
	private ResultMap resultMap;
	@Autowired
	private UserService userService;
	@Autowired
	private PageService pageService;
	@Autowired
	private UserRoleService userRoleService;
	private final Logger logger = LoggerFactory.getLogger(LoginController.class);
	/**
	 * 返回 尚未登陆信息
	 */
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
	 * Method name: userAddPage <BR>
	 * Description: 用户添加页面 <BR>
	 * 
	 * @return String<BR>
	 */
	@RequestMapping(value = "/userAddPage")
	public String userAddPage() {
		return "sa/userAdd";
	}
	/**
	 * Method name: userPage <BR>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
		} catch (Exception e) {
			logger.error("根据用户id更新用户异常", e);
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
			return "ERROR";
		}
	}
	/**
	 * 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>
	 * Description: 检测用户账号是否存在 <BR>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
	public String addRole(String name) {
		return roleService.addRole(name);
	}
	/**
	 * Method name: delManageRole <BR>
	 * Description: 根据角色id删除角色 <BR>
	 * 
	 * @param id
	 * @return String<BR>
	 */
	@RequestMapping("/delRole")
	@ResponseBody
	public String delRole(int id) {
		// 删除角色
		boolean flag1 = roleService.delRoleById(id);
		// 删除角色_权限表
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
@Controller("OpenLogin")
@RequestMapping()
public class LoginController {
	@Autowired
	private ResultMap resultMap;
	@Autowired
	private UserService userService;
	@Autowired
	private PageService pageService;
	@Autowired
	private UserRoleService userRoleService;
	private final Logger logger = LoggerFactory.getLogger(LoginController.class);
	/**
	 * 返回 尚未登陆信息
	 */
	@RequestMapping(value = "/notLogin", method = RequestMethod.GET)
	@ResponseBody
	public ResultMap notLogin() {
		logger.warn("尚未登陆!");
		return resultMap.success().message("您尚未登陆!");
	}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
	public String userPage() {
		return "sa/userList";
	}
	/**
	 * Method name: getAllUserByLimit <BR>
	 * Description: 根据条件获取所有用户 <BR>
	 * 
	 * @param userParameter
	 * @return Object<BR>
	 */
	@RequestMapping("/getAllUserByLimit")
	@ResponseBody
	public Object getAllUserByLimit(UserParameter userParameter) {
		return userService.getAllUserByLimit(userParameter);
	}
	/**
	 * Method name: getAllDelUserByLimit <BR>
	 * Description: 获取所有删除用户 <BR>
	 * 
	 * @param userParameter
	 * @return Object<BR>
	 */
	@RequestMapping("/getAllDelUserByLimit")
	@ResponseBody
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
	}
/**演示页面**/
	@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)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
        }
        return "user/userEdit";
    }
    /**
     * 更新数据库
     */
    @ResponseBody
    @RequestMapping("/updateUser")
    public String updateUser(User user) {
        return userService.updateUser(user);
    }
}
管理员权限控制类:
/**
 * 管理员权限控制类
 */
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
	}
	@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() {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
	 * 返回 尚未登陆信息
	 */
	@RequestMapping(value = "/notLogin", method = RequestMethod.GET)
	@ResponseBody
	public ResultMap notLogin() {
		logger.warn("尚未登陆!");
		return resultMap.success().message("您尚未登陆!");
	}
	/**
	 * 返回 没有权限
	 */
	@RequestMapping(value = "/notRole", method = RequestMethod.GET)
	@ResponseBody
	public ResultMap notRole() {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
		}
		return resultMap.success().message("您没有权限!");
	}
/**演示页面**/
	@RequestMapping(value = "/demo/table", method = RequestMethod.GET)
	public String demoTable() {
		return "table";
	}
	@RequestMapping(value = "/demo/tu", method = RequestMethod.GET)
	public String demoTu() {
		return "tu";
	}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
	 */
	@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;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
		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();
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
	 */
	@RequestMapping("/addPageRoleByRoleId")
	@ResponseBody
	public String addPageRoleByRoleId(Integer roleId, Integer[] pageIds) {
		if (null == roleId) {
			return "ERROR";
		}
		// 先删除老的权限
		boolean flag1 = pageRoleService.delPageRoleByRoleId(roleId);
		boolean flag2 = pageRoleService.addPageRoles(roleId, pageIds);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
	/**
	 * Method name: getAllRole <BR>
	 * Description: 获取所有权限 <BR>
	 * 
	 * @return List<Role><BR>
	 */
	@RequestMapping("/getAllRole")
	@ResponseBody
	public List<Role> getAllRole() {
		return roleService.getAllRole();
	}
	/**
	 * Method name: getAllPage <BR>
	 * Description: 获取所有页面 <BR>
	 * 
	 * @return List<Page><BR>
	 */
	@RequestMapping("/getAllPage")
	@ResponseBody
	public List<Page> getAllPage() {
		return pageService.getAllPage();
	}
	/**
	 * Method name: getPageByRole <BR>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
		return userService.updateUser(oldId, user);
	}
	/**
	 * Method name: delUserPage <BR>
	 * Description: 已删除用户列表 <BR>
	 * 
	 * @return String<BR>
	 */
	@RequestMapping("/delUserPage")
	public String delUserPage() {
		return "sa/userDelPage";
	}
}
登录控制类:
/**
 * 登录控制类
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
	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";
	}
	/**
	 * 注册页面 regist.html
	 */
	@RequestMapping(value = "/regist")
	public String regist() {
		return "regist";
	}
	/**
	 * 注册
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
		List<Page> pageList = pageService.getAllPage();
		model.addAttribute("pageList", pageList);
		return "sa/page";
	}
	/**
	 * Method name: role <BR>
	 * Description: 跳转到角色设置页面 <BR>
	 * 
	 * @param model
	 * @return String<BR>
	 */
	@RequestMapping("/role")
	public String role(Model model) {
		return "sa/role";
	}
	/**
	 * Method name: getAllRole <BR>
	 * Description: 获取所有权限 <BR>
	 * 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
	 * Description: 根据角色查询下面所有的人员/非角色下所有人员 <BR>
	 */
	@RequestMapping("/getAllUserByRoleId")
	@ResponseBody
	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) {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/376792
推荐阅读
相关标签
  

闽ICP备14008679号