|
@@ -0,0 +1,113 @@
|
|
|
+package com.xjrsoft.module.room.controller;
|
|
|
+
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.xjrsoft.common.model.result.RT;
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
+import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.module.room.dto.AddRoomBedDto;
|
|
|
+import com.xjrsoft.module.room.dto.AdjustBedPageDto;
|
|
|
+import com.xjrsoft.module.room.dto.AdjustClassPageDto;
|
|
|
+import com.xjrsoft.module.room.dto.UpdateRoomBedDto;
|
|
|
+import com.xjrsoft.module.room.entity.RoomBed;
|
|
|
+import com.xjrsoft.module.room.service.IRoomBedService;
|
|
|
+import com.xjrsoft.module.room.vo.AdjustBedClassPageVo;
|
|
|
+import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
|
|
|
+import com.xjrsoft.module.room.vo.RoomBedVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+* @title: 调整床位
|
|
|
+* @Author dzx
|
|
|
+* @Date: 2023-12-30
|
|
|
+* @Version 1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/room" + "/roomBedAdjust")
|
|
|
+@Api(value = "/room" + "/roomBedAdjust",tags = "调整床位代码")
|
|
|
+@AllArgsConstructor
|
|
|
+public class RoomBedAdjustController {
|
|
|
+
|
|
|
+
|
|
|
+ private final IRoomBedService roomBedService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/class-student")
|
|
|
+ @ApiOperation(value="需要分配/调整床位的学生(分页)")
|
|
|
+ @SaCheckPermission("roomBedAdjust:detail")
|
|
|
+ public RT<PageOutput<AdjustBedClassPageVo>> classStudent(@Valid AdjustClassPageDto dto){
|
|
|
+
|
|
|
+ Page<AdjustBedClassPageVo> page = roomBedService.getClassStudetBed(new Page<>(dto.getLimit(), dto.getSize()), dto);
|
|
|
+ PageOutput<AdjustBedClassPageVo> pageOutput = ConventPage.getPageOutput(page, AdjustBedClassPageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/bed-student")
|
|
|
+ @ApiOperation(value="床位学生列表(分页)")
|
|
|
+ @SaCheckPermission("roomBedAdjust:detail")
|
|
|
+ public RT<PageOutput<AdjustBedStudentPageVo>> distributeClassPage(@Valid AdjustBedPageDto dto){
|
|
|
+ Page<AdjustBedStudentPageVo> page = roomBedService.getBedStudetBed(new Page<>(dto.getLimit(), dto.getSize()), dto);
|
|
|
+ PageOutput<AdjustBedStudentPageVo> pageOutput = ConventPage.getPageOutput(page, AdjustBedStudentPageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/distribute-roombed-page")
|
|
|
+ @ApiOperation(value="分配床位寝室床位列表(分页)")
|
|
|
+ @SaCheckPermission("roombed:detail")
|
|
|
+ public RT<PageOutput<AdjustBedStudentPageVo>> noBedStudent(@Valid AdjustBedPageDto dto){
|
|
|
+ Page<AdjustBedStudentPageVo> page = roomBedService.getBedStudetBed(new Page<>(dto.getLimit(), dto.getSize()), dto);
|
|
|
+ PageOutput<AdjustBedStudentPageVo> pageOutput = ConventPage.getPageOutput(page, AdjustBedStudentPageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询寝室床位信息")
|
|
|
+ @SaCheckPermission("roombed:detail")
|
|
|
+ public RT<RoomBedVo> info(@RequestParam Long id){
|
|
|
+ RoomBed roomBed = roomBedService.getById(id);
|
|
|
+ if (roomBed == null) {
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
+ }
|
|
|
+ return RT.ok(BeanUtil.toBean(roomBed, RoomBedVo.class));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation(value = "新增寝室床位")
|
|
|
+ @SaCheckPermission("roombed:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddRoomBedDto dto){
|
|
|
+ RoomBed roomBed = BeanUtil.toBean(dto, RoomBed.class);
|
|
|
+ boolean isSuccess = roomBedService.save(roomBed);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ @ApiOperation(value = "修改寝室床位")
|
|
|
+ @SaCheckPermission("roombed:edit")
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateRoomBedDto dto){
|
|
|
+
|
|
|
+ RoomBed roomBed = BeanUtil.toBean(dto, RoomBed.class);
|
|
|
+ return RT.ok(roomBedService.updateById(roomBed));
|
|
|
+
|
|
|
+ }
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除寝室床位")
|
|
|
+ @SaCheckPermission("roombed:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(roomBedService.clearStudentInfo(ids));
|
|
|
+
|
|
|
+ }
|
|
|
+}
|