|
|
@@ -2,6 +2,9 @@ package com.xjrsoft.module.room.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
@@ -12,6 +15,7 @@ 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.AdjustStudentBedDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeClassPageDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeRoomBedDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeRoomBedPageDto;
|
|
|
@@ -24,6 +28,7 @@ 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.AdjustBedClassStudentPageVo;
|
|
|
import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeClassPageVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeResultClassVo;
|
|
|
@@ -71,7 +76,16 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
for (Long id : ids) {
|
|
|
RoomBed roomBed = roomBedMapper.selectById(id);
|
|
|
roomBed.setStudentUserId(null);
|
|
|
- roomBedMapper.updateById(roomBed);
|
|
|
+// RoomBed roomBedData = BeanUtil.toBean(roomBed, RoomBed.class);
|
|
|
+// roomBedMapper.updateById(new RoomBed(){{
|
|
|
+// setId(id);
|
|
|
+// setStudentUserId(null);
|
|
|
+// }});
|
|
|
+ UpdateWrapper<RoomBed> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", id);
|
|
|
+ updateWrapper.setSql("student_user_id = null");
|
|
|
+ updateWrapper.setSql("is_check_in = 0");
|
|
|
+ roomBedMapper.update(roomBed, updateWrapper);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -82,12 +96,27 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
MPJWrappers.<RoomBed>lambdaJoin().eq(RoomBed::getRoomId, id)
|
|
|
);
|
|
|
for (RoomBed roomBed : bedList) {
|
|
|
- roomBed.setStudentUserId(null);
|
|
|
- roomBedMapper.updateById(roomBed);
|
|
|
+ UpdateWrapper<RoomBed> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", roomBed.getId());
|
|
|
+ updateWrapper.setSql("student_user_id = null");
|
|
|
+ updateWrapper.setSql("is_check_in = 0");
|
|
|
+ roomBedMapper.update(roomBed, updateWrapper);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean clearStudentInfoByBedId(Long id) {
|
|
|
+ UpdateWrapper<RoomBed> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", id);
|
|
|
+ updateWrapper.setSql("student_user_id = null");
|
|
|
+ updateWrapper.setSql("is_check_in = 0");
|
|
|
+
|
|
|
+ RoomBed roomBed = roomBedMapper.selectById(id);
|
|
|
+ roomBedMapper.update(roomBed, updateWrapper);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Page<DistributeClassPageVo> getDistributeClassInfo(Page<DistributeClassPageDto> page, DistributeClassPageDto dto) {
|
|
|
return roomBedMapper.getDistributeClassInfo(page, dto);
|
|
|
@@ -210,18 +239,45 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<AdjustBedClassPageVo> getClassStudetBed(Page<AdjustClassPageDto> page, AdjustClassPageDto dto) {
|
|
|
- Page<AdjustBedClassPageVo> result = roomBedMapper.getClassStudetBed(page, dto);
|
|
|
+ public List<AdjustBedClassPageVo> getClassStudetBed(AdjustClassPageDto dto) {
|
|
|
+ List<BaseClass> classList = baseClassMapper.selectList(
|
|
|
+ new QueryWrapper<BaseClass>().lambda()
|
|
|
+ .eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .eq(ObjectUtil.isNotNull(dto.getClassId()), BaseClass::getId, dto.getClassId())
|
|
|
+ .eq(ObjectUtil.isNotNull(dto.getGradeId()), BaseClass::getGradeId, dto.getGradeId())
|
|
|
+ );
|
|
|
+ List<AdjustBedClassPageVo> result = BeanUtil.copyToList(classList, AdjustBedClassPageVo.class);
|
|
|
+ List<AdjustBedClassStudentPageVo> allStudent = roomBedMapper.getClassStudetBed(dto);
|
|
|
+ for (AdjustBedClassPageVo adjustBedClassPageVo : result) {
|
|
|
+ List<AdjustBedClassStudentPageVo> studentList = new ArrayList<>();
|
|
|
+ for (AdjustBedClassStudentPageVo adjustBedClassStudentPageVo : allStudent) {
|
|
|
+ if(!adjustBedClassPageVo.getId().equals(adjustBedClassStudentPageVo.getClassId())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ studentList.add(adjustBedClassStudentPageVo);
|
|
|
+ }
|
|
|
+ adjustBedClassPageVo.setStudentList(studentList);
|
|
|
+ }
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<AdjustBedStudentPageVo> getBedStudetInfo(Page<AdjustBedPageDto> page, AdjustBedPageDto dto) {
|
|
|
- return roomBedMapper.getBedStudentInfo(page, dto);
|
|
|
+ public List<AdjustBedStudentPageVo> getBedStudetInfo(AdjustBedPageDto dto) {
|
|
|
+ return roomBedMapper.getBedStudentInfo(dto);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Page<NoBedStudentPageVo> getNoBedStudent(Page<AdjustBedPageDto> page, AdjustBedPageDto dto) {
|
|
|
return roomBedMapper.getNoBedStudent(page, dto);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean adjustBed(AdjustStudentBedDto dto) {
|
|
|
+ roomBedMapper.updateById(new RoomBed(){{
|
|
|
+ setId(dto.getBedId());
|
|
|
+ setStudentUserId(dto.getStudentUserId());
|
|
|
+ }});
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|