ssm593流浪动物救助站+vue设计与实现(源码文档)

博主介绍:专注于Java(springboot ssm 等开发框架) vue  .net  php phython node.js    uniapp 微信小程序 等诸多技术领域和毕业项目实战、企业信息化系统建设,从业十五余年开发设计教学工作
☆☆☆ 精彩专栏推荐订阅☆☆☆☆☆不然下次找不到哟
我的博客空间发布了2000+毕设题目 方便大家学习使用
感兴趣的可以先收藏起来,还有大家在毕设选题,项目以及论文编写等相关问题都可以给我留言咨询,希望帮助更多的人
文末下方有源码获取地址

ssm593流浪动物救助站+vue录像 (含源码文档)

    1. 系统结构设计

系统结构设计就像一个树状结构一样,一个树干有很多分支,大任务相当于树干,小任务相当于树枝,只有需求分析信息弄清楚之后,才能保证每个小任务都能实现目标,对初步设计好的系统再进行不断优化,最终得到一个具体现实的系统结构。

管理员功能模块和用户功能模块是该流浪动物救助站的两大部分,系统结构如图4-2所示。

图4-2 系统结构图

4.3 数据库设计

开发一个系统也需要提前设计数据库。这里的数据库是相关数据的集合,存储在一起的这些数据也是按照一定的组织方式进行的。目前,数据库能够服务于多种应用程序,则是源于它存储方式最佳,具备数据冗余率低的优势。虽然数据库为程序提供信息存储服务,但它与程序之间也可以保持较高的独立性。总而言之,数据库经历了很长一段时间的发展,从最初的不为人知,到现在的人尽皆知,其相关技术也越发成熟,同时也拥有着坚实的理论基础。

4.3.1 数据库概念设计

这部分内容需要借助数据库关系图来完成,也需要使用专门绘制数据库关系图的工具,比如Visio工具就可以设计E-R图(数据库关系图)。设计数据库,也需要按照设计的流程进行,首先还是要根据需求完成实体的确定,分析实体具有的特征,还有对实体间的关联关系进行确定。最后才是使用E-R模型的表示方法,绘制本系统的E-R图。不管是使用亿图软件,还是Visio工具,对于E-R模型的表示符号都一样,通常矩形代表实体,实体间存在的关系用菱形符号表示,实体的属性也就是实体的特征用符号椭圆表示。最后使用直线将矩形,菱形和椭圆等符号连接起来。接下来就开始对本系统的E-R图进行绘制。

      1. 数据库表设计

采用MYSQL数据库对该流浪动物救助站的数据进行存储,数据库中所包括的各个数据库表的详细信息如下所示:

表4.1字典表表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

dic_code

String

字段

3

dic_name

String

字段名

4

code_index

Integer

编码

5

index_name

String

编码名字

6

super_id

Integer

父字段id

7

beizhu

String

备注

8

create_time

Date

创建时间

表4.2论坛表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

forum_name

String

帖子标题

3

yonghu_id

Integer

用户

4

yuangong_id

Integer

员工

5

users_id

Integer

管理员

6

forum_content

String

发布内容

7

super_ids

Integer

父id

8

forum_state_types

Integer

帖子状态

9

insert_time

Date

发帖时间

10

update_time

Date

修改时间

11

create_time

Date

创建时间

表4.3捐赠信息表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

yonghu_id

Integer

用户

3

qiuzhu_id

Integer

求助

4

juanzheng_types

Integer

捐赠渠道

5

juanzheng_number

BigDecimal

捐赠金额

6

create_time

Date

创建时间

表4.4流浪动物领养表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

liulangdongwu_id

Integer

流浪动物

3

yonghu_id

Integer

用户

4

lingyang_yesno_types

Integer

审核状态

5

lingyang_yesno_text

String

审核结果

6

create_time

Date

创建时间

表4.5领养反馈表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

liulangdongwu_id

Integer

流浪动物

3

yonghu_id

Integer

用户

4

lingyangfankui_name

String

标题

5

lingyangfankui_photo

String

动物图片

6

lingyangfankui_video

String

视频

7

lingyangfankui_content

String

详情

8

create_time

Date

创建时间

表4.6领养反馈留言表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

lingyangfankui_id

Integer

流浪动物

3

yonghu_id

Integer

用户

4

lingyangfankui_liuyan_text

String

留言内容

5

insert_time

Date

留言时间

6

reply_text

String

回复内容

7

update_time

Date

回复时间

8

create_time

Date

创建时间

表4.7流浪动物表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

liulangdongwu_name

String

动物昵称

3

liulangdongwu_types

Integer

动物品种

4

liulangdongwu_photo

String

动物图片

5

liulangdongwu_sex_types

Integer

动物性别

6

liulangdongwu_jiangkang

String

健康状况

7

liulangdongwu_shizhang

String

疫苗情况

8

liulangdongwu_jueyu

String

绝育情况

9

lingyang_status_types

Integer

领养状态

10

liulangdongwu_content

String

动物详情

11

create_time

Date

创建时间

表4.8流浪动物留言表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

liulangdongwu_id

Integer

流浪动物

3

yonghu_id

Integer

用户

4

liulangdongwu_liuyan_text

String

留言内容

5

insert_time

Date

留言时间

6

reply_text

String

回复内容

7

update_time

Date

回复时间

8

create_time

Date

创建时间

表4.9公告信息表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

news_name

String

公告标题

3

news_types

Integer

公告类型

4

news_photo

String

公告图片

5

insert_time

Date

公告时间

6

news_content

String

公告详情

7

create_time

Date

创建时间

表4.10求助信息表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

yonghu_id

Integer

用户

3

qiuzhu_name

String

动物昵称

4

liulangdongwu_types

Integer

动物品种

5

qiuzhu_photo

String

动物图片

6

qiuzhu_content

String

求助详情

7

create_time

Date

创建时间

表4.11用户表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

yonghu_name

String

用户姓名

3

yonghu_photo

String

头像

4

yonghu_phone

String

联系方式

5

yonghu_id_number

String

用户身份证号

6

yonghu_email

String

邮箱

7

yonghu_lingyang

String

领养需求

8

yonghu_address

String

住址

9

yonghu_delete

Integer

假删

10

create_time

Date

创建时间

表4.12员工表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

yuangong_name

String

员工姓名

3

yuangong_photo

String

头像

4

yuangong_phone

String

联系方式

5

yuangong_email

String

邮箱

6

yonghu_delete

Integer

假删

7

create_time

Date

创建时间

表4.13用户表表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

username

String

用户名

3

password

String

密码

4

role

String

角色

5

addtime

Date

新增时间

  1. 系统的实现
    1. 功能模块的实现

5.1用户信息管理

如图5.1显示的就是用户信息管理页面,此页面提供给管理员的功能有:用户信息的查询管理,可以删除用户信息、修改用户信息、新增用户信息,

还进行了对用户名称的模糊查询的条件

图5.1 用户信息管理页面

5.2 流浪动物管理

如图5.2显示的就是流浪动物管理页面,此页面提供给管理员的功能有:查看已发布的流浪动物数据,修改流浪动物,流浪动物作废,即可删除,还进行了对流浪动物名称的模糊查询 流浪动物信息的类型查询等等一些条件。

图5.2 流浪动物管理页面


package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
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.*;
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.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 流浪动物
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/liulangdongwu")
public class LiulangdongwuController {
    private static final Logger logger = LoggerFactory.getLogger(LiulangdongwuController.class);

    @Autowired
    private LiulangdongwuService liulangdongwuService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service

    @Autowired
    private YonghuService yonghuService;
    @Autowired
    private YuangongService yuangongService;


    /**
    * 后端列表
    */
    @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(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        else if("员工".equals(role))
            params.put("yuangongId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = liulangdongwuService.queryPage(params);

        //字典表数据转换
        List<LiulangdongwuView> list =(List<LiulangdongwuView>)page.getList();
        for(LiulangdongwuView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        LiulangdongwuEntity liulangdongwu = liulangdongwuService.selectById(id);
        if(liulangdongwu !=null){
            //entity转view
            LiulangdongwuView view = new LiulangdongwuView();
            BeanUtils.copyProperties( liulangdongwu , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody LiulangdongwuEntity liulangdongwu, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,liulangdongwu:{}",this.getClass().getName(),liulangdongwu.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<LiulangdongwuEntity> queryWrapper = new EntityWrapper<LiulangdongwuEntity>()
            .eq("liulangdongwu_name", liulangdongwu.getLiulangdongwuName())
            .eq("liulangdongwu_types", liulangdongwu.getLiulangdongwuTypes())
            .eq("liulangdongwu_sex_types", liulangdongwu.getLiulangdongwuSexTypes())
            .eq("liulangdongwu_jiangkang", liulangdongwu.getLiulangdongwuJiangkang())
            .eq("liulangdongwu_shizhang", liulangdongwu.getLiulangdongwuShizhang())
            .eq("liulangdongwu_jueyu", liulangdongwu.getLiulangdongwuJueyu())
            .eq("lingyang_status_types", liulangdongwu.getLingyangStatusTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        LiulangdongwuEntity liulangdongwuEntity = liulangdongwuService.selectOne(queryWrapper);
        if(liulangdongwuEntity==null){
            liulangdongwu.setCreateTime(new Date());
            liulangdongwuService.insert(liulangdongwu);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody LiulangdongwuEntity liulangdongwu, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,liulangdongwu:{}",this.getClass().getName(),liulangdongwu.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        //根据字段查询是否有相同数据
        Wrapper<LiulangdongwuEntity> queryWrapper = new EntityWrapper<LiulangdongwuEntity>()
            .notIn("id",liulangdongwu.getId())
            .andNew()
            .eq("liulangdongwu_name", liulangdongwu.getLiulangdongwuName())
            .eq("liulangdongwu_types", liulangdongwu.getLiulangdongwuTypes())
            .eq("liulangdongwu_sex_types", liulangdongwu.getLiulangdongwuSexTypes())
            .eq("liulangdongwu_jiangkang", liulangdongwu.getLiulangdongwuJiangkang())
            .eq("liulangdongwu_shizhang", liulangdongwu.getLiulangdongwuShizhang())
            .eq("liulangdongwu_jueyu", liulangdongwu.getLiulangdongwuJueyu())
            .eq("lingyang_status_types", liulangdongwu.getLingyangStatusTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        LiulangdongwuEntity liulangdongwuEntity = liulangdongwuService.selectOne(queryWrapper);
        if("".equals(liulangdongwu.getLiulangdongwuPhoto()) || "null".equals(liulangdongwu.getLiulangdongwuPhoto())){
                liulangdongwu.setLiulangdongwuPhoto(null);
        }
        if(liulangdongwuEntity==null){
            liulangdongwuService.updateById(liulangdongwu);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        liulangdongwuService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<LiulangdongwuEntity> liulangdongwuList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            LiulangdongwuEntity liulangdongwuEntity = new LiulangdongwuEntity();
//                            liulangdongwuEntity.setLiulangdongwuName(data.get(0));                    //动物昵称 要改的
//                            liulangdongwuEntity.setLiulangdongwuTypes(Integer.valueOf(data.get(0)));   //动物品种 要改的
//                            liulangdongwuEntity.setLiulangdongwuPhoto("");//照片
//                            liulangdongwuEntity.setLiulangdongwuSexTypes(Integer.valueOf(data.get(0)));   //动物性别 要改的
//                            liulangdongwuEntity.setLiulangdongwuJiangkang(data.get(0));                    //健康状况 要改的
//                            liulangdongwuEntity.setLiulangdongwuShizhang(data.get(0));                    //疫苗情况 要改的
//                            liulangdongwuEntity.setLiulangdongwuJueyu(data.get(0));                    //绝育情况 要改的
//                            liulangdongwuEntity.setLingyangStatusTypes(Integer.valueOf(data.get(0)));   //领养状态 要改的
//                            liulangdongwuEntity.setLiulangdongwuContent("");//照片
//                            liulangdongwuEntity.setCreateTime(date);//时间
                            liulangdongwuList.add(liulangdongwuEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        liulangdongwuService.insertBatch(liulangdongwuList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = liulangdongwuService.queryPage(params);

        //字典表数据转换
        List<LiulangdongwuView> list =(List<LiulangdongwuView>)page.getList();
        for(LiulangdongwuView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        LiulangdongwuEntity liulangdongwu = liulangdongwuService.selectById(id);
            if(liulangdongwu !=null){


                //entity转view
                LiulangdongwuView view = new LiulangdongwuView();
                BeanUtils.copyProperties( liulangdongwu , view );//把实体数据重构到view中

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody LiulangdongwuEntity liulangdongwu, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,liulangdongwu:{}",this.getClass().getName(),liulangdongwu.toString());
        Wrapper<LiulangdongwuEntity> queryWrapper = new EntityWrapper<LiulangdongwuEntity>()
            .eq("liulangdongwu_name", liulangdongwu.getLiulangdongwuName())
            .eq("liulangdongwu_types", liulangdongwu.getLiulangdongwuTypes())
            .eq("liulangdongwu_sex_types", liulangdongwu.getLiulangdongwuSexTypes())
            .eq("liulangdongwu_jiangkang", liulangdongwu.getLiulangdongwuJiangkang())
            .eq("liulangdongwu_shizhang", liulangdongwu.getLiulangdongwuShizhang())
            .eq("liulangdongwu_jueyu", liulangdongwu.getLiulangdongwuJueyu())
            .eq("lingyang_status_types", liulangdongwu.getLingyangStatusTypes())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        LiulangdongwuEntity liulangdongwuEntity = liulangdongwuService.selectOne(queryWrapper);
        if(liulangdongwuEntity==null){
            liulangdongwu.setCreateTime(new Date());
        liulangdongwuService.insert(liulangdongwu);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


}

5.3领养信息管理

如图5.3显示的就是领养信息管理页面,此页面提供给管理员的功能有:根据领养信息进行条件查询,还可以对领养信息进行新增、修改、查询操作等等。

图5.3 领养信息管理页面

5.1公告信息管理

如图5.4显示的就是公告信息管理页面,此页面提供给管理员的功能有:根据公告信息进行新增、修改、查询操作等等。

大家点赞、收藏、关注、评论啦  其他的定制服务 商务合作  下方联系卡片↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 或者私信作者

猜你喜欢

转载自blog.csdn.net/qq_41221322/article/details/146548240
今日推荐