大家好!我是岛上程序猿,感谢您阅读本文,欢迎一键三连哦。
💞当前专栏:Java毕业设计
精彩专栏推荐👇🏻👇🏻👇🏻
开发运行环境
- 框架:ssm
- JDK版本:JDK1.8
- 服务器:tomcat7
- 数据库:mysql 5.7
- 数据库工具:Navicat12
- 开发软件:eclipse/myeclipse/idea
- Maven包:Maven3.3.9
- 浏览器:谷歌浏览器
源码下载地址:
https://download.csdn.net/download/m0_46388260/89282102
论文目录
【如需全文请按文末获取联系】
一、项目简介
宠物领养系统在Eclipse环境中,使用Java语言进行编码,使用Mysql创建数据表保存本系统产生的数据。系统可以提供信息显示和相应服务,其管理员管理宠物,管理宠物领养订单,管理宠物留言信息,管理宠物知识科普信息,管理用户。用户查看宠物,收藏宠物,领养宠物,查看宠物领养订单和宠物知识科普信息。
二、系统设计
2.1软件功能模块设计
在前面分析的管理员功能的基础上,进行接下来的设计工作,最终展示设计的管理员结构图(见下图)。管理员管理宠物,管理宠物领养订单,管理宠物留言信息,管理宠物知识科普信息,管理用户。
在前面分析的用户功能的基础上,进行接下来的设计工作,最终展示设计的用户结构图(见下图)。用户查看宠物,收藏宠物,领养宠物,查看宠物领养订单和宠物知识科普信息。
2.2数据库设计
(1)下图是用户实体和其具备的属性。
(2)下图是宠物实体和其具备的属性。
(3)下图是管理员实体和其具备的属性。
(5)下图为上述各实体间相互之间的关系。
三、系统项目部分截图
3.1管理员功能实现
用户管理
管理员进入指定功能操作区之后可以管理用户信息。其页面见下图。管理员主要负责修改用户信息,添加新用户,删除指定用户信息,用户信息包括是否养过宠物,联系方式,工作,收入等信息。
宠物管理
管理员进入指定功能操作区之后可以管理宠物信息。其页面见下图。管理员负责修改宠物信息,可以修改宠物的类别,健康情况,是否被领养等信息,可以删除指定的宠物信息。
领养订单管理
管理员进入指定功能操作区之后可以管理宠物领养订单信息。其页面见下图。管理员在本页面可以查询宠物领养订单,可以查看宠物订单状态信息,领养时间信息等,可以删除指定的宠物领养订单信息。
3.2用户功能实现
宠物信息
用户进入指定功能操作区之后可以查看宠物信息。其页面见下图。用户查看宠物的介绍信息,在当前页面可以收藏宠物,或者是发布留言信息,也可以领养宠物。
宠物知识科普
用户进入指定功能操作区之后可以查看宠物知识科普信息。其页面见下图。用户查询宠物知识科普信息,点击宠物知识科普信息的标题可以查看其对应内容。
宠物领养订单
用户进入指定功能操作区之后可以查看宠物领养订单信息。其页面见下图。用户在当前页面查看领养的宠物信息,查看宠物领养订单的状态信息。
四、部分核心代码
package com.controller;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.StringUtil;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.ChongwuLiuyanEntity;
import com.service.ChongwuLiuyanService;
import com.entity.view.ChongwuLiuyanView;
import com.service.ChongwuService;
import com.entity.ChongwuEntity;
import com.service.YonghuService;
import com.entity.YonghuEntity;
import com.utils.PageUtils;
import com.utils.R;
/**
* 宠物留言
* 后端接口
* @author
* @email
* @date 2021-04-29
*/
@RestController
@Controller
@RequestMapping("/chongwuLiuyan")
public class ChongwuLiuyanController {
private static final Logger logger = LoggerFactory.getLogger(ChongwuLiuyanController.class);
@Autowired
private ChongwuLiuyanService chongwuLiuyanService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private ChongwuService chongwuService;
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
params.put("yonghuId",request.getSession().getAttribute("userId"));
}
params.put("orderBy","id");
PageUtils page = chongwuLiuyanService.queryPage(params);
//字典表数据转换
List<ChongwuLiuyanView> list =(List<ChongwuLiuyanView>)page.getList();
for(ChongwuLiuyanView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ChongwuLiuyanEntity chongwuLiuyan = chongwuLiuyanService.selectById(id);
if(chongwuLiuyan !=null){
//entity转view
ChongwuLiuyanView view = new ChongwuLiuyanView();
BeanUtils.copyProperties( chongwuLiuyan , view );//把实体数据重构到view中
//级联表
ChongwuEntity chongwu = chongwuService.selectById(chongwuLiuyan.getChongwuId());
if(chongwu != null){
BeanUtils.copyProperties( chongwu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setChongwuId(chongwu.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(chongwuLiuyan.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ChongwuLiuyanEntity chongwuLiuyan, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,chongwuLiuyan:{}",this.getClass().getName(),chongwuLiuyan.toString());
chongwuLiuyan.setInsertTime(new Date());
chongwuLiuyan.setCreateTime(new Date());
chongwuLiuyanService.insert(chongwuLiuyan);
return R.ok();
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ChongwuLiuyanEntity chongwuLiuyan, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,chongwuLiuyan:{}",this.getClass().getName(),chongwuLiuyan.toString());
chongwuLiuyanService.updateById(chongwuLiuyan);//根据id更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
chongwuLiuyanService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
// params.put("yonghuId",request.getSession().getAttribute("userId"));
// }
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = chongwuLiuyanService.queryPage(params);
//字典表数据转换
List<ChongwuLiuyanView> list =(List<ChongwuLiuyanView>)page.getList();
for(ChongwuLiuyanView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c);
}
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ChongwuLiuyanEntity chongwuLiuyan = chongwuLiuyanService.selectById(id);
if(chongwuLiuyan !=null){
//entity转view
ChongwuLiuyanView view = new ChongwuLiuyanView();
BeanUtils.copyProperties( chongwuLiuyan , view );//把实体数据重构到view中
//级联表
ChongwuEntity chongwu = chongwuService.selectById(chongwuLiuyan.getChongwuId());
if(chongwu != null){
BeanUtils.copyProperties( chongwu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setChongwuId(chongwu.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(chongwuLiuyan.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ChongwuLiuyanEntity chongwuLiuyan, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,chongwuLiuyan:{}",this.getClass().getName(),chongwuLiuyan.toString());
chongwuLiuyan.setInsertTime(new Date());
chongwuLiuyan.setCreateTime(new Date());
chongwuLiuyanService.insert(chongwuLiuyan);
return R.ok();
}
}
获取源码或论文
如需对应的论文或源码,以及其他定制需求,也可以下方微信联系我。