package com.gyee.power.fitting.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.power.fitting.common.base.ExcludeQueryWrapper;
import com.gyee.power.fitting.model.ProBasicEquipmentPoint;
import com.gyee.power.fitting.mapper.ProBasicEquipmentPointMapper;
import com.gyee.power.fitting.service.ProBasicEquipmentPointService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
*
* 设备测点 服务实现类
*
*
* @author chenmh
* @since 2023-09-22
*/
@Service
public class ProBasicEquipmentPointServiceImpl extends ServiceImpl implements ProBasicEquipmentPointService {
@Override
public List selectList(String station, List points) {
List list = new ArrayList();
ExcludeQueryWrapper wrapper = new ExcludeQueryWrapper();
wrapper.eq("windpowerstation_id", station);
wrapper.in("uniform_code", points);
try{
list = baseMapper.selectList(wrapper);
}catch (Exception e){
log.error("ProBasicEquipmentPoint--selectList", e);
}
return list;
}
@Override
@Cacheable("wtpoint")
public List getPoints(String station, String windturbine, String uniformcode) {
QueryWrapper wrapper = new QueryWrapper<>();
if ("GDC".equals(station)) {
wrapper.like("windpowerstation_id", "_GDC_STA");
} else if ("FDC".equals(station)) {
wrapper.like("windpowerstation_id", "_FDC_STA");
} else {
wrapper.eq(StringUtils.isNotEmpty(station), "windpowerstation_id", station);
}
wrapper.eq(StringUtils.isNotEmpty(windturbine), "windturbine_id", windturbine);
wrapper.eq("uniform_code", uniformcode).orderByAsc("windturbine_id");
return baseMapper.selectList(wrapper);
}
}