Bootstrap

基于SpringBoot+Vue的宠物领养管理系统设计与实现毕设(文档+源码)

        大家好呀,我是一个混迹在java圈的码农。今天要和大家分享的是 一款基于SpringBoot+Vue的宠物领养管理系统,项目源码请点击文章末尾联系我哦~目前有各类成品 毕设 JavaWeb  SSM SpringBoot等等项目框架,源码丰富,欢迎咨询。 

一、项目介绍

        宠物领养系统能够实现用户管理,宠物领养管理,宠物认领管理,教学视频管理,感谢信管理,公告管理,宠物领养审核管理,宠物认领审核管理等功能。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。

        宠物领养系统可以提高宠物领养信息管理问题的解决效率,优化宠物领养信息处理流程,并且能够保证存储数据的安全,它是一个非常可靠,非常安全的应用程序。

关键词:宠物领养系统;Mysql数据库;Java语言

二、开发环境

开发系统:Windows
JDK版本:Java JDK1.8(推荐)
开发工具:IDEA/MyEclipse(推荐IDEA)
数据库版本: mysql8.0(推荐)
数据库可视化工具: navicat
服务器:SpringBoot自带 apache tomcat
框架:springboot,vue

三、功能介绍

        管理员可以发布需要领养的宠物的资料,可以对宠物领养的信息进行更改,查询,删除;可以对用户申请领养的宠物进行线上审核,管理员对宠物领养的信息审核通过之后,该宠物的领养状态就是被领养的状态了;可以发布宠物的认领信息,其中包括宠物的图片,宠物的类型等信息,管理员对宠物的认领信息也能更改,查询,删除;对用户申请认领的宠物信息进行线上审核,审核后的宠物认领信息只能进行查看和查询;上传教学视频,对教学视频信息包括视频文件,视频标题等资料进行更改,查询,或删除,可以查看已发布教学视频的用户点赞数等信息等。

四、核心代码

/**
 * 视频收藏
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/jiaoxueshipinCollection")
public class JiaoxueshipinCollectionController {
    private static final Logger logger = LoggerFactory.getLogger(JiaoxueshipinCollectionController.class);

    @Autowired
    private JiaoxueshipinCollectionService jiaoxueshipinCollectionService;


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

    //级联表service
    @Autowired
    private JiaoxueshipinService jiaoxueshipinService;
    @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.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = jiaoxueshipinCollectionService.queryPage(params);

        //字典表数据转换
        List<JiaoxueshipinCollectionView> list =(List<JiaoxueshipinCollectionView>)page.getList();
        for(JiaoxueshipinCollectionView 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);
        JiaoxueshipinCollectionEntity jiaoxueshipinCollection = jiaoxueshipinCollectionService.selectById(id);
        if(jiaoxueshipinCollection !=null){
            //entity转view
            JiaoxueshipinCollectionView view = new JiaoxueshipinCollectionView();
            BeanUtils.copyProperties( jiaoxueshipinCollection , view );//把实体数据重构到view中

                //级联表
                JiaoxueshipinEntity jiaoxueshipin = jiaoxueshipinService.selectById(jiaoxueshipinCollection.getJiaoxueshipinId());
                if(jiaoxueshipin != null){
                    BeanUtils.copyProperties( jiaoxueshipin , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setJiaoxueshipinId(jiaoxueshipin.getId());
                }
                //级联表
                YonghuEntity yonghu = yonghuService.selectById(jiaoxueshipinCollection.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            jiaoxueshipinCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        Wrapper<JiaoxueshipinCollectionEntity> queryWrapper = new EntityWrapper<JiaoxueshipinCollectionEntity>()
            .eq("jiaoxueshipin_id", jiaoxueshipinCollection.getJiaoxueshipinId())
            .eq("yonghu_id", jiaoxueshipinCollection.getYonghuId())
            .eq("jiaoxueshipin_collection_types", jiaoxueshipinCollection.getJiaoxueshipinCollectionTypes())
            ;

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

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            jiaoxueshipinCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<JiaoxueshipinCollectionEntity> queryWrapper = new EntityWrapper<JiaoxueshipinCollectionEntity>()
            .notIn("id",jiaoxueshipinCollection.getId())
            .andNew()
            .eq("jiaoxueshipin_id", jiaoxueshipinCollection.getJiaoxueshipinId())
            .eq("yonghu_id", jiaoxueshipinCollection.getYonghuId())
            .eq("jiaoxueshipin_collection_types", jiaoxueshipinCollection.getJiaoxueshipinCollectionTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        JiaoxueshipinCollectionEntity jiaoxueshipinCollectionEntity = jiaoxueshipinCollectionService.selectOne(queryWrapper);
        if(jiaoxueshipinCollectionEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      jiaoxueshipinCollection.set
            //  }
            jiaoxueshipinCollectionService.updateById(jiaoxueshipinCollection);//根据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());
        jiaoxueshipinCollectionService.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<JiaoxueshipinCollectionEntity> jiaoxueshipinCollectionList = 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){
                            //循环
                            JiaoxueshipinCollectionEntity jiaoxueshipinCollectionEntity = new JiaoxueshipinCollectionEntity();
//                            jiaoxueshipinCollectionEntity.setJiaoxueshipinId(Integer.valueOf(data.get(0)));   //视频 要改的
//                            jiaoxueshipinCollectionEntity.setYonghuId(Integer.valueOf(data.get(0)));   //用户 要改的
//                            jiaoxueshipinCollectionEntity.setJiaoxueshipinCollectionTypes(Integer.valueOf(data.get(0)));   //类型 要改的
//                            jiaoxueshipinCollectionEntity.setInsertTime(date);//时间
//                            jiaoxueshipinCollectionEntity.setCreateTime(date);//时间
                            jiaoxueshipinCollectionList.add(jiaoxueshipinCollectionEntity);


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

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

五、效果图

六、源码获取:

👇🏻获取联系方式在文章末尾👇🏻
有需要的伙伴可以点击下方名片,与我联系哦~

;