基于java+springboot+layui的流浪动物交流信息平台设计实现
🍅 作者主頁(yè):Java李楊勇?
🍅 簡(jiǎn)介:Java領(lǐng)域優(yōu)質(zhì)創(chuàng)作者🏆、【java李楊勇】公號(hào)作者? ?簡(jiǎn)歷模板、學(xué)習(xí)資料、面試題庫(kù)【關(guān)注我,都給你】
🍅文末獲取源碼聯(lián)系和送書(shū)🍅
前言介紹:
? ? ? ? ? 漫步校園中,偶爾會(huì)看到幾只貓,或是晃做在小道上,或是蜷作一團(tuán)躺在花壇邊上,就像是無(wú)家可歸的可憐的孩子,真叫人心疼!其實(shí),它們就是一些被人遺棄的流浪寵物。 流浪寵物是指無(wú)主、長(zhǎng)期在野外生存的寵物。與野貓(狗)不同,流浪寵物特指那些曾被人們收養(yǎng)過(guò),后來(lái)因?yàn)槟承┰颉⒈粧仐壍膶櫸铩D承┰?#xff0c;可能是因?yàn)橹魅说膯踢w,可能是經(jīng)濟(jì)跟不上,也可能只是主人不喜歡了,就遺棄了。事實(shí)上,在全國(guó)社會(huì)各地,還有許許多多同他們一樣遭遇被遺棄的命運(yùn)的可憐的貓兒狗兒。 校園里的這些貓兒,算是比較幸運(yùn)的,因?yàn)榻?jīng)常有好心的同學(xué)會(huì)給它們喂一些吃的,它們還不至于餓死。另外的那些流浪寵物,不僅失去了溫暖的家,失去了主人的關(guān)愛(ài),就連基本的餐餉都成了問(wèn)題。
在現(xiàn)在貓狗等小動(dòng)物自被馴化以來(lái),作為人類(lèi)的伙伴,他們也有自己的理智與情感,我們應(yīng)該給予充分的尊重和關(guān)懷。但是隨著社會(huì)經(jīng)濟(jì)的發(fā)展,貓狗等小動(dòng)物數(shù)量日益增多、部分人們的嫌棄和遺棄,流浪動(dòng)物越來(lái)越多。這就需要社會(huì)機(jī)構(gòu)或者熱心人士關(guān)懷和救助這些流浪動(dòng)物。在社會(huì)網(wǎng)絡(luò)化的背景下,推進(jìn)人與動(dòng)物和諧共處符合時(shí)代特點(diǎn)。而我們開(kāi)發(fā)一個(gè)自愿救助流浪動(dòng)物網(wǎng)站能夠?yàn)橐恍C(jī)構(gòu)和愛(ài)心人士提供平臺(tái),讓小寵物們能更好的找到主人使它們也更容易的生存下去。同時(shí),也可以為一些不愿意繼續(xù)養(yǎng)寵物的主人提供轉(zhuǎn)讓服務(wù)。提高人們的動(dòng)物保護(hù)意識(shí),動(dòng)物也是大自然的一員人們應(yīng)該保護(hù)它們,倡導(dǎo)愛(ài)護(hù)動(dòng)物的社會(huì)風(fēng)氣,促進(jìn)人與動(dòng)物更和諧的相處。因此,本課題的研究符合時(shí)代現(xiàn)狀,將為營(yíng)造一個(gè)人與自然動(dòng)物生命體和諧共處的良好社會(huì)環(huán)境走出一小步。
技術(shù)工具:
開(kāi)發(fā)工具:IDEA 2021.3、navicat for mysql 、postman。
開(kāi)發(fā)語(yǔ)言:java、jdk1.8、mysql5。
硬件環(huán)境:Windows 10操作系統(tǒng)、Google瀏覽器等。
主要技術(shù):springboot、mybatis-plus、layui、mysql等
模塊設(shè)計(jì):
1.用戶(hù)模塊管理:用戶(hù)登錄、用戶(hù)注冊(cè)、用戶(hù)的查詢(xún)、刪除操作、
2.流浪動(dòng)物首頁(yè)管理:首頁(yè)列表的展示、添加、修改、刪除操作、
3.流浪動(dòng)物信息詳情管理:流浪動(dòng)物信息詳情列表的查看、添加、刪除等操作、
4.管理員信息管理:管理員信息的查看、修改、
5.公告信息管理:公告信息的查看、添加、修改、刪除操作、
6.用戶(hù)模塊管理:用戶(hù)列表查詢(xún)、添加、刪除、、
7.用戶(hù)評(píng)論模塊管理:用戶(hù)評(píng)論查詢(xún)、添加、刪除、
8.注銷(xiāo)退出登錄管理
系統(tǒng)架構(gòu):
功能截圖:
用戶(hù)登錄注冊(cè):
?前端首頁(yè):
分類(lèi)查看:
詳情查看:
評(píng)論回復(fù)信息:這里用戶(hù)頭像替換成自己本地路徑即可顯示
收藏領(lǐng)養(yǎng)管理:
我的個(gè)人信息:
我的領(lǐng)養(yǎng)收藏:
發(fā)布流浪交流信息:
我的發(fā)布:
后端管理:
后端首頁(yè):
用戶(hù)管理:
類(lèi)型管理:
詳情管理:
評(píng)論回復(fù)管理:
通知公告等:
代碼實(shí)現(xiàn):
用戶(hù)登錄:
/*** 根路徑以及其他請(qǐng)求處理* * @author admin**/ @Controller public class IndexController {@Value("${imageFilePath}")private String imageFilePath; // 文件路徑@Resourceprivate NoticeService noticeService;@Resourceprivate UserService userService;@Resourceprivate ArticleService articleService;@Resourceprivate ClassifyService classifyService;@RequestMapping("/")public String index(HttpSession session) {// 查詢(xún)公告session.setAttribute("noticeList", noticeService.list(0, 5));return "index";// 跳轉(zhuǎn)到index.html}/*** 登錄頁(yè)面* * @return*/@RequestMapping("/login")public String login() {return "login";}/*** 前臺(tái)登錄頁(yè)面* * @return*/@RequestMapping("/webLogin")public String webLogin() {return "webLogin";}/*** 注冊(cè)* * @return*/@RequestMapping("/regist")public String regist() {return "regist";}/*** 保存注冊(cè)信息* * @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";}/*** 驗(yàn)證登錄* * @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", "用戶(hù)名或者密碼錯(cuò)誤!");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;}/*** 查看個(gè)人信息* * @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;}/*** 查看個(gè)人收藏夾* * @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;}/*** 查看個(gè)人關(guān)注用戶(hù)* * @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;}/*** 保存用戶(hù)信息* * @param user* @return*/@RequestMapping("/save")public ModelAndView save(User user) {ModelAndView mav = new ModelAndView();userService.save(user);mav.setViewName("/index");return mav;}/*** 流浪動(dòng)物信息發(fā)布頁(yè)面* * @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();// 獲取當(dāng)前用戶(hù)信息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());// 獲取當(dāng)前用戶(hù)信息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";}/*** 查看個(gè)人筆記加載數(shù)據(jù)列表* * @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; // 開(kāi)始時(shí)間String s_ePublishDate = null; // 結(jié)束時(shí)間if (StringUtil.isNotEmpty(publishDates)) {String[] strs = publishDates.split(" - "); // 拆分時(shí)間段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); // 總頁(yè)數(shù)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;}/*** 后臺(tái)默認(rèn)首頁(yè)* * @return*/@RequestMapping("/index")public String root() {return "/common/index";}/*** 博主信息頁(yè)面* * @return*/@RequestMapping("/blogger")public String blogger() {return "/blogger/index";}/*** 圖片上傳處理 @Title: ckeditorUpload @param file 圖片文件 @return 參數(shù)說(shuō)明 @return* Map<String,Object> 返回類(lèi)型 @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 blocke.printStackTrace();}resultMap.put("code", 0);resultMap1.put("filePath", newFileName);resultMap.put("data", resultMap1);return resultMap;}}全局yml:
server: port: 80servlet:context-path: /spring: datasource: driver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:3306/baby_mobile?characterEncoding=utf8&useSSL=falseusername: rootpassword: 123456jpa:hibernate:ddl-auto: updateshow-sql: truethymeleaf:cache: false數(shù)據(jù)庫(kù)設(shè)計(jì):
表t_admin
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 1 | classify_id | int | 10 | 0 | N | Y |
| 2 | classify_name | varchar | 200 | 0 | N | N |
表t_comment
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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
| 編號(hào) | 名稱(chēng) | 數(shù)據(jù)類(lèi)型 | 長(zhǎng)度 | 小數(shù)位 | 允許空值 | 主鍵 |
| 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 |
源碼獲取:
?大家點(diǎn)贊、收藏、關(guān)注、評(píng)論啦 、查看👇🏻👇🏻👇🏻微信公眾號(hào)獲取聯(lián)系方式👇🏻👇🏻👇🏻
打卡 文章 更新?136/? 365天
?精彩專(zhuān)欄推薦訂閱:在下方專(zhuān)欄👇🏻👇🏻👇🏻👇🏻
Java項(xiàng)目精品實(shí)戰(zhàn)案例《100套》
web前端期末大作業(yè)網(wǎng)頁(yè)實(shí)戰(zhàn)《100套》
🥇 評(píng)論區(qū)抽粉絲送書(shū)啦
💌 歡迎大家在評(píng)論區(qū)提出意見(jiàn)和建議! (抽三位幸運(yùn)兒送書(shū),實(shí)物圖如下)💌
內(nèi)容簡(jiǎn)介
本書(shū)從Vue.js框架技術(shù)的基礎(chǔ)概念出發(fā),逐步深入Vue.js進(jìn)階實(shí)戰(zhàn),并在最后配合一個(gè)網(wǎng)站項(xiàng)目和一個(gè)后臺(tái)系統(tǒng)開(kāi)發(fā)實(shí)戰(zhàn)案例,重點(diǎn)介紹了使用Vue.js+axios+ElementUI+wangEditor進(jìn)行前端開(kāi)發(fā)和使用組件進(jìn)行Vue單頁(yè)面網(wǎng)頁(yè)復(fù)用,讓讀者不但可以系統(tǒng)地學(xué)習(xí)Vue.js前端開(kāi)發(fā)框架的相關(guān)知識(shí),而且還能對(duì)業(yè)務(wù)邏輯的分析思路、實(shí)際應(yīng)用開(kāi)發(fā)有更為深入的理解。
本書(shū)語(yǔ)言平實(shí),用詞詼諧,案例豐富,實(shí)用性強(qiáng),特別適合剛?cè)肷鐣?huì)的職場(chǎng)新人、Vue.js框架的初級(jí)讀者和進(jìn)階讀者閱讀,也適合希望從后臺(tái)開(kāi)發(fā)轉(zhuǎn)型做前端的程序員等其他編程愛(ài)好者閱讀。另外,本書(shū)也適合作為相關(guān)培訓(xùn)機(jī)構(gòu)的教材使用。
京東自營(yíng)購(gòu)買(mǎi)鏈接
《Vue.js框架與Web前端開(kāi)發(fā)從入門(mén)到精通》(舒志強(qiáng))【摘要 書(shū)評(píng) 試讀】- 京東圖書(shū)
當(dāng)當(dāng)自營(yíng)購(gòu)買(mǎi)鏈接
《Vue.js框架與Web前端開(kāi)發(fā)從入門(mén)到精通》(舒志強(qiáng))【簡(jiǎn)介_(kāi)書(shū)評(píng)_在線閱讀】 - 當(dāng)當(dāng)圖書(shū)
大家點(diǎn)贊關(guān)注,三天后也就是 1月13日 從👇🏻👇🏻👇🏻評(píng)論區(qū)👇🏻👇🏻👇🏻留言的同學(xué)中抽取三位送書(shū)
如果中獎(jiǎng)了聯(lián)系不上則視為放棄,可以從👇🏻👇🏻👇🏻下方卡片👇🏻👇🏻👇🏻里找到作者的聯(lián)系方式,每周都會(huì)送6~9本書(shū),后面送書(shū)力度還會(huì)加大,一年送幾百上千本不是問(wèn)題,
總結(jié)
以上是生活随笔為你收集整理的基于java+springboot+layui的流浪动物交流信息平台设计实现的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 基于java SSM springboo
- 下一篇: mysql 正则替换 换行,MySQL中