springboot+vue前后端分离实现宿舍管理系统(1)

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.validation.annotation.Validated;

import org.springframework.web.bind.annotation.*;

/**

  • @author znz

  • @date 2021-12-17

*/

@RestController

@RequestMapping(“/backlate”)

public class BackLateController {

@Autowired

private BackLateService backLateService;

@Autowired

private RedisUtil redisUtil;

@PostMapping(“/saveOrUpdate”)

@RequirePermission(permissions = {“back:save”,“back:update”})

@Log

public Result<?> saveOrUpdate(@RequestBody @Validated BackLate backLate) {

backLateService.saveOrUpdate(backLate);

return Result.ok(“操作成功”);

}

@GetMapping(“delete/{id}”)

@RequirePermission(permissions = {“back:delete”})

@Log

public Result<?> delete(@PathVariable Long id) {

backLateService.delete(id);

return Result.ok(“删除成功”);

}

@PostMapping(“/list”)

@RequirePermission(permissions = {“back:list”})

public Result<PageInfo> list(@RequestBody ListQuery listQuery,

@RequestHeader(Constant.HEADER_TOKEN) String token) {

SystemUser systemUser = redisUtil.exchange(token).get();

PageInfo pageInfo = backLateService.list(listQuery, systemUser.getBuildingId());

return Result.<PageInfo>ok().add(pageInfo);

}

@GetMapping(“/query/{id}”)

@RequirePermission(permissions = {“back:query”})

public Result query(@PathVariable Long id) {

BackLate backLate = backLateService.query(id);

return Result.ok().add(backLate);

}

}

package com.hzvtc.myproject.controller;

import com.github.pagehelper.PageHelper;

import com.github.pagehelper.PageInfo;

import com.hzvtc.myproject.annotation.Log;

import com.hzvtc.myproject.annotation.RequirePermission;

import com.hzvtc.myproject.dto.ListQuery;

import com.hzvtc.myproject.entity.Building;

import com.hzvtc.myproject.entity.Room;

import com.hzvtc.myproject.exception.HttpException;

import com.hzvtc.myproject.service.BuildingService;

import com.hzvtc.myproject.service.RoomService;

import com.hzvtc.myproject.utils.HttpCode;

import com.hzvtc.myproject.vo.Result;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.validation.annotation.Validated;

import org.springframework.web.bind.annotation.*;

import java.util.List;

/**

  • @author znz

  • @date 2021-12-19

*/

@RestController

@RequestMapping(“/building”)

public class BuildingController {

@Autowired

private BuildingService buildingService;

@Autowired

private RoomService roomService;

@GetMapping(“/listAll”)

@RequirePermission(permissions = {“manage:building:list”})

public Result<List> listAll() {

List list = buildingService.listAll();

return Result.<List>ok().add(list);

}

@GetMapping(“/list”)

@RequirePermission(permissions = {“manage:building:list”})

public Result<List> list() {

List list = buildingService.list();

return Result.<List>ok().add(list);

}

@GetMapping(“delete”)

@RequirePermission(permissions = {“manage:building:delete”})

@Log(“删除building”)

public Result<?> delete(@RequestParam(“id”) Long id) {

List list = roomService.listByBuildingId(id);

if (list.size() > 0) {

throw new HttpException(HttpCode.FAILED, “该节点下或子节点还有寝室,无法删除”);

}

buildingService.delete(id);

return Result.ok(“删除成功”);

}

@GetMapping(“/query”)

@RequirePermission(permissions = {“manage:building:query”})

public Result query(@RequestParam(“id”) Long id) {

Building building = buildingService.query(id).orElseThrow(() -> new HttpException(HttpCode.FAILED, “该数据不存在”));

return Result.ok().add(building);

}

@PostMapping(“/saveOrUpdate”)

@RequirePermission(permissions = {“manage:building:save”,“manage:building:update”})

@Log

public Result<?> saveOrUpdate(@RequestBody @Validated Building building) {

if (building.getId() == null) {

buildingService.save(building);

} else {

if (building.getId().equals(building.getParentId())) {

throw new HttpException(HttpCode.FAILED, “父节点不能为自己”);

}

buildingService.update(building);

}

return Result.ok(“操作成功”);

}

}

package com.hzvtc.myproject.controller;

import com.github.pagehelper.PageHelper;

import com.github.pagehelper.PageInfo;

import com.hzvtc.myproject.config.Constant;

import com.hzvtc.myproject.dto.ListQuery;

import com.hzvtc.myproject.dto.Message;

import com.hzvtc.myproject.entity.DepartApplication;

import com.hzvtc.myproject.entity.DepartApplicationUser;

import com.hzvtc.myproject.entity.SystemUser;

import com.hzvtc.myproject.exception.HttpException;

import com.hzvtc.myproject.service.DepartApplicationService;

import com.hzvtc.myproject.service.StudentService;

import com.hzvtc.myproject.service.SystemUserService;

import com.hzvtc.myproject.socket.WebSocket;

import com.hzvtc.myproject.utils.HttpCode;

import com.hzvtc.myproject.utils.RedisUtil;

import com.hzvtc.myproject.vo.Result;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.List;

/**

  • @author znz

  • @date 2021-12-09

*/

@RestController

@RequestMapping(“/depart”)

public class DepartApplicationController {

@Autowired

private DepartApplicationService departApplicationService;

@Autowired

private StudentService studentService;

@Autowired

private RedisUtil redisUtil;

@Autowired

private SystemUserService systemUserService;

@PostMapping(“/listMy”)

public Result<PageInfo> listMyApplication(@RequestBody ListQuery listQuery,

@RequestHeader(Constant.HEADER_TOKEN) String token) {

Long id = redisUtil.get(token);

PageHelper.startPage(listQuery.getPage(), listQuery.getRows());

List list = departApplicationService.listMyApplication(id);

PageInfo pageInfo = new PageInfo<>(list);

return Result.<PageInfo>ok().add(pageInfo);

}

@PostMapping(“/listMyFlow”)

public Result<PageInfo> listMyFlow(@RequestBody ListQuery listQuery,

@RequestHeader(Constant.HEADER_TOKEN) String token) {

Long id = redisUtil.get(token);

PageHelper.startPage(listQuery.getPage(), listQuery.getRows());

List list = departApplicationService.listMyFlow(id);

PageInfo pageInfo = new PageInfo<>(list);

return Result.<PageInfo>ok().add(pageInfo);

}

@GetMapping(“/listFlow/{id}”)

public Result<List> listApplicationFlow(@PathVariable(“id”) Long id) {

List list = departApplicationService.listApplicationFlow(id);

return Result.<List>ok().add(list);

}

@PostMapping(“/update”)

public Result<?> update(@RequestBody DepartApplicationUser departApplicationUser,

@RequestHeader(Constant.HEADER_TOKEN) String token) {

String msg = “成功,”;

SystemUser user = redisUtil.exchange(token).get();

DepartApplicationUser applicationUser =

departApplicationService

.getApplicationUser(departApplicationUser.getId());

if (!user.getId().equals(applicationUser.getOperateUserId())) {

throw new HttpException(HttpCode.FAILED, “无法审核”);

}

if (applicationUser.getIsAgree() != null) {

throw new HttpException(HttpCode.FAILED, “已审核过,无法修改”);

}

departApplicationService.update(departApplicationUser);

DepartApplication application =

departApplicationService

.getByDepartApplicationUserId(departApplicationUser.getId());

if (departApplicationUser.getIsAgree()) {

if (user.getLeaderId() == null) {

studentService.delete(application.getStudentId());

msg += “该学生已成功退宿”;

} else {

departApplicationService.saveApplication(user.getLeaderId(), application.getId());

WebSocket.sendMessage(user.getLeaderId(),

new Message().setTitle(“新的退宿申请”).setType(2).setMessageBody(application.getReason()),

systemUserService);

msg += “等待上一级审核”;

}

} else {

msg += “审核未通过”;

}

return Result.ok(msg);

}

@GetMapping(“delete/{id}”)

public Result<?> delete(@PathVariable Long id) {

departApplicationService.deleteApplication(id);

return Result.ok(“撤销成功”);

}

@GetMapping(“/query/{id}”)

public Result query(@PathVariable Long id) {

DepartApplication data = departApplicationService.getApplication(id);

return Result.ok().add(data);

}

}

package com.hzvtc.myproject.controller;

import com.hzvtc.myproject.annotation.Log;

import com.hzvtc.myproject.annotation.RequirePermission;

import com.hzvtc.myproject.entity.Faculty;

import com.hzvtc.myproject.entity.Student;

import com.hzvtc.myproject.exception.HttpException;

import com.hzvtc.myproject.service.FacultyService;

import com.hzvtc.myproject.service.StudentService;

import com.hzvtc.myproject.utils.HttpCode;

import com.hzvtc.myproject.vo.Result;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.validation.annotation.Validated;

import org.springframework.web.bind.annotation.*;

import java.util.List;

/**

  • @author znz

  • @date 2021-12-19

*/

@RestController

@RequestMapping(“/faculty”)

public class FacultyController {
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)

最后

本人分享一下这次字节跳动、美团、头条等大厂的面试真题涉及到的知识点,以及我个人的学习方法、学习路线等,当然也整理了一些学习文档资料出来是附赠给大家的。知识点涉及比较全面,包括但不限于前端基础,HTML,CSS,JavaScript,Vue,ES6,HTTP,浏览器,算法等等

详细大厂面试题答案、学习笔记、学习视频等资料领取,点击资料领取直通车免费领取!

前端视频资料:
Uk3-1713558000102)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!

[外链图片转存中…(img-2MnOy2pI-1713558000102)]

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)

[外链图片转存中…(img-bYjd4roN-1713558000102)]

最后

本人分享一下这次字节跳动、美团、头条等大厂的面试真题涉及到的知识点,以及我个人的学习方法、学习路线等,当然也整理了一些学习文档资料出来是附赠给大家的。知识点涉及比较全面,包括但不限于前端基础,HTML,CSS,JavaScript,Vue,ES6,HTTP,浏览器,算法等等

详细大厂面试题答案、学习笔记、学习视频等资料领取,点击资料领取直通车免费领取!

[外链图片转存中…(img-NoX77geI-1713558000103)]

前端视频资料:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值