Java项目:11 Springboot的垃圾回收管理系统

发布时间:2024年01月19日
作者主页:源码空间codegym

简介:Java领域优质创作者、Java项目、学习资料、技术互助

文中获取源码

项目介绍

  • 功能介绍

    • 本系统通过利用系统的垃圾回收流程,提高垃圾回收效率,通过垃圾回收的申请,增删改查,垃圾运输申请、垃圾状态查询、以及系统公告、个人信息更新等,实现了垃圾回收的科学管理。适合在学校的同学用作毕业设计。
    • 实现了登录、注册、垃圾回收管理(添加、编辑、删除、状态筛选)、垃圾去向运输申请、垃圾打包运输、系统公告、个人信息编辑。

环境要求

1.运行环境:最好是java jdk1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.tomcat环境:Tomcat7.x,8.X,9.x版本均可

4.硬件环境:windows7/8/10 4G内存以上;或者Mac OS;

5.是否Maven项目:是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven.项目

6.数据库:MySql5.7/8.0等版本均可;

技术栈

后台框架:Spring Boot、MyBatis

数据库:MySQL

环境:JDK8、TOMCAT、IDEA

使用说明

1.使用Navicati或者其它工具,在mysql中创建对应sq文件名称的数据库,并导入项目的sql文件;

2.使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;

3.将项目中config-propertiesi配置文件中的数据库配置改为自己的配置,然后运行;

运行指导

idea导入源码空间站顶目教程说明(Vindows版)-ssm篇:

http://mtw.so/5MHvZq

源码看好后直接在网站付款下单即可,付款成功会自动弹出百度网盘链接,网站地址:http://codegym.top

其它问题请关注公众号:IT小舟,关注后发送消息即可,都会给您回复的。若没有及时回复请耐心等待,通常当天会有回复

运行截图

界面

微信截图_20240119155717

微信截图_20240119155819

微信截图_20240119155825

微信截图_20240119155832

微信截图_20240119155838

微信截图_20240119155952

微信截图_20240119160001

微信截图_20240119155807

代码

GarbageController

package com.garbage.demo.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.garbage.demo.common.Result;
import com.garbage.demo.entity.Garbage;
import com.garbage.demo.service.IGarbageService;
import com.garbage.demo.utils.StringConst;
import com.garbage.demo.vo.request.RequestDeleteVo;
import com.garbage.demo.vo.request.RequestGarbageAddVo;
import com.garbage.demo.vo.request.RequestGarbageListByTypeVo;
import com.garbage.demo.vo.request.RequestGarbageListVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 垃圾入库表 前端控制器
 * </p>
 *
 * @author lzf
 * @since 2020-10-15
 */
@RestController
@RequestMapping("/garbage")
public class GarbageController {

    @Autowired
    private IGarbageService garbageService;

    @PostMapping("/saveOrUpdate")
    public Result saveOrUpdate(@RequestBody RequestGarbageAddVo requestGarbageAddVo){
        String result;
        if(requestGarbageAddVo.getWeight()<0){
            return Result.getFailure().setMsg("重量输入错误!!");
        }
        if(ObjectUtils.isNotEmpty(requestGarbageAddVo.getId())){
            result = "修改";
        }else{
            result = "添加";
        }
        Garbage garbage = new Garbage();
        BeanUtils.copyProperties(requestGarbageAddVo,garbage);
        if(garbageService.saveOrUpdate(garbage)){
            return Result.getSuccess().setMsg(result + "成功!!!");
        }else{
            return Result.getFailure().setMsg(result + "失败!!!");
        }
    }


    @DeleteMapping("/deleteByIds")
    public Result delete(@RequestBody RequestDeleteVo requestDeleteVo){
        if(ObjectUtils.isNotEmpty(requestDeleteVo.getIntegerIds())){
            QueryWrapper<Garbage> garbageQueryWrapper = new QueryWrapper<>();

            garbageQueryWrapper.isNull("transport_id");
            garbageQueryWrapper.in("id",requestDeleteVo.getIntegerIds());

            garbageService.remove(garbageQueryWrapper);
            return Result.getSuccess().setMsg(StringConst.DELETE_SUCCESS);
        }
        return Result.getFailure().setMsg(StringConst.DELETE_ERROR);
    }


    @PostMapping("/list")
    public Result list(@RequestBody RequestGarbageListVo garbageListVo){
        IPage<Garbage> garbageIPage = garbageService.list(garbageListVo);
        return Result.getSuccess().setData(garbageIPage);
    }

    @GetMapping("/getById/{id}")
    public Result getById(@PathVariable Integer id){
        return Result.getSuccess().setData(garbageService.getById(id));
    }

    @PostMapping("/getByType")
    public Result getByType(@RequestBody RequestGarbageListByTypeVo garbageListByTypeVo){
        IPage<Garbage> garbageIPage = garbageService.getByType(garbageListByTypeVo);
        return Result.getSuccess().setData(garbageIPage);
    }

    @GetMapping("/getByTransportId/{transportId}")
    public Result getByTransportId(@PathVariable Integer transportId
            ,@RequestParam(value = "limit") Integer limit,@RequestParam(value = "page") Integer page){
        IPage<Garbage> garbageIPage = garbageService.getByTransportId(transportId,limit ,page);
        return Result.getSuccess().setData(garbageIPage);
    }


}

NoticeController

package com.garbage.demo.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.garbage.demo.common.Result;
import com.garbage.demo.entity.Notice;
import com.garbage.demo.service.INoticeService;
import com.garbage.demo.utils.StringConst;
import com.garbage.demo.utils.VoUtilsTool;
import com.garbage.demo.vo.request.RequestDeleteVo;
import com.garbage.demo.vo.request.RequestNoticeListVo;
import com.garbage.demo.vo.request.RequestSaveOrUpdateNoticeVo;
import com.garbage.demo.vo.response.ResponseUserListVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 公告表 前端控制器
 * </p>
 *
 * @author lzf
 * @since 2020-10-15
 */
@RestController
@RequestMapping("/notice")
public class NoticeController {

    @Autowired
    INoticeService noticeService;

    @PostMapping("/saveOrUpdateNotice")
    public Result saveOrUpdateNotice(@RequestBody RequestSaveOrUpdateNoticeVo saveOrUpdateNoticeVo){
        if(ObjectUtils.isEmpty(saveOrUpdateNoticeVo.getTitle())){
            return Result.getFailure().setMsg(StringConst.NOTICE_IS_NULL);
        }
        String result = null;
        Notice notice;
        if(ObjectUtils.isEmpty(saveOrUpdateNoticeVo.getId())){
            notice = new Notice();
            BeanUtils.copyProperties(saveOrUpdateNoticeVo,notice);
            result = "添加";
        }else{
            notice = noticeService.getById(saveOrUpdateNoticeVo.getId());
            BeanUtils.copyProperties(saveOrUpdateNoticeVo,notice);
            result = "修改";
        }
        if(!noticeService.saveOrUpdate(notice)){
            return  Result.getFailure().setMsg(result +"失败了。");
        }
        return Result.getSuccess().setMsg(result + "成功啦!");
    }

    @DeleteMapping("/deleteByIds")
    public Result delete(@RequestBody RequestDeleteVo deleteVo){
        if(VoUtilsTool.checkObjFieldIsNull(deleteVo)){
            return Result.getFailure().setMsg(StringConst.DELETE_SELECT_ERROR);

        }
        if(noticeService.removeByIds(deleteVo.getIntegerIds())){
            return  Result.getSuccess().setMsg(StringConst.DELETE_SUCCESS);
        }else{
            return  Result.getFailure().setMsg(StringConst.DELETE_ERROR);
        }
    }

    @PostMapping("/list")
    public Result noticeList(@RequestBody RequestNoticeListVo noticeListVo){
        IPage<Notice> listVoIPage = noticeService.noticeList(noticeListVo);
        return Result.getSuccess().setData(listVoIPage);
    }

    @GetMapping("/getById/{id}")
    public Result getById( @PathVariable Integer id){
        return Result.getSuccess().setData(noticeService.getById(id));
    }

}

文章来源:https://blog.csdn.net/2301_78300054/article/details/135700914
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。