package com.gyee.alarm.service.auto.impl;

import com.gyee.alarm.model.auto.ProBasicDeviceStructure;
import com.gyee.alarm.mapper.auto.ProBasicDeviceStructureMapper;
import com.gyee.alarm.service.auto.IProBasicDeviceStructureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyee.alarm.util.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 设备结构 服务实现类
 * </p>
 *
 * @author shilin
 * @since 2023-08-01
 */
@Service
public class ProBasicDeviceStructureServiceImpl extends ServiceImpl<ProBasicDeviceStructureMapper, ProBasicDeviceStructure> implements IProBasicDeviceStructureService {


    @Resource
    private ProBasicDeviceStructureMapper proBasicDeviceStructureMapper;
   public ProBasicDeviceStructure getDeviceStructureByCode(String deviceId, String nodeCode)
   {
       ProBasicDeviceStructure vo=new ProBasicDeviceStructure();

       if(StringUtils.notEmp(deviceId) && StringUtils.notEmp(nodeCode))
       {
           vo=proBasicDeviceStructureMapper.getDeviceStructureByCode(deviceId,nodeCode);
       }
       return vo;
   }

    public List<ProBasicDeviceStructure> getDeviceStructureByDeviceId(String deviceId)
    {
        List<ProBasicDeviceStructure> vos=new ArrayList<>();

        if(StringUtils.notEmp(deviceId) )
        {
            vos=proBasicDeviceStructureMapper.getDeviceStructureByDeviceId(deviceId);
        }
        return vos;
    }

    public List<ProBasicDeviceStructure> getDeviceStructureChildNode(String deviceId, String nodeCode)
    {
        List<ProBasicDeviceStructure> vos=new ArrayList<>();

        if(StringUtils.notEmp(deviceId) && StringUtils.notEmp(nodeCode))
        {
            vos=proBasicDeviceStructureMapper.getDeviceStructureChildNode(deviceId,nodeCode);
        }
        return vos;
    }
}
