lyhzzz преди 2 години
родител
ревизия
5428094c75
променени са 1 файла, в които са добавени 12 реда и са изтрити 3 реда
  1. 12 3
      src/main/java/com/fdkankan/tk/service/impl/RoomServiceImpl.java

+ 12 - 3
src/main/java/com/fdkankan/tk/service/impl/RoomServiceImpl.java

@@ -76,12 +76,21 @@ public class RoomServiceImpl extends ServiceImpl<IRoomMapper, Room> implements I
         if (StringUtils.isNotBlank(param.getRoomTitle()) ) {
             wrapper.like(Room::getRoomTitle,param.getRoomTitle());
         }
-        wrapper.orderByAsc(Room::getRoomStatus);
         wrapper.orderByDesc(Room::getLastLookTime);
         wrapper.orderByDesc(Room::getCreateTime);
 
         Page<Room> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
-
+        List<Room> closeRoomList = new ArrayList<>();
+        List<Room> openRoomList = new ArrayList<>();
+        for (Room record : page.getRecords()) {
+            if(record.getRoomStatus() == 2){
+                closeRoomList.add(record);
+            }else {
+                openRoomList.add(record);
+            }
+        }
+        openRoomList.addAll(closeRoomList);
+        page.setRecords(openRoomList);
         return PageInfo.PageInfo(page);
     }
 
@@ -216,7 +225,7 @@ public class RoomServiceImpl extends ServiceImpl<IRoomMapper, Room> implements I
         }
         if(type == 0 ){
             room.setLastLookTime(DateUtil.formatDateTime(new Date()));
-            room.setRoomStatus(0);
+            room.setRoomStatus(1);
         }
         if(type == 1 ){
             room.setLastLookTime(DateUtil.formatDateTime(new Date()));