Commit ee464a1d authored by 刘林's avatar 刘林

fix(equip):视频排序接口优化

parent 002890f9
...@@ -19,6 +19,4 @@ public interface VideoImportantEquipmentMapper extends BaseMapper<VideoImportant ...@@ -19,6 +19,4 @@ public interface VideoImportantEquipmentMapper extends BaseMapper<VideoImportant
List<VideoImportantEquipmentVo> getVideoList(Map<String, Object> map); List<VideoImportantEquipmentVo> getVideoList(Map<String, Object> map);
List<String> getVideoAddressGroupList(Map<String, Object> map);
} }
...@@ -7,12 +7,7 @@ import com.yeejoin.equipmanage.mapper.VideoImportantEquipmentMapper; ...@@ -7,12 +7,7 @@ import com.yeejoin.equipmanage.mapper.VideoImportantEquipmentMapper;
import com.yeejoin.equipmanage.service.IVideoImportantEquipmentService; import com.yeejoin.equipmanage.service.IVideoImportantEquipmentService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -33,19 +28,12 @@ public class VideoImportantEquipmentServiceImpl extends ServiceImpl<VideoImporta ...@@ -33,19 +28,12 @@ public class VideoImportantEquipmentServiceImpl extends ServiceImpl<VideoImporta
@Override @Override
public List<Map<String, List<VideoImportantEquipmentVo>>> getVideoList(Map<String, Object> map) { public List<Map<String, List<VideoImportantEquipmentVo>>> getVideoList(Map<String, Object> map) {
ArrayList<Map<String, List<VideoImportantEquipmentVo>>> maps = new ArrayList<>();
List<VideoImportantEquipmentVo> videoList = videoImportantEquipmentMapper.getVideoList(map); List<VideoImportantEquipmentVo> videoList = videoImportantEquipmentMapper.getVideoList(map);
List<String> videoAddressGroupList = videoImportantEquipmentMapper.getVideoAddressGroupList(map); return videoList.stream()
for (String address : videoAddressGroupList) { .collect(Collectors.groupingBy(VideoImportantEquipmentVo::getAddress,LinkedHashMap::new,Collectors.toList()))
if (!ObjectUtils.isEmpty(address)) { .entrySet().stream()
List<VideoImportantEquipmentVo> collect = videoList.stream().filter(item -> item.getAddress().equals(address)).collect(Collectors.toList()); .map(entry -> Collections.singletonMap(entry.getKey(), entry.getValue()))
if (collect.size() > 0) { .collect(Collectors.toList());
HashMap<String, List<VideoImportantEquipmentVo>> listMap = new HashMap<>();
listMap.put(address, collect);
maps.add(listMap);
}
}
}
return maps;
} }
} }
...@@ -44,18 +44,4 @@ ...@@ -44,18 +44,4 @@
</where> </where>
ORDER BY v.create_date DESC ORDER BY v.create_date DESC
</select> </select>
<select id="getVideoAddressGroupList" resultType="java.lang.String">
SELECT
v.address
FROM
wl_video v
<where>
<if test="importantEquipmentId != null">
v.id in (select video_id from wl_video_important_equipment
where important_equipment_id = #{importantEquipmentId})
</if>
</where>
GROUP BY v.address
ORDER BY v.create_date DESC
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment