ProBasicEquipmentPointServiceImpl.java 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package com.gyee.power.fitting.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.gyee.power.fitting.common.base.ExcludeQueryWrapper;
  4. import com.gyee.power.fitting.model.ProBasicEquipmentPoint;
  5. import com.gyee.power.fitting.mapper.ProBasicEquipmentPointMapper;
  6. import com.gyee.power.fitting.service.ProBasicEquipmentPointService;
  7. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  8. import org.apache.commons.lang3.StringUtils;
  9. import org.springframework.cache.annotation.Cacheable;
  10. import org.springframework.stereotype.Service;
  11. import java.util.ArrayList;
  12. import java.util.List;
  13. /**
  14. * <p>
  15. * 设备测点 服务实现类
  16. * </p>
  17. *
  18. * @author chenmh
  19. * @since 2023-09-22
  20. */
  21. @Service
  22. public class ProBasicEquipmentPointServiceImpl extends ServiceImpl<ProBasicEquipmentPointMapper, ProBasicEquipmentPoint> implements ProBasicEquipmentPointService {
  23. @Override
  24. public List<ProBasicEquipmentPoint> selectList(String station, List<String> points) {
  25. List<ProBasicEquipmentPoint> list = new ArrayList();
  26. ExcludeQueryWrapper wrapper = new ExcludeQueryWrapper();
  27. wrapper.eq("windpowerstation_id", station);
  28. wrapper.in("uniform_code", points);
  29. try{
  30. list = baseMapper.selectList(wrapper);
  31. }catch (Exception e){
  32. log.error("ProBasicEquipmentPoint--selectList", e);
  33. }
  34. return list;
  35. }
  36. @Override
  37. @Cacheable("wtpoint")
  38. public List<ProBasicEquipmentPoint> getPoints(String station, String windturbine, String uniformcode) {
  39. QueryWrapper<ProBasicEquipmentPoint> wrapper = new QueryWrapper<>();
  40. if ("GDC".equals(station)) {
  41. wrapper.like("windpowerstation_id", "_GDC_STA");
  42. } else if ("FDC".equals(station)) {
  43. wrapper.like("windpowerstation_id", "_FDC_STA");
  44. } else {
  45. wrapper.eq(StringUtils.isNotEmpty(station), "windpowerstation_id", station);
  46. }
  47. wrapper.eq(StringUtils.isNotEmpty(windturbine), "windturbine_id", windturbine);
  48. wrapper.eq("uniform_code", uniformcode).orderByAsc("windturbine_id");
  49. return baseMapper.selectList(wrapper);
  50. }
  51. }