1、项目介绍
如今,随着人们生活水平不断提高,人们的生活在物质满足的基础上,更多的人将生活的重点放在追求精神享受的过程中。于此同时,Internet铺天盖地的普及,使得这样的人纷纷通过Internet的方式去寻找精神的满足。然而领养宠物正是人们现在炙手可热的一种精神寄托。对于宠物的热爱让他们的生活更加充满爱心和向往。Internet和领养宠物的两者结合,大大推动了电子商务的发展,促进了该行业的崛起。这正是二手流浪宠物领养网站诞生的缘由。该网站不仅解决了地理隔离的问题,同时也跟上了网络快速发展的脚步,实现爱宠人士足不出户的领养到心仪的爱宠。
本文研究了一个流浪宠物领养管理系统,该系统基于B/S架构模式,使用ssm框架开发设计而成。系统主要以Java语言作为开发基础,使用了jsp+ssm等技术,采用idea为开发工具,以MySql作为数据库工具。本系统分为前台模块和后台管理模块,前台模块方便用户进行的查看,后台管理模块方便管理员进行管理。本系统功能比较完善,界面友好,操作简单,方便用户的使用。
2、技术框架
运行系统:windows
编程语言:java
系统架构:B/S
后端框框:SSM( Spring+SpringMVC+Mybaits)
前端框架:JSP+jQuery+Ajax
前后端分离:否
数据库:MySQL
Maven项目:是
数据库表数量:8
运行环境:JDK8+MySQL5.6+Tomcat8.5+IntelliJ IDEA
3、演示视频
基于ssm+jsp的宠物领养管理系统
4、项目截图
5、文档截图
6、代码示例
/**
* 活动管理控制器
*/
@Controller
@RequestMapping("blog")
public class BlogController {
@Autowired
private BlogService blogService;
@RequestMapping("blogs.action")
@ResponseBody
public Message getBlog(@RequestParam(value = "pn",defaultValue = "1") Integer pn){
// 引入PageHelper分页插件
// 在查询之前只需要调用,传入页码,以及每页的大小
PageHelper.startPage(pn,10);
List<Blog> blogs = blogService.getBlogs();
// startPage后面紧跟的这个查询就是一个分页查询
// 使用pageInfo包装查询后的结果,只需要将pageInfo交给页面就行了。
// 封装了详细的分页信息,包括有我们查询出来的数据,传入连续显示的页数
PageInfo page=new PageInfo(blogs,2);
return Message.success().add("pageInfo",page);
}
/**
* 这是传给前端的数据
* */
@RequestMapping("blog.action")
public String getBlogs(ModelAndView modelAndView){
List<Blog> blogs = blogService.getBlogs();
modelAndView.addObject("blogs",blogs);
return "blog";
}
/**
* 添加活动信息
* @param blog
* @return
*/
@RequestMapping("add.action")
@ResponseBody
public Message addBlog(Blog blog){
if(StringUtils.isEmpty(blog.getTitle())){
return Message.error("请填写活动标题");
}
if(StringUtils.isEmpty(blog.getActionTime())){
return Message.error("请填写活动时间");
}
if(StringUtils.isEmpty(blog.getAddress())){
return Message.error("请填写活动地址");
}
if(StringUtils.isEmpty(blog.getEvent())){
return Message.error("请填写活动介绍");
}
if(StringUtils.isEmpty(blog.getPeoples())){
return Message.error("请填写活动适合人群");
}
int i = blogService.addBlog(blog);
if(i>0){
return Message.success();
}else{
return Message.fail();
}
}
/**
* 删除活动信息
* @param id
* @return
*/
@RequestMapping("delete.action")
@ResponseBody
public Message deleteBlog(Integer id){
try {
int i = blogService.deleteBlog(id);
}catch (Exception e){
return Message.error("删除失败,该活动已经有人申请,不可删除");
}
return Message.success();
}
/**
* 更新活动信息
* @param blog
* @return
*/
@RequestMapping("edit.action")
@ResponseBody
public Message editBlog(Blog blog){
if(StringUtils.isEmpty(blog.getTitle())){
return Message.error("请填写活动标题");
}
if(StringUtils.isEmpty(blog.getActionTime())){
return Message.error("请填写活动时间");
}
if(StringUtils.isEmpty(blog.getAddress())){
return Message.error("请填写活动地址");
}
if(StringUtils.isEmpty(blog.getEvent())){
return Message.error("请填写活动介绍");
}
if(StringUtils.isEmpty(blog.getPeoples())){
return Message.error("请填写活动适合人群");
}
if(blogService.updateBlog(blog)>0){
return Message.success();
}else{
return Message.fail();
}
}
/**
* 根据id查询活动信息
* @param id
* @return
*/
@RequestMapping("findById.action")
@ResponseBody
public Message findById(Integer id){
Blog blog = blogService.findById(id);
if(blog!=null){
return Message.success().add("blog",blog);
}else{
return Message.fail();
}
}
/**
* 根据活动时间查询活动信息
* @param pn
* @param actionTime
* @return
* @throws ParseException
*/
@RequestMapping("findByTime.action")
@ResponseBody
public Message findByTime(@RequestParam(value = "pn",defaultValue = "1") Integer pn,@RequestParam("actionTime") String actionTime) throws ParseException {
PageHelper.startPage(pn,4);
List<Blog> blog= blogService.findByTime(actionTime);
if(blog!=null){
PageInfo page=new PageInfo(blog,3);
return Message.success().add("pageInfo",page);
}else{
return Message.fail();
}
}
}