🍅 作者主页:Java李杨勇
🍅 简介:Java领域优质创作者🏆、【java李杨勇】公号作者✌ 简历模板、学习资料、面试题库【关注我,都给你】
🍅文末获取源码联系和送书🍅
前言介绍:
漫步校园中,偶尔会看到几只猫,或是晃做在小道上,或是蜷作一团躺在花坛边上,就像是无家可归的可怜的孩子,真叫人心疼!其实,它们就是一些被人遗弃的流浪宠物。 流浪宠物是指无主、长期在野外生存的宠物。与野猫(狗)不同,流浪宠物特指那些曾被人们收养过,后来因为某些原因、被抛弃的宠物。某些原因,可能是因为主人的乔迁,可能是经济跟不上,也可能只是主人不喜欢了,就遗弃了。事实上,在全国社会各地,还有许许多多同他们一样遭遇被遗弃的命运的可怜的猫儿狗儿。 校园里的这些猫儿,算是比较幸运的,因为经常有好心的同学会给它们喂一些吃的,它们还不至于饿死。另外的那些流浪宠物,不仅失去了温暖的家,失去了主人的关爱,就连基本的餐饷都成了问题。
在现在猫狗等小动物自被驯化以来,作为人类的伙伴,他们也有自己的理智与情感,我们应该给予充分的尊重和关怀。但是随着社会经济的发展,猫狗等小动物数量日益增多、部分人们的嫌弃和遗弃,流浪动物越来越多。这就需要社会机构或者热心人士关怀和救助这些流浪动物。在社会网络化的背景下,推进人与动物和谐共处符合时代特点。而我们开发一个自愿救助流浪动物网站能够为一些机构和爱心人士提供平台,让小宠物们能更好的找到主人使它们也更容易的生存下去。同时,也可以为一些不愿意继续养宠物的主人提供转让服务。提高人们的动物保护意识,动物也是大自然的一员人们应该保护它们,倡导爱护动物的社会风气,促进人与动物更和谐的相处。因此,本课题的研究符合时代现状,将为营造一个人与自然动物生命体和谐共处的良好社会环境走出一小步。
技术工具:
开发工具:IDEA 2021.3、navicat for mysql 、postman。
开发语言:java、jdk1.8、mysql5。
硬件环境:Windows 10操作系统、Google浏览器等。
主要技术:springboot、mybatis-plus、layui、mysql等
模块设计:
1.用户模块管理:用户登录、用户注册、用户的查询、删除操作、
2.流浪动物首页管理:首页列表的展示、添加、修改、删除操作、
3.流浪动物信息详情管理:流浪动物信息详情列表的查看、添加、删除等操作、
4.管理员信息管理:管理员信息的查看、修改、
5.公告信息管理:公告信息的查看、添加、修改、删除操作、
6.用户模块管理:用户列表查询、添加、删除、、
7.用户评论模块管理:用户评论查询、添加、删除、
8.注销退出登录管理
系统架构:
功能截图:
用户登录注册:
 前端首页:

分类查看:

详情查看:

评论回复信息:这里用户头像替换成自己本地路径即可显示

收藏领养管理:

我的个人信息:

我的领养收藏:

发布流浪交流信息:

我的发布:
后端管理:

后端首页:

用户管理:

类型管理:
详情管理:

评论回复管理:

通知公告等:

代码实现:
用户登录:
/**
 * 根路径以及其他请求处理
 * 
 * @author admin
 *
 */
@Controller
public class IndexController {
  @Value("${imageFilePath}")
  private String imageFilePath; // 文件路径
  @Resource
  private NoticeService noticeService;
  @Resource
  private UserService userService;
  @Resource
  private ArticleService articleService;
  @Resource
  private ClassifyService classifyService;
  @RequestMapping("/")
  public String index(HttpSession session) {
    // 查询公告
    session.setAttribute("noticeList", noticeService.list(0, 5));
    return "index";// 跳转到index.html
  }
  /**
   * 登录页面
   * 
   * @return
   */
  @RequestMapping("/login")
  public String login() {
    return "login";
  }
  /**
   * 前台登录页面
   * 
   * @return
   */
  @RequestMapping("/webLogin")
  public String webLogin() {
    return "webLogin";
  }
  /**
   * 注册
   * 
   * @return
   */
  @RequestMapping("/regist")
  public String regist() {
    return "regist";
  }
  /**
   * 保存注册信息
   * 
   * @param user
   * @return
   */
  @RequestMapping("/saveUser")
  public String saveUser(User user) {
//    List<Article> randomArticle = articleService.getRandomArticle(3);
//    String ids="";
//    for (int i = 0; i < randomArticle.size(); i++) {
//      Integer articleId = randomArticle.get(i).getArticleId();
//      ids+=articleId+",";
//    }
//    ids = ids.substring(0, ids.length() -1);
//    user.setArticleIds(ids);
    user.setRegistrationDate(new Date());
    userService.save(user);
    return "webLogin";
  }
  /**
   * 退出登录
   * 
   * @param request
   * @return
   */
  @RequestMapping("/quit")
  public String quit(HttpServletRequest request) {
    HttpSession session = request.getSession();
    session.removeAttribute("user");
    return "index";
  }
  /**
   * 退出登录
   * 
   * @param request
   * @return
   */
  @RequestMapping("/quitAdmin")
  public String quitAdmin(HttpServletRequest request) {
    HttpSession session = request.getSession();
    session.removeAttribute("user");
    return "login";
  }
  /**
   * 验证登录
   * 
   * @param user
   * @param request
   * @return
   */
  @RequestMapping("/checkLogin")
  public ModelAndView checkLogin(User user, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    HttpSession session = request.getSession();
    User u = userService.findByUsernameAndPassword(user.getUsername(), user.getPassword());
    if (u == null) {
      mav.addObject("user", user);
      mav.addObject("errorInfo", "用户名或者密码错误!");
      mav.setViewName("webLogin");
    } else {
      u.setLatelyLoginTime(new Date());
      userService.save(u);
      session.setAttribute("user", u);
      mav.addObject("username", u.getUsername());
      mav.addObject("user", u);
      mav.addObject("success", true);
      mav.setViewName("/index");
    }
    return mav;
  }
  /**
   * 查看个人信息
   * 
   * @return
   */
  @RequestMapping("viewPerson")
  public ModelAndView viewPerson(HttpServletRequest request) {
    User user = (User) request.getSession().getAttribute("user");
    ModelAndView mav = new ModelAndView();
    User u = userService.findById(user.getUserId());
    mav.addObject("user", u);
    mav.setViewName("/viewPerson");
    return mav;
  }
  /**
   * 查看个人收藏夹
   * 
   * @return
   */
  @RequestMapping("viewCollection")
  public ModelAndView viewCollection(HttpServletRequest request, HttpSession session) {
    User user = (User) request.getSession().getAttribute("user");
    ModelAndView mav = new ModelAndView();
    User u = userService.findById(user.getUserId());
    String artIds = u.getArticleIds();
    List<String> result = new ArrayList<>();
    if (StringUtils.isNotBlank(artIds)) {
      result = Arrays.asList(StringUtils.split(artIds, ","));
    }
    List<Integer> retIds = new ArrayList<>();
    for (String temp : result) {
      retIds.add(Integer.valueOf(temp).intValue());
    }
    List<Article> retArt = articleService.findByListId(retIds);
    session.setAttribute("noticeList", noticeService.list(0, 5));
    mav.addObject("retArt", retArt);
    mav.addObject("user", u);
    mav.setViewName("/viewCollection");
    return mav;
  }
  /**
   * 查看个人关注用户
   * 
   * @return
   */
  @RequestMapping("viewFocusUser")
  public ModelAndView viewFocusUser(HttpServletRequest request, HttpSession session) {
    User user = (User) request.getSession().getAttribute("user");
    ModelAndView mav = new ModelAndView();
    User u = userService.findById(user.getUserId());
    String userIds = u.getUserIds();
    List<String> result = new ArrayList<>();
    if (StringUtils.isNotBlank(userIds)) {
      result = Arrays.asList(StringUtils.split(userIds, ","));
    }
    List<Integer> retIds = new ArrayList<>();
    for (String temp : result) {
      retIds.add(Integer.valueOf(temp).intValue());
    }
    List<User> retArt = userService.findByListId(retIds);
    session.setAttribute("noticeList", noticeService.list(0, 5));
    mav.addObject("retArt", retArt);
    mav.addObject("user", u);
    mav.setViewName("/viewFocusUser");
    return mav;
  }
  /**
   * 保存用户信息
   * 
   * @param user
   * @return
   */
  @RequestMapping("/save")
  public ModelAndView save(User user) {
    ModelAndView mav = new ModelAndView();
    userService.save(user);
    mav.setViewName("/index");
    return mav;
  }
  /**
   * 流浪动物信息发布页面
   * 
   * @param request
   * @return
   */
  // @RequestMapping("notePage")
  // public String notePage(HttpServletRequest request, Model model) {
  // User user = (User) request.getSession().getAttribute("user");
  // if (user == null) {
  // return "webLogin";
  // }
  // List<Classify> list = classifyService.findAll();
  // model.addAttribute("list", list);
  // return "one";
  // }
  @RequestMapping("notePage")
  public ModelAndView notePage(HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    User user = (User) request.getSession().getAttribute("user");
    if (user == null) {
      mav.setViewName("/webLogin");
      return mav;
    }
    List<Classify> list = classifyService.findAll();
    mav.addObject("list", list);
    mav.setViewName("/one");
    return mav;
  }
  /**
   * 保存笔记
   * 
   * @param article
   * @param request
   * @return
   */
  @RequestMapping("addNote")
  public ModelAndView addNote(Article article, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    // 获取当前用户信息
    User user = (User) request.getSession().getAttribute("user");
    article.setUserId(user.getUserId());
    article.setPublishDate(new Date());
    article.setClick(0);
    article.setCommentNum(0);
    article.setContentNoTag(StringUtil.Html2Text(article.getContent()));
    articleService.save(article);
    mav.setViewName("/index");
    return mav;
  }
  @RequestMapping("saveNote")
  public ModelAndView saveNote(Article article, HttpServletRequest request) {
    ModelAndView mav = new ModelAndView();
    Article a = articleService.findById(article.getArticleId());
    article.setPublishDate(a.getPublishDate());
    // 获取当前用户信息
    articleService.save(article);
    mav.setViewName("/index");
    return mav;
  }
  /**
   * 查看笔记
   * 
   * @return
   */
  @RequestMapping("viewNote")
  public String viewNote(HttpSession session) {
    session.setAttribute("noticeList", noticeService.list(0, 5));
    return "mylist";
  }
  @RequestMapping("/delete/{id}")
  public String delete(@PathVariable(value = "id") String id) throws Exception {
    articleService.delete(Integer.parseInt(id));
    return "mylist";
  }
  /**
   * 查看个人笔记加载数据列表
   * 
   * @param article
   * @param publishDates
   * @param page
   * @param pageSize
   * @return
   */
  @RequestMapping("/mylist")
  public Map<String, Object> list(Article article,
      @RequestParam(value = "publishDates", required = false) String publishDates,
      @RequestParam(value = "page", required = false) Integer page,
      @RequestParam(value = "pageSize", required = false) Integer pageSize, HttpServletRequest request) {
    Map<String, Object> resultMap = new HashMap<String, Object>();
    // User user = (User) request.getSession().getAttribute("user");
    // article.setUserId(user.getUserId());
    String s_bPublishDate = null; // 开始时间
    String s_ePublishDate = null; // 结束时间
    if (StringUtil.isNotEmpty(publishDates)) {
      String[] strs = publishDates.split(" - "); // 拆分时间段
      s_bPublishDate = strs[0];
      s_ePublishDate = strs[1];
    }
    Long total = articleService.getCount(article, s_bPublishDate, s_ePublishDate);
    int totalPage = (int) (total % pageSize == 0 ? total / pageSize : total / pageSize + 1); // 总页数
    resultMap.put("totalPage", totalPage);
    resultMap.put("errorNo", 0);
    resultMap.put("data", articleService.list(article, s_bPublishDate, s_ePublishDate, page - 1, pageSize));
    resultMap.put("total", total);
    return resultMap;
  }
  /**
   * 后台默认首页
   * 
   * @return
   */
  @RequestMapping("/index")
  public String root() {
    return "/common/index";
  }
  /**
   * 博主信息页面
   * 
   * @return
   */
  @RequestMapping("/blogger")
  public String blogger() {
    return "/blogger/index";
  }
  /**
   * 图片上传处理 @Title: ckeditorUpload @param file 图片文件 @return 参数说明 @return
   * Map<String,Object> 返回类型 @throws
   */
  @ResponseBody
  @RequestMapping("/upload")
  public Map<String, Object> ckeditorUpload(@RequestParam("file") MultipartFile file) {
    Map<String, Object> resultMap = new HashMap<String, Object>();
    Map<String, Object> resultMap1 = new HashMap<String, Object>();
    String fileName = file.getOriginalFilename(); // 获取文件名
    String suffixName = fileName.substring(fileName.lastIndexOf(".")); // 获取文件的后缀
    String newFileName = "";
    try {
      newFileName = DateUtil.getCurrentDateStr() + suffixName; // 新文件名
      FileUtils.copyInputStreamToFile(file.getInputStream(), new File(imageFilePath + newFileName)); // 上传
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    resultMap.put("code", 0);
    resultMap1.put("filePath", newFileName);
    resultMap.put("data", resultMap1);
    return resultMap;
  }
}
全局yml:
server: 
  port: 80
  servlet:
    context-path: /
  
spring: 
  datasource: 
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/baby_mobile?characterEncoding=utf8&useSSL=false
    username: root
    password: 123456
  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true
  thymeleaf:
    cache: false
数据库设计:
表t_admin
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 admin_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 head_portrait  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 3  | 
 password  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 phone  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 5  | 
 sex  | 
 varchar  | 
 50  | 
 0  | 
 Y  | 
 N  | 
| 
 6  | 
 signature  | 
 varchar  | 
 500  | 
 0  | 
 Y  | 
 N  | 
| 
 7  | 
 true_name  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 8  | 
 user_name  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
表t_article
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 article_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 author  | 
 varchar  | 
 200  | 
 0  | 
 N  | 
 N  | 
| 
 3  | 
 click  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 comment_num  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 5  | 
 content  | 
 text  | 
 65535  | 
 0  | 
 Y  | 
 N  | 
| 
 6  | 
 image_name  | 
 varchar  | 
 255  | 
 0  | 
 Y  | 
 N  | 
| 
 7  | 
 is_original  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 8  | 
 is_top  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 9  | 
 publish_date  | 
 datetime  | 
 19  | 
 0  | 
 Y  | 
 N  | 
| 
 10  | 
 title  | 
 varchar  | 
 200  | 
 0  | 
 N  | 
 N  | 
| 
 11  | 
 classify_id  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 12  | 
 user_id  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
表t_blogger
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 blogger_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 head_portrait  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 3  | 
 motto  | 
 varchar  | 
 500  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 nick_name  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 5  | 
 site  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 6  | 
 signature  | 
 varchar  | 
 500  | 
 0  | 
 Y  | 
 N  | 
表t_classify
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 classify_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 classify_name  | 
 varchar  | 
 200  | 
 0  | 
 N  | 
 N  | 
表t_comment
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 comment_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 comment_date  | 
 datetime  | 
 19  | 
 0  | 
 Y  | 
 N  | 
| 
 3  | 
 content  | 
 varchar  | 
 500  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 article_id  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 5  | 
 user_id  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
表t_link
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 link_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 link_email  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 3  | 
 link_name  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 link_url  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 5  | 
 order_num  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
表t_notice
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 notice_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 grade  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 3  | 
 content  | 
 varchar  | 
 500  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 publish_date  | 
 datetime  | 
 19  | 
 0  | 
 Y  | 
 N  | 
表t_reply
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 reply_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 content  | 
 varchar  | 
 500  | 
 0  | 
 Y  | 
 N  | 
| 
 3  | 
 reply_date  | 
 datetime  | 
 19  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 comment_id  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
| 
 5  | 
 user_id  | 
 int  | 
 10  | 
 0  | 
 Y  | 
 N  | 
表t_timeline
| 
 编号  | 
 名称  | 
 数据类型  | 
 长度  | 
 小数位  | 
 允许空值  | 
 主键  | 
| 
 1  | 
 timeline_id  | 
 int  | 
 10  | 
 0  | 
 N  | 
 Y  | 
| 
 2  | 
 content  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 3  | 
 publish_date  | 
 datetime  | 
 19  | 
 0  | 
 Y  | 
 N  | 
| 
 4  | 
 month  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
| 
 5  | 
 year  | 
 varchar  | 
 200  | 
 0  | 
 Y  | 
 N  | 
源码获取:
大家点赞、收藏、关注、评论啦 、查看👇🏻👇🏻👇🏻微信公众号获取联系方式👇🏻👇🏻👇🏻
打卡 文章 更新 136/ 365天
精彩专栏推荐订阅:在下方专栏👇🏻👇🏻👇🏻👇🏻
Java项目精品实战案例《100套》
web前端期末大作业网页实战《100套》
🥇 评论区抽粉丝送书啦
💌 欢迎大家在评论区提出意见和建议! (抽三位幸运儿送书,实物图如下)💌

内容简介
本书从Vue.js框架技术的基础概念出发,逐步深入Vue.js进阶实战,并在最后配合一个网站项目和一个后台系统开发实战案例,重点介绍了使用Vue.js+axios+ElementUI+wangEditor进行前端开发和使用组件进行Vue单页面网页复用,让读者不但可以系统地学习Vue.js前端开发框架的相关知识,而且还能对业务逻辑的分析思路、实际应用开发有更为深入的理解。
本书语言平实,用词诙谐,案例丰富,实用性强,特别适合刚入社会的职场新人、Vue.js框架的初级读者和进阶读者阅读,也适合希望从后台开发转型做前端的程序员等其他编程爱好者阅读。另外,本书也适合作为相关培训机构的教材使用。
京东自营购买链接
《Vue.js框架与Web前端开发从入门到精通》(舒志强)【摘要 书评 试读】- 京东图书
当当自营购买链接
《Vue.js框架与Web前端开发从入门到精通》(舒志强)【简介_书评_在线阅读】 - 当当图书
大家点赞关注,三天后也就是 1月13日 从👇🏻👇🏻👇🏻评论区👇🏻👇🏻👇🏻留言的同学中抽取三位送书
如果中奖了联系不上则视为放弃,可以从👇🏻👇🏻👇🏻下方卡片👇🏻👇🏻👇🏻里找到作者的联系方式,每周都会送6~9本书,后面送书力度还会加大,一年送几百上千本不是问题,

