package cn.iocoder.yudao.module.pms.service.yanfan;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.pms.controller.admin.yanfan.vo.DevicePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.YfDeviceDO;
import cn.iocoder.yudao.module.pms.dal.mysql.yanfan.YfDeviceMapper;
import com.baomidou.dynamic.datasource.annotation.Slave;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

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

/**
 * 设备 Service 实现类
 *
 * @author 李鹏辉
 */
@Service
@Validated
public class YfDeviceServiceImpl implements YfDeviceService {

    @Resource
    private YfDeviceMapper yfDeviceMapper;

    @Override
    public YfDeviceDO getDevice(Long id) {
        return yfDeviceMapper.selectById(id);
    }

    @Override
    @Slave
    public PageResult<YfDeviceDO> getDevicePage(DevicePageReqVO pageReqVO) {
        return yfDeviceMapper.selectPage(pageReqVO);
    }

    @Override
    @Slave
    @TenantIgnore
    public List<YfDeviceDO> getAllDeviceByColumn(String column, String value) {
        return yfDeviceMapper.selectList(column, value);
    }

    @Override
    @Slave
    @TenantIgnore
    public List<YfDeviceDO> getAllDevice() {
        return yfDeviceMapper.selectList(null);
    }

}
