ScenePlusServiceImpl.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package com.fdkankan.manage.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4. import com.fdkankan.common.util.DateUtil;
  5. import com.fdkankan.manage.httpClient.service.LaserService;
  6. import com.fdkankan.manage.entity.*;
  7. import com.fdkankan.manage.mapper.IScenePlusMapper;
  8. import com.fdkankan.manage.service.*;
  9. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  10. import com.fdkankan.manage.vo.response.GroupByCount;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Service;
  13. import java.util.ArrayList;
  14. import java.util.Date;
  15. import java.util.HashMap;
  16. import java.util.List;
  17. /**
  18. * <p>
  19. * 场景主表 服务实现类
  20. * </p>
  21. *
  22. * @author
  23. * @since 2022-08-02
  24. */
  25. @Service
  26. public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlus> implements IScenePlusService {
  27. @Autowired
  28. ISceneProService sceneProService;
  29. @Autowired
  30. LaserService laserService;
  31. @Override
  32. public ScenePlus getByNum(String sceneNum) {
  33. LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
  34. wrapper.eq(ScenePlus::getNum,sceneNum);
  35. List<ScenePlus> list = this.list(wrapper);
  36. if(list!=null && list.size() >0){
  37. return list.get(0);
  38. }
  39. return null;
  40. }
  41. @Override
  42. public void unbindCamera(Long cameraId) {
  43. LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
  44. wrapper.set(ScenePlus::getUserId,null)
  45. .eq(ScenePlus::getCameraId,cameraId);
  46. this.update(wrapper);
  47. }
  48. @Override
  49. public HashMap<Long, Long> getCountGroupByUserId(List<Long> userIdList,Integer isObj) {
  50. HashMap<Long,Long> map = new HashMap<>();
  51. List<GroupByCount> result = this.getBaseMapper().getCountGroupByUserId(userIdList,isObj);
  52. result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
  53. return map;
  54. }
  55. @Override
  56. public HashMap<Long, Long> getCountGroupByCameraId(ArrayList<Long> cameraIds) {
  57. HashMap<Long,Long> map = new HashMap<>();
  58. List<GroupByCount> result = this.getBaseMapper().getCountGroupByCameraId(cameraIds);
  59. result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
  60. return map;
  61. }
  62. }