基于javaweb+mysql的ssm+maven流浪猫狗救助宠物领养管理系统(java+ssm+jsp+bootstrap+jquery+mysql)

基于javaweb+mysql的ssm+maven流浪猫狗救助宠物领养管理系统(java+ssm+jsp+bootstrap+jquery+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

PPT:

基于javaweb的SSM+Maven流浪猫狗救助宠物领养管理系统(java+ssm+jsp+bootstrap+jquery+mysql)

项目介绍

流浪猫狗救助管理系统。该项目分为前后台; 前台主要功能包括:会员的注册登陆,流浪猫狗知识,领养中心,团队活动,流浪宠物详情,申请领养等; 后台主要功能包括:管理员的用户信息管理,流浪猫狗信息管理,管理员信息管理,领养管理,评论管理,团队活动管理,志愿者申请信息管理,同意/不同意领养信息列表等

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 8.0版本;

技术栈

  1. 后端:Spring SpringMVC MyBatis 2. 前端:JSP+bootstrap+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 将项目中db.properties配置文件中的数据库配置改为自己的配置 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 4. 运行项目, 前台地址 http://localhost:8080/web/animal/index.jsp 后台地址 http://localhost:8080/web/animal/admin/login.jsp
    public String pet(){
        return "admin/pet";
    }

    @RequestMapping("/user")
    public String user(){
        return "admin/user";
    }

    /*管理员登录*/
    @RequestMapping("/login")
    public String login(){
        return "admin/login";
    }

    @RequestMapping("/dologin")
    public String doLogin(HttpSession session, String adminName,String adminPwd){
        Admins login = adminService.login(adminName, adminPwd);
        if (login == null){
            session.setAttribute("msg","用户名或密码错误!");
            return "redirect:/admin/login";
        }
            session.setAttribute("admin",login);
        return "redirect:/admin/admin";
    }

    @RequestMapping("/logout")
    public String logout(HttpSession session){
        session.invalidate();
        return "redirect:/admin/login";
    }

    @RequestMapping("/developing")
    public String developing(){
        return "admin/developing";
    }

}


@Controller
@RequestMapping("/comment")
public class CommentController {

    @Resource
    private CommentService commentService;

    @Resource
    private AnswerService answerService;

    @Resource
    private UserService userService;

    @RequestMapping("/comments")
    @ResponseBody
    public Message comments(@RequestParam(required = false) String userName, Integer pn){
        Integer pageSize = 5;
        PageInfo<Comment> pageInfo = commentService.allComment(userName, pn, pageSize);
        return Message.success().add("pageInfo", pageInfo);
    }

    @RequestMapping("/petComments")
    @ResponseBody
    public Message petComments(Integer petId){
        List<Comment> comments = commentService.petComments(petId);
        for (Comment comment : comments){
            List<Answer> answers = answerService.answersAboutOneComment(comment.getId());
            comment.setAnswer(answers);
        return "user/teamBlog";
    }

    @RequestMapping("/update")
    @ResponseBody
    public Message update(User user){
        Integer update = userService.update(user);
        if(update > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }

    @RequestMapping("/updatePic")
    @ResponseBody
    public Message updatePic(HttpSession session, MultipartFile file){
        String fileName = FileLoad.uploadUserPic(file);
        User user = (User) session.getAttribute("user");
        user.setPic(fileName);
        Integer update = userService.update(user);
        if (update > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }
}

@Controller
@RequestMapping("/comment")
public class CommentController {

    }

    @RequestMapping("/agree")
    public String agree(){
        return "admin/agree";
    }

    @RequestMapping("/apply")
    public String apply(){
        return "admin/apply";
    }

    @RequestMapping("/blog")
    public String blog(){
        return "admin/blog";
    }

    @RequestMapping("/comment")
    public String comment(){
        return "admin/comment";
    }

    @RequestMapping("/disAgree")
    public String disAgree(){
        return "admin/disAgree";
    }

    @RequestMapping("/pet")
    public String pet(){
        return "admin/pet";
    }

    @RequestMapping("/user")
    public String user(){
        return "admin/user";
    }

    /*管理员登录*/
    @RequestMapping("/login")
    public String login(){
        return "admin/login";
    }

        pet.setPic(pic);
        int add = petService.add(pet);
        if(add>0){
            return Message.success();
        }else{
            return Message.fail();
        }

    }

    @RequestMapping("/update")
    @ResponseBody
    public Message update(Pet pet, MultipartFile file){
        if (file != null && file.getSize() > 0){
            String pic = FileLoad.uploadPetPic(file);
            pet.setPic(pic);
        }
        int update = petService.update(pet);
        if(update>0){
           return Message.success();
        }else{
            return Message.fail();
        }
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Message del(Integer id){
        int del = petService.del(id);
        if(del>0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }

}

        }
        return Message.fail();
    }

    @RequestMapping("/agree")
    @ResponseBody
    public Message agree(Integer id){
        System.out.println(id);
        int update = adoptAnimalService.update(id, 2);
        if(update>0){
            return Message.success();
        }
        return Message.fail();
    }
}

@Controller
@RequestMapping("/pet")
public class PetController {

    @Resource
    private PetService petService;

    @RequestMapping("/pets")
    @ResponseBody
    public Message pet(@RequestParam(required = false) String petType, @RequestParam("pn")Integer pageNum){
        Integer pageSize = 3;
        if(pageNum == null){
            pageNum = 1;
        }
        String pics = pet.getPic();
        session.setAttribute("pet", pet);
        session.setAttribute("pics", pics);
        return Message.success().add("pet", pet);
    }

    @RequestMapping("/create")
    @ResponseBody
    public Message add(Pet pet, MultipartFile file){
        String pic = FileLoad.uploadPetPic(file);
        pet.setPic(pic);
        int add = petService.add(pet);
        if(add>0){
            return Message.success();
        }else{
            return Message.fail();
        }

    }

    @RequestMapping("/update")
    @ResponseBody
    public Message update(Pet pet, MultipartFile file){
        if (file != null && file.getSize() > 0){
            String pic = FileLoad.uploadPetPic(file);
            pet.setPic(pic);
        }
        int update = petService.update(pet);
        if(update>0){
           return Message.success();
        }else{
            return Message.fail();
        }
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Message del(Integer id){
        int del = petService.del(id);
        if(del>0){
            return Message.success();
        }else {
            return Message.fail();
        }

@Controller
@RequestMapping("/adopt")
public class AdoptAnimalController {
    @Resource
    private AdoptAnimalService adoptAnimalService;

    @RequestMapping("/apply")
    @ResponseBody
    public Message agree(String userName,@RequestParam("pn") Integer pageNum,Integer state){
        Integer pageSize = 5;
        if(pageNum == 0){
            pageNum = 1;
        }
        PageInfo<AdoptAnimal> pageInfo = adoptAnimalService.allAdoptAnimal(userName, pageNum, pageSize, state);
        return Message.success().add("pageInfo",pageInfo);
    }

    @RequestMapping("/create")
    @ResponseBody
    public Message create(HttpSession session){
        User user = (User) session.getAttribute("user");
        Pet pet = (Pet) session.getAttribute("pet");
        pet.setState(1);
        AdoptAnimal adoptAnimal = new AdoptAnimal();
        adoptAnimal.setUserId(user.getId());
        adoptAnimal.setPetId(pet.getId());
        adoptAnimal.setAdoptTime(new Date());
        adoptAnimal.setState(1);
        adoptAnimalService.create(adoptAnimal);
        return Message.success();
    }

    @RequestMapping("/adopts")
    @ResponseBody
    public Message adopts(@RequestParam(required = false) String adoptTime,@RequestParam(required = false,value = "pn") Integer pageNum){
        int pageSize = 3 ;
        if(pageNum == null){
            pageNum = 1;
        }
        PageInfo<AdoptAnimal> pageInfo = adoptAnimalService.all(adoptTime, pageNum, pageSize);
        return Message.success().add("pageInfo",pageInfo);
    }

    @RequestMapping("/disAgree")
    @ResponseBody

@Controller
@RequestMapping("/pet")
public class PetController {

    @Resource
    private PetService petService;

    @RequestMapping("/pets")
    @ResponseBody
    public Message pet(@RequestParam(required = false) String petType, @RequestParam("pn")Integer pageNum){
        Integer pageSize = 3;
        if(pageNum == null){
            pageNum = 1;
        }
        PageInfo<Pet> pets = petService.allPet(petType, pageNum, pageSize);
        return Message.success().add("pageInfo",pets );
    }

    @RequestMapping("/findById")
    @ResponseBody
    public Message findPetById(HttpSession session, Integer id){
        Pet pet = petService.findById(id);
        String pics = pet.getPic();
        session.setAttribute("pet", pet);
        session.setAttribute("pics", pics);
        return Message.success().add("pet", pet);
    }

    @RequestMapping("/create")
    @ResponseBody
    public Message add(Pet pet, MultipartFile file){
        String pic = FileLoad.uploadPetPic(file);
        pet.setPic(pic);
        int add = petService.add(pet);
        if(add>0){
            return Message.success();
        if(i > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }

    @RequestMapping("/findById")
    @ResponseBody
    public Message findById(Integer id){
        Blog blog = blogService.findById(id);
        return Message.success().add("blog", blog);
    }
}

@Controller
@RequestMapping("/answer")
public class AnswerController {

    @Resource
    private AnswerService answerService;

    @RequestMapping("/create")
    @ResponseBody
    public Message create(HttpSession session, Integer commentId, String content){
        User user = (User) session.getAttribute("user");
        Integer integer = answerService.create(user.getId(), commentId, content);
        if (integer > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }

    @RequestMapping("/findById")
            return Message.fail();
        }
    }

    @RequestMapping("/updatePic")
    @ResponseBody
    public Message updatePic(HttpSession session, MultipartFile file){
        String fileName = FileLoad.uploadUserPic(file);
        User user = (User) session.getAttribute("user");
        user.setPic(fileName);
        Integer update = userService.update(user);
        if (update > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }
}

@Controller
@RequestMapping("/comment")
public class CommentController {

    @Resource
    private CommentService commentService;

    @Resource
    private AnswerService answerService;

    @Resource
    private UserService userService;

    @RequestMapping("/comments")
    @ResponseBody
    public Message create(Apply apply){
        apply.setApplyTime(new Date());
        apply.setState(2);
        Integer integer = applyService.create(apply);
        if(integer > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }
}

@Controller
@RequestMapping("/blog")
public class BlogController {
    @Resource
    private BlogService blogService;
    @RequestMapping("/blogs")
    @ResponseBody
    public Message blogs(String actionTime, @RequestParam("pn") Integer pageNum){
        if(pageNum == null){
            pageNum = 1;
        }
        System.out.println(actionTime);
        PageInfo<Blog> allBlog = blogService.findAllBlog(actionTime, pageNum, 3);
        return Message.success().add("pageInfo",allBlog);
    }
    @RequestMapping("/create")
    @ResponseBody
    public Message creat(Blog blog){
        int i = blogService.add(blog);
        if(i > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
@Controller
@RequestMapping("/blog")
public class BlogController {
    @Resource
    private BlogService blogService;
    @RequestMapping("/blogs")
    @ResponseBody
    public Message blogs(String actionTime, @RequestParam("pn") Integer pageNum){
        if(pageNum == null){
            pageNum = 1;
        }
        System.out.println(actionTime);
        PageInfo<Blog> allBlog = blogService.findAllBlog(actionTime, pageNum, 3);
        return Message.success().add("pageInfo",allBlog);
    }
    @RequestMapping("/create")
    @ResponseBody
    public Message creat(Blog blog){
        int i = blogService.add(blog);
        if(i > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }
    @RequestMapping("/update")
    @ResponseBody
    public Message update(Blog blog){
        int i = blogService.updateBlog(blog);
        if(i > 0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }
    @RequestMapping("/delete")
    @ResponseBody
    public Message delete(Integer id){
        int i = blogService.del(id);
        if(i > 0){
            return Message.success();
        }else {

    @RequestMapping("/findById")
    @ResponseBody
    public Message findPetById(HttpSession session, Integer id){
        Pet pet = petService.findById(id);
        String pics = pet.getPic();
        session.setAttribute("pet", pet);
        session.setAttribute("pics", pics);
        return Message.success().add("pet", pet);
    }

    @RequestMapping("/create")
    @ResponseBody
    public Message add(Pet pet, MultipartFile file){
        String pic = FileLoad.uploadPetPic(file);
        pet.setPic(pic);
        int add = petService.add(pet);
        if(add>0){
            return Message.success();
        }else{
            return Message.fail();
        }

    }

    @RequestMapping("/update")
    @ResponseBody
    public Message update(Pet pet, MultipartFile file){
        if (file != null && file.getSize() > 0){
            String pic = FileLoad.uploadPetPic(file);
            pet.setPic(pic);
        }
        int update = petService.update(pet);
        if(update>0){
           return Message.success();
        }else{
            return Message.fail();
        }
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Message del(Integer id){
        int del = petService.del(id);
        if(del>0){

@Controller
@RequestMapping("/comment")
public class CommentController {

    @Resource
    private CommentService commentService;

    @Resource
    private AnswerService answerService;

    @Resource
    private UserService userService;

    @RequestMapping("/comments")
    @ResponseBody
    public Message comments(@RequestParam(required = false) String userName, Integer pn){
        Integer pageSize = 5;
        PageInfo<Comment> pageInfo = commentService.allComment(userName, pn, pageSize);
        return Message.success().add("pageInfo", pageInfo);
    }

    @RequestMapping("/petComments")
    @ResponseBody
    public Message petComments(Integer petId){
        List<Comment> comments = commentService.petComments(petId);
        for (Comment comment : comments){
            List<Answer> answers = answerService.answersAboutOneComment(comment.getId());
            comment.setAnswer(answers);
            User user = userService.findById(comment.getUserId());
            comment.setUser(user);
        }
        return Message.success().add("comment", comments);
    }

    @RequestMapping("/create")
    @ResponseBody
    public Message create(HttpSession session, String content){
        User user = (User) session.getAttribute("user");
    @RequestMapping("/pets")
    @ResponseBody
    public Message pet(@RequestParam(required = false) String petType, @RequestParam("pn")Integer pageNum){
        Integer pageSize = 3;
        if(pageNum == null){
            pageNum = 1;
        }
        PageInfo<Pet> pets = petService.allPet(petType, pageNum, pageSize);
        return Message.success().add("pageInfo",pets );
    }

    @RequestMapping("/findById")
    @ResponseBody
    public Message findPetById(HttpSession session, Integer id){
        Pet pet = petService.findById(id);
        String pics = pet.getPic();
        session.setAttribute("pet", pet);
        session.setAttribute("pics", pics);
        return Message.success().add("pet", pet);
    }

    @RequestMapping("/create")
    @ResponseBody
    public Message add(Pet pet, MultipartFile file){
        String pic = FileLoad.uploadPetPic(file);
        pet.setPic(pic);
        int add = petService.add(pet);
        if(add>0){
            return Message.success();
        }else{
            return Message.fail();
        }

    }

    @RequestMapping("/update")
    @ResponseBody
    public Message update(Pet pet, MultipartFile file){
        if (file != null && file.getSize() > 0){
            String pic = FileLoad.uploadPetPic(file);
            pet.setPic(pic);
        }
        int update = petService.update(pet);
        if(update>0){
           return Message.success();
        }else{
            return Message.fail();
        }
    }


    @RequestMapping("/create")
    @ResponseBody
    public Message add(Admins admins, MultipartFile file){
        String pic = FileLoad.uploadAdminPic(file);
        admins.setPic(pic);
        int add = adminService.add(admins);
        if(add>0){
            return Message.success();
        }else{
            return Message.fail();
        }
    }

    @RequestMapping("findById")
    @ResponseBody
    public Message findById(Integer id){
        Admins byId = adminService.findById(id);
        return Message.success().add("admin",byId);
    }

    @RequestMapping("/update")
    @ResponseBody
    public Message update(Admins admins, MultipartFile file){
        if (file != null && file.getSize() > 0){
            String pic = FileLoad.uploadAdminPic(file);
            admins.setPic(pic);
        }
        int update = adminService.update(admins);
        if(update>0){
            return  Message.success();
        }else {
            return Message.fail();
        }
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Message del(Integer id){
        int del = adminService.del(id);
        if(del>0){
            return Message.success();
        }else {
            return Message.fail();
        }
    }

@Controller
@RequestMapping("/apply")
public class ApplyController {
    @Resource
    private ApplyService applyService;

    @RequestMapping("/applys")
    @ResponseBody
    public Message apply(@RequestParam(required = false)Integer state, @RequestParam("pn") Integer pageNum){
        Integer pageSize = 3;
        if(pageNum == 0){
            pageNum = 1;
        }
        PageInfo<Apply> apply = applyService.allApply(state,pageNum,pageSize);
        return Message.success().add("pageInfo",apply);
    }

    @RequestMapping("/findById")
    @ResponseBody
    public Message findByid(Integer id){
        Apply byid = applyService.findByid(id);
        return Message.success().add("apply",byid);
    }
    @RequestMapping("/update")
    @ResponseBody
    public Message update(Apply apply){
        int i = applyService.updateApply(apply);
        if(i > 0){
            return Message.success();
        }
            return Message.fail();
    }
    @RequestMapping("/delete")
    @ResponseBody
    public Message delete(Integer id){
        int i = applyService.del(id);
        if(i > 0){
            return Message.success();
        }else {

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值