毕业设计|基于SpringBoot+Vue的新生报道(二)

简介: 毕业设计|基于SpringBoot+Vue的新生报道

毕业设计|基于SpringBoot+Vue的新生报道(一)https://developer.aliyun.com/article/1423958


四,核心代码展示

4.1 ArriveschoolController

@RestController
@RequestMapping("/arriveschool")
public class ArriveschoolController {
    @Resource
    private IArriveschoolService arriveschoolService;
    @Resource
    IUserService userService;
    private final String now = DateUtil.now();
    // 新增或者更新
    @PostMapping
    public Result save(@RequestBody Arriveschool arriveschool) {
        if (arriveschool.getId() == null) {
            Integer userid = arriveschool.getUserid();
            QueryWrapper<Arriveschool> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("userid",userid);
            final Arriveschool one = arriveschoolService.getOne(queryWrapper);
            if(null != one){
                return Result.error("400","只能提交一次,不能重复提交");
            }
        }
        arriveschoolService.saveOrUpdate(arriveschool);
        return Result.success();
    }
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id) {
        arriveschoolService.removeById(id);
        return Result.success();
    }
    @PostMapping("/del/batch")
    public Result deleteBatch(@RequestBody List<Integer> ids) {
        arriveschoolService.removeByIds(ids);
        return Result.success();
    }
    @GetMapping
    public Result findAll() {
        return Result.success(arriveschoolService.list());
    }
    @GetMapping("/{id}")
    public Result findOne(@PathVariable Integer id) {
        return Result.success(arriveschoolService.getById(id));
    }
    @GetMapping("/page")
    public Result findPage(@RequestParam(defaultValue = "") String name,
                           @RequestParam Integer userid,
                           @RequestParam Integer pageNum,
                           @RequestParam Integer pageSize) {
        QueryWrapper<Arriveschool> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id");
        if (!"".equals(name)) {
            queryWrapper.like("name", name);
        }
        if(userid != -1){
            queryWrapper.eq("userid",userid);
        }
        return Result.success(arriveschoolService.page(new Page<>(pageNum, pageSize), queryWrapper));
    }
    @GetMapping("/byTeacherPage")
    public Result findByTeacherPage(@RequestParam(defaultValue = "") String name,
                           @RequestParam Integer userid,
                           @RequestParam Integer pageNum,
                           @RequestParam Integer pageSize) {
        QueryWrapper<Arriveschool> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id");
        if (!"".equals(name)) {
            queryWrapper.like("name", name);
        }
        User byId = userService.getById(userid);
        queryWrapper.eq("classid",byId.getClassid());
        return Result.success(arriveschoolService.page(new Page<>(pageNum, pageSize), queryWrapper));
    }
    @GetMapping("/agree")
    public Result agree(@RequestParam Integer id) {
        QueryWrapper<Arriveschool> queryWrapper = new QueryWrapper<>();
        Arriveschool byId = arriveschoolService.getById(id);
        if(byId != null){
            byId.setStatus("审核通过");
            arriveschoolService.updateById(byId);
            return Result.success("审核通过");
        }else{
            return Result.error("400","不存在数据,无法审核");
        }
    }
    @GetMapping("/reject")
    public Result reject(@RequestParam Integer id) {
        QueryWrapper<Arriveschool> queryWrapper = new QueryWrapper<>();
        Arriveschool byId = arriveschoolService.getById(id);
        if(byId != null){
            byId.setStatus("审核拒绝");
            arriveschoolService.updateById(byId);
            return Result.success("审核拒绝");
        }else{
            return Result.error("400","不存在数据,无法审核");
        }
    }
    /**
    * 导出接口
    */
    @GetMapping("/export")
    public void export(HttpServletResponse response) throws Exception {
        // 从数据库查询出所有的数据
        List<Arriveschool> list = arriveschoolService.list();
        // 在内存操作,写出到浏览器
        ExcelWriter writer = ExcelUtil.getWriter(true);
        // 一次性写出list内的对象到excel,使用默认样式,强制输出标题
        writer.write(list, true);
        // 设置浏览器响应的格式
        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
        String fileName = URLEncoder.encode("Arriveschool信息表", "UTF-8");
        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
        ServletOutputStream out = response.getOutputStream();
        writer.flush(out, true);
        out.close();
        writer.close();
        }
    /**
     * excel 导入
     * @param file
     * @throws Exception
     */
    @PostMapping("/import")
    public Result imp(MultipartFile file) throws Exception {
        InputStream inputStream = file.getInputStream();
        ExcelReader reader = ExcelUtil.getReader(inputStream);
        // 通过 javabean的方式读取Excel内的对象,但是要求表头必须是英文,跟javabean的属性要对应起来
        List<Arriveschool> list = reader.readAll(Arriveschool.class);
        arriveschoolService.saveBatch(list);
        return Result.success();
    }
    private User getUser() {
        return TokenUtils.getCurrentUser();
    }
}


毕业设计|基于SpringBoot+Vue的新生报道(三)https://developer.aliyun.com/article/1423960

相关文章
|
前端开发 Java 关系型数据库
基于Java+Springboot+Vue开发的鲜花商城管理系统源码+运行
基于Java+Springboot+Vue开发的鲜花商城管理系统(前后端分离),这是一项为大学生课程设计作业而开发的项目。该系统旨在帮助大学生学习并掌握Java编程技能,同时锻炼他们的项目设计与开发能力。通过学习基于Java的鲜花商城管理系统项目,大学生可以在实践中学习和提升自己的能力,为以后的职业发展打下坚实基础。技术学习共同进步
1064 7
|
JavaScript 前端开发 Java
制造业ERP源码,工厂ERP管理系统,前端框架:Vue,后端框架:SpringBoot
这是一套基于SpringBoot+Vue技术栈开发的ERP企业管理系统,采用Java语言与vscode工具。系统涵盖采购/销售、出入库、生产、品质管理等功能,整合客户与供应商数据,支持在线协同和业务全流程管控。同时提供主数据管理、权限控制、工作流审批、报表自定义及打印、在线报表开发和自定义表单功能,助力企业实现高效自动化管理,并通过UniAPP实现移动端支持,满足多场景应用需求。
1554 1
|
前端开发 安全 Java
基于springboot+vue开发的会议预约管理系统
一个完整的会议预约管理系统,包含前端用户界面、管理后台和后端API服务。 ### 后端 - **框架**: Spring Boot 2.7.18 - **数据库**: MySQL 5.6+ - **ORM**: MyBatis Plus 3.5.3.1 - **安全**: Spring Security + JWT - **Java版本**: Java 11 ### 前端 - **框架**: Vue 3.3.4 - **UI组件**: Element Plus 2.3.8 - **构建工具**: Vite 4.4.5 - **状态管理**: Pinia 2.1.6 - **HTTP客户端
1902 4
基于springboot+vue开发的会议预约管理系统
|
前端开发 JavaScript Java
基于springboot+vue开发的校园食堂评价系统【源码+sql+可运行】【50809】
本系统基于SpringBoot与Vue3开发,实现校园食堂评价功能。前台支持用户注册登录、食堂浏览、菜品查看及评价发布;后台提供食堂、菜品与评价管理模块,支持权限控制与数据维护。技术栈涵盖SpringBoot、MyBatisPlus、Vue3、ElementUI等,适配响应式布局,提供完整源码与数据库脚本,可直接运行部署。
774 6
基于springboot+vue开发的校园食堂评价系统【源码+sql+可运行】【50809】
|
供应链 JavaScript BI
ERP系统源码,基于SpringBoot+Vue+ElementUI+UniAPP开发
这是一款专为小微企业打造的 SaaS ERP 管理系统,基于 SpringBoot+Vue+ElementUI+UniAPP 技术栈开发,帮助企业轻松上云。系统覆盖进销存、采购、销售、生产、财务、品质、OA 办公及 CRM 等核心功能,业务流程清晰且操作简便。支持二次开发与商用,提供自定义界面、审批流配置及灵活报表设计,助力企业高效管理与数字化转型。
1155 2
ERP系统源码,基于SpringBoot+Vue+ElementUI+UniAPP开发
|
监控 数据可视化 JavaScript
springboot + vue的MES系统生产计划管理源码
MES系统(制造执行系统)的生产计划管理功能是其核心模块之一,涵盖生产计划制定与优化、调度排程、进度监控反馈、资源管理调配及可视化报告五大方面。系统基于SpringBoot + Vue-Element-Plus-Admin技术栈开发,支持多端应用(App、小程序、H5、后台)。通过实时数据采集与分析,MES助力企业优化生产流程,适用于现代化智能制造场景。
849 1
|
JavaScript Java 测试技术
基于SpringBoot+Vue实现的留守儿童爱心网站设计与实现(计算机毕设项目实战+源码+文档)
博主是一位全网粉丝超过100万的CSDN特邀作者、博客专家,专注于Java、Python、PHP等技术领域。提供SpringBoot、Vue、HTML、Uniapp、PHP、Python、NodeJS、爬虫、数据可视化等技术服务,涵盖免费选题、功能设计、开题报告、论文辅导、答辩PPT等。系统采用SpringBoot后端框架和Vue前端框架,确保高效开发与良好用户体验。所有代码由博主亲自开发,并提供全程录音录屏讲解服务,保障学习效果。欢迎点赞、收藏、关注、评论,获取更多精品案例源码。
|
JavaScript Java 测试技术
基于SpringBoot+Vue实现的家政服务管理平台设计与实现(计算机毕设项目实战+源码+文档)
面向大学生毕业选题、开题、任务书、程序设计开发、论文辅导提供一站式服务。主要服务:程序设计开发、代码修改、成品部署、支持定制、论文辅导,助力毕设!
|
JavaScript 前端开发 Java
Spring Boot 与 Vue.js 前后端分离中的数据交互机制
本文深入探讨了Spring Boot与Vue.js在前后端分离架构下的数据交互机制。通过对比传统`model.addAttribute()`方法与RESTful API的设计,分析了两者在耦合性、灵活性及可扩展性方面的差异。Spring Boot以RESTful API提供数据服务,Vue.js借助Axios消费API并动态渲染页面,实现了职责分明的解耦架构。该模式显著提升了系统的灵活性和维护性,适用于复杂应用场景如论坛、商城系统等,为现代Web开发提供了重要参考。
1837 0
|
JavaScript Java Maven
Spring-boot整合vue遇到的坑
spring-boot整合vue遇到的坑
9096 0