——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明





基于javaweb的SpringBoot流浪猫救助系统(java+springboot+ssm+mysql+maven+thymeleaf+html)
一、项目简述
本系统功能包括:springboot+springmvc+mybatis的流浪 猫救助系统,后台分为普通用户可管理员用,包括注册, 登录,流浪猫发布,评论,分享,后台管理,用户管理, 热门文章赞助等等功能,非常不错,可以以参考二次开发 学习使用。
二、项目运行
环境配置: Jdk1.8 + Mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +SpringBoot + MyBatis + Json+ Css + JavaScript + JQuery + Ajax + PageHelper+ Maven等等。
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| @GetMapping("interceptor/writeShare") public String write(Model model, HttpSession session, @RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int limit){ model.addAttribute("status",0); User user = (User) session.getAttribute(CatConst.USER_SESSION_KEY); model.addAttribute("info",shareService.findPageShare(page,limit)); return "share_writing"; }
@GetMapping("interceptor/writeShareStatus") public String status(@RequestParam("status") int status, Model model,HttpSession session){ model.addAttribute("status",status); if(status==0){ return "redirect:/share/interceptor/writeShare"; }else { return "share_writing"; } }
@PostMapping("interceptor/writeShare") @ResponseBody public JsonResult writeShare(Share share, HttpSession session){ User user= (User) session.getAttribute(CatConst.USER_SESSION_KEY); share.setSharePhone(user.getUserPhone()); share.setShareCreatetime(new Date());
int i=shareService.addShare(share); if(i==1){ return new JsonResult(true,"分享成功!"); }else { return new JsonResult(false, "分享失败!"); } }
@GetMapping("interceptor/deleteShare") public String deletePost(@RequestParam("shareId") int shareId){ shareService.deleteShare(shareId); return "redirect:/share/interceptor/writeShare"; }
@GetMapping("interceptor/updateShare") public String updateShare(@RequestParam("shareId") int shareId,Model model){ Share share=shareService.queryShareById(shareId); System.out.println(share); model.addAttribute("share",share); model.addAttribute("status",1); return "share_writing"; }
@PostMapping("interceptor/updateShare") @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 25 26 27 28 29
|
@Controller @RequestMapping("sponsor") public class sponsorController { @Autowired SponsorService sponsorService; @Autowired SentenceService sentenceService;
@GetMapping("") public String sponsor(Model model,HttpSession session, @RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "8") int limit){ User user = (User) session.getAttribute(CatConst.USER_SESSION_KEY); model.addAttribute("info",sponsorService.findPagePostSponsorse(page,limit)); model.addAttribute("indexMax",sponsorService.findindexMaxSponsorse(4)); model.addAttribute("search",null); Sentence sentence=sentenceService.findSentence(); model.addAttribute("sentence",sentence); return "sponsor"; }
@GetMapping("interceptor/writeSponsor") public String write(Model model,HttpSession session, @RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int limit){ model.addAttribute("status",0);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| if(i==1){ return new JsonResult(true,"添加成功!"); }else { return new JsonResult(false, "添加失败!"); } }
} package com.stray.cat.controller;
@Controller @RequestMapping("person/interceptor") public class PersonController { @Autowired UserService userService; @Autowired HttpSession session;
@GetMapping private String index(Model model){ User user= (User) session.getAttribute("user_session"); User user1=userService.queryByPhone(user.getUserPhone()); model.addAttribute("user",user1); return "person_writing"; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| @Override public int updateShare(Share share) { return shareMapper.updateShare(share); }
@Override public int deleteShare(int shareId) { return shareMapper.deleteShare(shareId); }
@Override @Cacheable(value = POST_CACHE_NAME, key = "'findPageShare'+#page+#limit") public PageInfo<Share> findPageShare(int page, int limit) { User user= (User) session.getAttribute(CatConst.USER_SESSION_KEY); PageHelper.startPage(page,limit); return new PageInfo<>(shareMapper.queryShareByPhone(user.getUserPhone())); }
@Override public PageInfo<Share> findPageAllShare(int page, int limit) { PageHelper.startPage(page,limit); return new PageInfo<>(shareMapper.queryShareAll()); }
@Override @Cacheable(value = POST_CACHE_NAME_SEARCH, key = "'findPageShareSearch'+#page+#limit+#search") public PageInfo<Share> findPageSearchShare(int page, int limit, String search) { PageHelper.startPage(page,limit); String information1="%"+search+"%"; List<Share> shares=shareMapper.queryShareByTitle(information1); return new PageInfo<>(shares); }
@Override public List<Share> findMaxShare(int limit) { return shareMapper.queryShareMaxCount(limit);
} } package com.stray.cat.controller.admin;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
@Controller @RequestMapping("admin/report") public class adminReportController {
@Autowired ReportService reportService; @Autowired HttpSession session; @Autowired ShareService shareService; @Autowired SponsorService sponsorService; @Autowired PostService postService; @Autowired UserService userService; @Autowired EmailService emailService;
@GetMapping public String report(Model model, @RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "12") int limit){ model.addAttribute("info",reportService.findPageReport(page,limit)); return "admin/admin_report"; }
@GetMapping("deleteReport") public String deleteReport(int id,String status,int reportId) throws UnsupportedEncodingException, MessagingException { System.out.println(id); if(status.equals("启示")){ Post post=postService.queryPostById(id); User user=userService.queryByPhone(post.getPostPhone()); emailService.sendEmail(user.getUserQq()+"@qq.com",post.getPostTitle());
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
@Service @Transactional(rollbackFor = RuntimeException.class) public class SponsorServiceimpl implements SponsorService { private static final String POST_CACHE_NAME = "POST2"; private static final String SPOSORVO_CACHE_NAME = "SPOSORVO";
@Autowired HttpSession session; @Autowired SponsorMapper sponsorMapper; @Autowired UserMapper userMapper;
@Override @Cacheable(value = POST_CACHE_NAME, key = "'findPageSponsor'+#page+#limit") public PageInfo<Sponsor> findPageSponsorTowrite(int page, int limit) { User user= (User) session.getAttribute(CatConst.USER_SESSION_KEY); PageHelper.startPage(page,limit); return new PageInfo<Sponsor>(sponsorMapper.querySponsorByPhone(user.getUserPhone())); }
@Override public int addSponsor(Sponsor sponsor) { return sponsorMapper.addSponsor(sponsor); }
@Override public void deletesponsor(int sponsorId) { sponsorMapper.deleteSponsor(sponsorId); }
@Override public Sponsor querySponsorById(int sponsorId) { return sponsorMapper.querySponsorById(sponsorId); }
@Override public int updateSponsor(Sponsor sponsor) { return sponsorMapper.updateSponsor(sponsor); }
@Override
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=121422322105200ju
https://javayms.pages.dev?id=121422322105200ju