|
@@ -0,0 +1,34 @@
|
|
|
|
+package com.sky.ioc.service.strategy.impl;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.sky.ioc.entity.domain.strategy.MeetingRoom;
|
|
|
|
+import com.sky.ioc.mapper.strategy.MeetingRoomMapper;
|
|
|
|
+import com.sky.ioc.service.strategy.MeetingRoomService;
|
|
|
|
+import com.sky.ioc.tool.ReturnMsg;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class MeetingRoomServiceImpl implements MeetingRoomService {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ MeetingRoomMapper meetingRoomMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ReturnMsg getList() {
|
|
|
|
+ List<MeetingRoom> rooms = meetingRoomMapper.selectList(null);
|
|
|
|
+ List<Integer> floors = rooms.stream().map(MeetingRoom::getFloorId).collect(Collectors.toList());
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+ for(Integer floor : floors){
|
|
|
|
+ String[] names = meetingRoomMapper.selectList(new LambdaQueryWrapper<MeetingRoom>().eq(MeetingRoom::getFloorId,floor))
|
|
|
|
+ .stream().map(MeetingRoom::getName).collect(Collectors.toList()).toArray(new String[0]);
|
|
|
|
+ json.put(floor+"",names);
|
|
|
|
+ }
|
|
|
|
+ return ReturnMsg.ok(json);
|
|
|
|
+ }
|
|
|
|
+}
|