|
@@ -1,34 +1,26 @@
|
|
|
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 com.xjrsoft.module.room.vo.NoBedStudentPageVo;
|
|
|
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: 调整床位
|
|
@@ -59,55 +51,25 @@ public class RoomBedAdjustController {
|
|
|
@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);
|
|
|
+ Page<AdjustBedStudentPageVo> page = roomBedService.getBedStudetInfo(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);
|
|
|
+ @GetMapping(value = "/no-bed-student")
|
|
|
+ @ApiOperation(value="未分配床位的学生(分页)")
|
|
|
+ @SaCheckPermission("roomBedAdjust:detail")
|
|
|
+ public RT<PageOutput<NoBedStudentPageVo>> noBedStudent(@Valid AdjustBedPageDto dto){
|
|
|
+ Page<NoBedStudentPageVo> page = roomBedService.getNoBedStudent(new Page<>(dto.getLimit(), dto.getSize()), dto);
|
|
|
+ PageOutput<NoBedStudentPageVo> pageOutput = ConventPage.getPageOutput(page, NoBedStudentPageVo.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));
|
|
|
-
|
|
|
+ @ApiOperation(value = "批量移出学生")
|
|
|
+ @SaCheckPermission("roomBedAdjust:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody Long id){
|
|
|
+ return RT.ok(roomBedService.clearStudentInfoByRoomId(id));
|
|
|
}
|
|
|
}
|