Browse Source

Merge remote-tracking branch 'origin/dev' into dev

phoenix 1 year ago
parent
commit
06ae84d202

+ 14 - 0
src/main/java/com/xjrsoft/module/oa/controller/NewsController.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.constant.GlobalConstant;
+import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
@@ -338,4 +339,17 @@ public class NewsController {
     public RT<Boolean> sendMessage(@RequestParam Long id) {
         return RT.ok(newsService.SendMessage(id));
     }
+
+    @GetMapping("/unread-count")
+    @ApiOperation(value = "获取登录人未读消息数量")
+    public RT<Integer> unreadCount() {
+        Integer count = newsService.selectJoinCount(
+            new MPJLambdaWrapper<News>()
+            .eq(NewsRelation::getReadMark, 0)
+            .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
+            .eq(News::getDeleteMark, DeleteMark.NODELETE.getCode())
+            .innerJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId)
+        );
+        return RT.ok(count);
+    }
 }

+ 75 - 0
src/main/java/com/xjrsoft/module/room/controller/RoomBedAdjustController.java

@@ -0,0 +1,75 @@
+package com.xjrsoft.module.room.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+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.AdjustBedPageDto;
+import com.xjrsoft.module.room.dto.AdjustClassPageDto;
+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.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.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+* @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.getBedStudetInfo(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<AdjustBedStudentPageVo> pageOutput = ConventPage.getPageOutput(page, AdjustBedStudentPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
+    @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);
+    }
+
+
+    @DeleteMapping
+    @ApiOperation(value = "批量移出学生")
+    @SaCheckPermission("roomBedAdjust:delete")
+    public RT<Boolean> delete(@Valid @RequestBody Long id){
+        return RT.ok(roomBedService.clearStudentInfoByRoomId(id));
+    }
+}

+ 5 - 1
src/main/java/com/xjrsoft/module/room/controller/RoomController.java

@@ -94,7 +94,11 @@ public class RoomController {
     @ApiOperation(value = "删除寝室")
     @SaCheckPermission("room:delete")
     public RT<Boolean> delete(@Valid @RequestBody Long id){
-        return RT.ok(roomService.deleteReachBed(id));
+        String result = roomService.deleteReachBed(id);
+        if("ok".equals(result)){
+            return RT.ok(true);
+        }
+        return RT.error(result);
 
     }
     @PostMapping("/import")

+ 25 - 0
src/main/java/com/xjrsoft/module/room/dto/AdjustBedPageDto.java

@@ -0,0 +1,25 @@
+package com.xjrsoft.module.room.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+* @title: 寝室床位分页查询入参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class AdjustBedPageDto extends PageInput {
+
+    @ApiModelProperty("年级id")
+    public Long gradeId;
+
+    @ApiModelProperty("年级id")
+    public Long classId;
+
+}

+ 25 - 0
src/main/java/com/xjrsoft/module/room/dto/AdjustClassPageDto.java

@@ -0,0 +1,25 @@
+package com.xjrsoft.module.room.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+* @title: 寝室床位分页查询入参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class AdjustClassPageDto extends PageInput {
+
+    @ApiModelProperty("年级id")
+    public Long gradeId;
+
+    @ApiModelProperty("年级id")
+    public Long classId;
+
+}

+ 1 - 19
src/main/java/com/xjrsoft/module/room/dto/DistributeClassPageDto.java

@@ -16,28 +16,10 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = false)
 public class DistributeClassPageDto extends PageInput {
 
-    @ApiModelProperty("楼栋id")
-    public Long officeBuildId;
-
-    @ApiModelProperty("楼层")
-    public Integer floorNumber;
-
-
-    @ApiModelProperty("寝室id")
-    public Long roomId;
-
-    @ApiModelProperty("入住性别")
-    public String gender;
-
-    @ApiModelProperty("寝室id")
+    @ApiModelProperty("年级id")
     public Long gradeId;
 
     @ApiModelProperty("年级id")
     public Long classId;
 
-    @ApiModelProperty("寝室id")
-    public String studentName;
-
-    @ApiModelProperty("学号")
-    public String studentId;
 }

+ 30 - 0
src/main/java/com/xjrsoft/module/room/mapper/RoomBedMapper.java

@@ -2,14 +2,19 @@ package com.xjrsoft.module.room.mapper;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.room.dto.AdjustBedPageDto;
+import com.xjrsoft.module.room.dto.AdjustClassPageDto;
 import com.xjrsoft.module.room.dto.DistributeClassPageDto;
 import com.xjrsoft.module.room.dto.DistributeRoomBedDto;
 import com.xjrsoft.module.room.dto.DistributeRoomBedPageDto;
 import com.xjrsoft.module.room.dto.RoomBedPageDto;
 import com.xjrsoft.module.room.entity.RoomBed;
+import com.xjrsoft.module.room.vo.AdjustBedClassPageVo;
+import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
 import com.xjrsoft.module.room.vo.DistributeClassPageVo;
 import com.xjrsoft.module.room.vo.DistributeResultListVo;
 import com.xjrsoft.module.room.vo.DistributeRoomBedPageVo;
+import com.xjrsoft.module.room.vo.NoBedStudentPageVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import com.xjrsoft.module.room.vo.RoomBedVo;
 import org.apache.ibatis.annotations.Mapper;
@@ -52,4 +57,29 @@ public interface RoomBedMapper extends MPJBaseMapper<RoomBed> {
      */
     List<DistributeResultListVo> getDistributeResult(@Param("dto") DistributeRoomBedDto dto);
 
+    /**
+     * 调整床位,左边的班级学生信息
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<AdjustBedClassPageVo> getClassStudetBed(Page<AdjustBedClassPageVo> page, @Param("dto") AdjustClassPageDto dto);
+
+    /**
+     * 调整床位,右边的床位学生信息
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<AdjustBedStudentPageVo> getBedStudentInfo(Page<AdjustBedStudentPageVo> page, @Param("dto") AdjustBedPageDto dto);
+
+
+    /**
+     * 未分配床位的学生信息
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<NoBedStudentPageVo> getNoBedStudent(Page<NoBedStudentPageVo> page, AdjustBedPageDto dto);
+
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/room/mapper/RoomBedRecordMapper.java

@@ -12,5 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
 */
 @Mapper
 public interface RoomBedRecordMapper extends MPJBaseMapper<RoomBedRecord> {
-
+    Integer getMaxSortCode();
 }

+ 30 - 1
src/main/java/com/xjrsoft/module/room/service/IRoomBedService.java

@@ -2,15 +2,19 @@ package com.xjrsoft.module.room.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.room.dto.AdjustBedPageDto;
+import com.xjrsoft.module.room.dto.AdjustClassPageDto;
 import com.xjrsoft.module.room.dto.DistributeClassPageDto;
 import com.xjrsoft.module.room.dto.DistributeRoomBedDto;
 import com.xjrsoft.module.room.dto.DistributeRoomBedPageDto;
 import com.xjrsoft.module.room.dto.RoomBedPageDto;
 import com.xjrsoft.module.room.entity.RoomBed;
+import com.xjrsoft.module.room.vo.AdjustBedClassPageVo;
+import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
 import com.xjrsoft.module.room.vo.DistributeClassPageVo;
 import com.xjrsoft.module.room.vo.DistributeResultClassVo;
-import com.xjrsoft.module.room.vo.DistributeResultListVo;
 import com.xjrsoft.module.room.vo.DistributeRoomBedPageVo;
+import com.xjrsoft.module.room.vo.NoBedStudentPageVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 
 import java.util.List;
@@ -35,6 +39,8 @@ public interface IRoomBedService extends MPJBaseService<RoomBed> {
 
     Boolean clearStudentInfo(List<Long> ids);
 
+    Boolean clearStudentInfoByRoomId(Long id);
+
     /**
      * 分配床位,第一步查询班级
      * @param page
@@ -60,4 +66,27 @@ public interface IRoomBedService extends MPJBaseService<RoomBed> {
      */
     List<DistributeResultClassVo> getDistributeResult(DistributeRoomBedDto dto);
 
+    /**
+     * 调整床位,左边的班级学生信息
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<AdjustBedClassPageVo> getClassStudetBed(Page<AdjustBedClassPageVo> page, AdjustClassPageDto dto);
+
+    /**
+     * 调整床位,右边的床位学生信息
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<AdjustBedStudentPageVo> getBedStudetInfo(Page<AdjustBedStudentPageVo> page, AdjustBedPageDto dto);
+
+    /**
+     * 未分配床位的学生信息
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<NoBedStudentPageVo> getNoBedStudent(Page<NoBedStudentPageVo> page, AdjustBedPageDto dto);
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/room/service/IRoomService.java

@@ -35,5 +35,5 @@ public interface IRoomService extends MPJBaseService<Room> {
     /**
      * 批量添加
      */
-    Boolean deleteReachBed(Long id);
+    String deleteReachBed(Long id);
 }

+ 52 - 4
src/main/java/com/xjrsoft/module/room/service/impl/RoomBedServiceImpl.java

@@ -10,6 +10,8 @@ import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.mapper.BaseClassMapper;
+import com.xjrsoft.module.room.dto.AdjustBedPageDto;
+import com.xjrsoft.module.room.dto.AdjustClassPageDto;
 import com.xjrsoft.module.room.dto.DistributeClassPageDto;
 import com.xjrsoft.module.room.dto.DistributeRoomBedDto;
 import com.xjrsoft.module.room.dto.DistributeRoomBedPageDto;
@@ -21,10 +23,13 @@ import com.xjrsoft.module.room.mapper.RoomBedMapper;
 import com.xjrsoft.module.room.mapper.RoomBedRecordMapper;
 import com.xjrsoft.module.room.mapper.RoomMapper;
 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.DistributeClassPageVo;
 import com.xjrsoft.module.room.vo.DistributeResultClassVo;
 import com.xjrsoft.module.room.vo.DistributeResultListVo;
 import com.xjrsoft.module.room.vo.DistributeRoomBedPageVo;
+import com.xjrsoft.module.room.vo.NoBedStudentPageVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import com.xjrsoft.module.room.vo.RoomBedVo;
 import com.xjrsoft.module.room.vo.RoomClassCountVo;
@@ -71,6 +76,18 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
         return true;
     }
 
+    @Override
+    public Boolean clearStudentInfoByRoomId(Long id) {
+        List<RoomBed> bedList = roomBedMapper.selectList(
+                MPJWrappers.<RoomBed>lambdaJoin().eq(RoomBed::getRoomId, id)
+        );
+        for (RoomBed roomBed : bedList) {
+            roomBed.setStudentUserId(null);
+            roomBedMapper.updateById(roomBed);
+        }
+        return true;
+    }
+
     @Override
     public Page<DistributeClassPageVo> getDistributeClassInfo(Page<DistributeClassPageVo> page, DistributeClassPageDto dto) {
         return roomBedMapper.getDistributeClassInfo(page, dto);
@@ -134,12 +151,27 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
             classDistributeBedNumber.put(classId, distributeBedNumber);
             classStudent.put(classId, studentList.size());
         }
+        Map<Long, Long> classGradeMap = new HashMap<>();
+        baseClassMapper.selectList(
+            MPJWrappers.<BaseClass>lambdaJoin().in(BaseClass::getId, dto.getClassIds())
+        ).forEach((baseClass)->{
+            classGradeMap.put(baseClass.getId(), baseClass.getGradeId());
+        });
         //插入记录表 room_bed_record
-        classStudent.forEach((classId, studentCount)->{
+        Integer maxSortCode = roomBedRecordMapper.getMaxSortCode();
+        for (Long classId : classGradeMap.keySet()) {
+            maxSortCode ++;
+            Integer studentCount = classStudent.get(classId);
             RoomBedRecord record = new RoomBedRecord();
-//            record.setClassId();
-//            roomBedRecordMapper.insert();
-        });
+            record.setClassId(classId);
+            record.setGradeId(classGradeMap.get(classId));
+            record.setCreateDate(modifyDate);
+            record.setSortCode(maxSortCode);
+            record.setNeedBedNumber(classStudent.get(classId));
+            record.setDistributeBedNumber(classDistributeBedNumber.get(classId));
+            record.setDeleteMark(DeleteMark.NODELETE.getCode());
+            roomBedRecordMapper.insert(record);
+        }
 
         //查询每个寝室住入的班级数量,大于2的设置为混合寝室
         List<RoomClassCountVo> classCountVoList = roomMapper.getRoomClassCount(dto.getRoomIds());
@@ -176,4 +208,20 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
         }
         return result;
     }
+
+    @Override
+    public Page<AdjustBedClassPageVo> getClassStudetBed(Page<AdjustBedClassPageVo> page, AdjustClassPageDto dto) {
+        Page<AdjustBedClassPageVo> result = roomBedMapper.getClassStudetBed(page, dto);
+        return result;
+    }
+
+    @Override
+    public Page<AdjustBedStudentPageVo> getBedStudetInfo(Page<AdjustBedStudentPageVo> page, AdjustBedPageDto dto) {
+        return roomBedMapper.getBedStudentInfo(page, dto);
+    }
+
+    @Override
+    public Page<NoBedStudentPageVo> getNoBedStudent(Page<NoBedStudentPageVo> page, AdjustBedPageDto dto) {
+        return roomBedMapper.getNoBedStudent(page, dto);
+    }
 }

+ 12 - 2
src/main/java/com/xjrsoft/module/room/service/impl/RoomServiceImpl.java

@@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.toolkit.MPJWrappers;
 import com.xjrsoft.module.room.dto.AddRoomDto;
 import com.xjrsoft.module.room.dto.RoomPageDto;
 import com.xjrsoft.module.room.entity.Room;
@@ -12,6 +13,7 @@ import com.xjrsoft.module.room.mapper.RoomBedMapper;
 import com.xjrsoft.module.room.mapper.RoomMapper;
 import com.xjrsoft.module.room.service.IRoomService;
 import com.xjrsoft.module.room.vo.RoomPageVo;
+import com.xjrsoft.module.student.entity.BaseStudent;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
@@ -87,11 +89,19 @@ public class RoomServiceImpl extends MPJBaseServiceImpl<RoomMapper, Room> implem
     }
 
     @Override
-    public Boolean deleteReachBed(Long id) {
+    public String deleteReachBed(Long id) {
+        List<RoomBed> bedList = roomBedMapper.selectList(
+            MPJWrappers.<RoomBed>lambdaJoin()
+            .select(BaseStudent::getUserId)
+            .eq(RoomBed::getRoomId, id).isNotNull(RoomBed::getStudentUserId)
+        );
+        if(bedList != null && !bedList.isEmpty()){
+            return "寝室里面已安排学生,无法删除";
+        }
         roomMapper.deleteById(id);
         Map<String, Object> param = new HashMap<>();
         param.put("room_id", id);
         roomBedMapper.deleteByMap(param);
-        return true;
+        return "ok";
     }
 }

+ 48 - 0
src/main/java/com/xjrsoft/module/room/vo/AdjustBedClassPageVo.java

@@ -0,0 +1,48 @@
+package com.xjrsoft.module.room.vo;
+
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+* @title: 寝室床位分页列表出参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+public class AdjustBedClassPageVo {
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学生id")
+    private String userId;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级id")
+    private String classId;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学生名称")
+    private String studentName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("入住性别")
+    private String genderCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("楼栋名称")
+    private String buildName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("寝室名称")
+    private String roomName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("床位")
+    private String bedNumber;
+}

+ 53 - 0
src/main/java/com/xjrsoft/module/room/vo/AdjustBedStudentPageVo.java

@@ -0,0 +1,53 @@
+package com.xjrsoft.module.room.vo;
+
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+* @title: 寝室床位分页列表出参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+public class AdjustBedStudentPageVo {
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("床位id")
+    private String id;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("楼栋名称")
+    private String buildName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("寝室名称")
+    private String roomName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("入住性别")
+    private String genderCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("床位")
+    private String bedNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学生名称")
+    private String studentName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("寝室长id(null即为未设置寝室长,非空即为设置了寝室长)")
+    private String studentUserId;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("是否是混合寝室【一个寝室有多个班级的学生】(1:是 0:否)")
+    private Integer isMax;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("寝室id")
+    private String roomId;
+
+}

+ 33 - 0
src/main/java/com/xjrsoft/module/room/vo/NoBedStudentPageVo.java

@@ -0,0 +1,33 @@
+package com.xjrsoft.module.room.vo;
+
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+* @title: 寝室床位分页列表出参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+public class NoBedStudentPageVo {
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学生id")
+    private String userId;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("入住性别")
+    private String genderCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学生名称")
+    private String studentName;
+
+}

+ 42 - 2
src/main/resources/mapper/room/RoomBedMapper.xml

@@ -50,7 +50,7 @@
         LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
         LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
         WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
-        AND c3.code = 'FB3001' AND c2.class_id = t1.id) AS need_count,(
+        AND c3.code = 'FB3002' AND c2.class_id = t1.id) AS need_count,(
         SELECT COUNT(*) FROM room_bed a1
         LEFT JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id
         WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
@@ -64,7 +64,7 @@
         LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
         LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
         WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
-        AND c3.code = 'FB3001' AND c2.class_id = t1.id
+        AND c3.code = 'FB3002' AND c2.class_id = t1.id
         ) >
         (
         SELECT COUNT(*) FROM room_bed a1
@@ -72,6 +72,12 @@
         WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
         AND a2.class_id = t1.id
         )
+        <if test="dto.gradeId != null">
+            and t1.grade_id = #{dto.gradeId}
+        </if>
+        <if test="dto.classId != null">
+            and t1.class_id = #{dto.classId}
+        </if>
     </select>
     <select id="getDistributeRoomBedInfo" parameterType="com.xjrsoft.module.room.dto.DistributeRoomBedPageDto" resultType="com.xjrsoft.module.room.vo.DistributeRoomBedPageVo">
         SELECT t1.id,t1.sort_code,t2.name AS build_name,t1.floor_number,t1.room_name,t4.name AS gender_cn, t3.name AS check_in_status_cn,
@@ -128,4 +134,38 @@
         ORDER BY t2.sort_code,t1.sort_code
     </select>
 
+    <select id="getClassStudetBed" resultType="com.xjrsoft.module.room.vo.AdjustBedClassPageVo">
+        SELECT t1.user_id,t4.id AS class_id, t4.name AS class_name,t2.name AS student_name,REPLACE(REPLACE(t2.gender,1,'男'),2,'女') AS gender_cn,t7.name AS build_name,t6.room_name,t5.bed_number FROM base_student t1
+        LEFT JOIN xjr_user t2 ON t1.user_id = t2.id
+        LEFT JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
+        LEFT JOIN base_class t4 ON t3.class_id = t4.id
+        LEFT JOIN room_bed t5 ON t5.student_user_id = t1.user_id
+        LEFT JOIN room t6 ON t5.room_id = t6.id
+        LEFT JOIN base_office_build t7 ON t6.office_build_id = t7.id
+        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+    </select>
+
+    <select id="getBedStudentInfo" parameterType="com.xjrsoft.module.room.dto.AdjustBedPageDto" resultType="com.xjrsoft.module.room.vo.AdjustBedStudentPageVo">
+        SELECT t1.id,t3.name AS build_name,t2.room_name,t5.name AS gender_cn,t1.bed_number,t4.name AS student_name,t6.student_user_id,t2.is_max,t2.id as room_id FROM room_bed t1
+        LEFT JOIN room t2 ON t1.room_id = t2.id
+        LEFT JOIN base_office_build t3 ON t2.office_build_id = t3.id
+        LEFT JOIN xjr_user t4 ON t1.student_user_id = t4.id
+        LEFT JOIN xjr_dictionary_detail t5 ON t2.gender = t5.code AND t5.item_id = 2023000000000000004
+        LEFT JOIN room_student_appoint t6 ON t6.room_bed_id = t1.id
+        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+        ORDER BY t2.sort_code,t1.sort_code
+    </select>
+
+    <select id="getNoBedStudent" parameterType="com.xjrsoft.module.room.dto.AdjustBedPageDto" resultType="com.xjrsoft.module.room.vo.NoBedStudentPageVo">
+        SELECT t1.user_id, t2.name AS student_name,REPLACE(REPLACE(t2.gender,1,'男'),2,'女') as gender_cn,t4.name AS class_name FROM base_student t1
+        INNER JOIN xjr_user t2 ON t1.user_id = t2.id
+        LEFT JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
+        LEFT JOIN base_class t4 ON t3.class_id = t4.id
+        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+        AND t3.stduy_status = 'FB3001'
+        AND t1.user_id NOT IN (
+            SELECT student_user_id FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NOT NULL
+        )
+    </select>
+
 </mapper>

+ 9 - 0
src/main/resources/mapper/room/RoomBedRecordMapper.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xjrsoft.module.room.mapper.RoomBedRecordMapper">
+    <select id="getMaxSortCode" resultType="java.lang.Integer">
+        SELECT IFNULL(MAX(sort_code),0) FROM room_bed_record WHERE delete_mark = 0
+    </select>
+</mapper>

+ 1 - 2
src/main/resources/sqlScript/20231218_sql.sql

@@ -770,7 +770,6 @@ CREATE TABLE room_bed_record_item
     `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
     `room_bed_record_id` bigint NOT NULL COMMENT '寝室床位记录编号(room_bed_record)',
     `room_id` bigint NOT NULL COMMENT '寝室编号(room)',
-    `distribute_bed_number` int NULL DEFAULT 0 COMMENT '分配床位数',
     PRIMARY KEY (`id`)
 ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '寝室床位记录项';
 
@@ -918,7 +917,7 @@ CREATE TABLE room_value_week
 -- 宿管值班管理(人员)
 -- ----------------------------
 DROP TABLE IF EXISTS room_value_week_item;
-CREATE TABLE room_value_week
+CREATE TABLE room_value_week_item
 (
     id BIGINT NOT NULL COMMENT '主键编号',
     `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',