Introduction:

Walking around the campus, I would occasionally see a few cats, or dangling on the path, or lying curled up on the edge of the flower bed, just like homeless poor children, really sad! In fact, they are just some stray pets abandoned by people. Stray pets refer to ownerless pets that live in the wild for a long time. Unlike feral cats (dogs), stray pets refer to those that have been adopted by people before being abandoned for some reason. Some reasons, may be because of the owner’s housewarming, may not be able to keep up with the economy, may also be just the owner does not like, abandoned. As a matter of fact, there are many, many other poor dogs and cats who suffer the same fate as them in all parts of the country. Luckily for the cats on campus, some kind classmates often give them food to keep them from starving to death. In addition, those stray pets not only lost their warm homes, lost the care of their owners, even the basic food has become a problem.

Since the domestication of cats and dogs and other small animals, as human partners, they also have their own reason and emotion, we should give full respect and care. However, with the development of social economy, the number of small animals such as cats and dogs is increasing, and some people abandon and abandon stray animals, more and more. This requires social institutions or warm-hearted people to care for and rescue these stray animals. Under the background of social networking, promoting the harmonious coexistence of human and animals accords with the characteristics of The Times. The development of a voluntary rescue website for stray animals can provide a platform for some organizations and caring people, so that small pets can better find their owners and make their survival easier. At the same time, it can also provide transfer services for some owners who do not want to keep pets. Raise people’s awareness of animal protection, animals are also a member of nature people should protect them, advocate the social atmosphere of caring for animals, promote people and animals to get along more harmoniously. Therefore, the research of this topic is in line with the current situation of The Times, and will take a small step to create a good social environment for human and natural animal life to coexist harmoniously.

Technical tools:

Development tools: IDEA 2021.3, Navicat for mysql, Postman.

Development language: Java, JDk1.8, mysql5.

Hardware environment: Windows 10 operating system, Google Browser, etc.

Main technology: Springboot, Mybatis – Plus, Layui, mysql, etc

Module design:

1. User module management: user login, user registration, user query, deletion operation,

2. Home page management of stray animals: display, add, modify and delete the home page list.

3. Details management of stray animal information: view, add and delete the details list of stray animal information.

4. Administrator information management: viewing and modifying administrator information

5. Announcement information management: Viewing, adding, modifying and deleting announcement information

6. User module management: query, add, delete user list.

7. User comment module management: user comment query, add, delete,

8. Log out And exit the login management

System architecture:

Function screenshots:

User login registration:

Front page:

Category view:

For details:

Comment reply message: the user profile picture can be displayed by replacing it with its own local path

Collection and Adoption management:

Personal Information:

My Adoption collection:

Release vagrant communication information:

My release:

Back-end management:

Back end home page:

User management:

Type management:

Details management:

Comment response management:

Announcements, etc. :

Code implementation:

User login:

/** * Root path and other request processing **@author admin
 *
 */
@Controller
public class IndexController {

  @Value("${imageFilePath}")
  private String imageFilePath; // File path

  @Resource
  private NoticeService noticeService;

  @Resource
  private UserService userService;

  @Resource
  private ArticleService articleService;
  @Resource
  private ClassifyService classifyService;

  @RequestMapping("/")
  public String index(HttpSession session) {

    // Query bulletins
    session.setAttribute("noticeList", noticeService.list(0.5));
    return "index";// Jump to index.html
  }

  /** * login page **@return* /
  @RequestMapping("/login")
  public String login(a) {
    return "login";
  }

  /** * login page **@return* /
  @RequestMapping("/webLogin")
  public String webLogin(a) {
    return "webLogin";
  }

  /** * Register **@return* /
  @RequestMapping("/regist")
  public String regist(a) {
    return "regist";
  }

  /** * Save registration information **@param user
   * @return* /
  @RequestMapping("/saveUser")
  public String saveUser(User user) {
// List
      
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"; } /** * Exit login **@param request * @return* / @RequestMapping("/quit") public String quit(HttpServletRequest request) { HttpSession session = request.getSession(); session.removeAttribute("user"); return "index"; } /** * Exit login **@param request * @return* / @RequestMapping("/quitAdmin") public String quitAdmin(HttpServletRequest request) { HttpSession session = request.getSession(); session.removeAttribute("user"); return "login"; } /** * verify 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"."Wrong username or password!"); 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; } /** * View personal information **@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; } /** * view personal favorites **@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; } /** * View personal following user **@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; } /** * Save user information **@param user * @return* / @RequestMapping("/save") public ModelAndView save(User user) { ModelAndView mav = new ModelAndView(); userService.save(user); mav.setViewName("/index"); return mav; } /** * Stray animal information release page **@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; } /** * Save notes **@param article * @param request * @return* / @RequestMapping("addNote") public ModelAndView addNote(Article article, HttpServletRequest request) { ModelAndView mav = new ModelAndView(); // Get the current user information 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()); // Get the current user information articleService.save(article); mav.setViewName("/index"); return mav; } /** * View notes **@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"; } /** * View personal note loading data list **@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; // Start time String s_ePublishDate = null; // End time if (StringUtil.isNotEmpty(publishDates)) { String[] strs = publishDates.split("-"); // Split the time period 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); / / the total number of pages 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(a) { return "/common/index"; } /** ** info page **@return* / @RequestMapping("/blogger") public String blogger(a) { return "/blogger/index"; } /** * image upload processing@Title: ckeditorUpload @paramFile Image file@returnParameters that@return* Map<String,Object> Return type@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(); // Get the file name String suffixName = fileName.substring(fileName.lastIndexOf(".")); // Get the suffix of the file String newFileName = ""; try { newFileName = DateUtil.getCurrentDateStr() + suffixName; // New file name FileUtils.copyInputStreamToFile(file.getInputStream(), new File(imageFilePath + newFileName)); / / upload } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } resultMap.put("code".0); resultMap1.put("filePath", newFileName); resultMap.put("data", resultMap1); returnresultMap; }}Copy the code

Global YML configuration

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: falseCopy the code

Database design:

Table t_admin

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Table t_article

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Table t_blogger

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Table t_classify

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
1 classify_id int 10 0 N Y
2 classify_name varchar 200 0 N N

Table t_comment

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Table t_link

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Table t_notice

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Table t_reply

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Table t_timeline

Serial number The name of the The data type The length of the Decimal places Allows null values A primary key
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

Source code:

Everyone likes, favorites, attention, comments, interested and I exchange

Clocked articles updated 136/365 days