package com.xueyi.system.device.service.impl;

import com.xueyi.common.web.annotation.TenantIgnore;
import com.xueyi.system.api.device.domain.dto.DmDeviceTenantMergeDto;
import com.xueyi.system.api.device.domain.po.DmDeviceTenantMergePo;
import com.xueyi.system.device.domain.query.DmDeviceTenantMergeQuery;
import com.xueyi.system.device.mapper.DmDeviceTenantMergeMapper;
import com.xueyi.system.device.service.IDmDeviceTenantMergeService;
import com.xueyi.system.device.manager.IDmDeviceTenantMergeManager;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import com.xueyi.tenant.api.source.domain.po.TeSourcePo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备租户（企业）关联管理 服务层处理
 *
 * @author xueyi
 */
@Service
public class DmDeviceTenantMergeServiceImpl extends BaseServiceImpl<DmDeviceTenantMergeQuery, DmDeviceTenantMergeDto, IDmDeviceTenantMergeManager> implements IDmDeviceTenantMergeService {

    @Autowired
    private DmDeviceTenantMergeMapper dmDeviceTenantMergeMapper;
    /**
     * 查询设备租户（企业）关联对象列表 | 数据权限
     *
     * @param dmDeviceTenantMerge 设备租户（企业）关联对象
     * @return 设备租户（企业）关联对象集合
     */
    @Override
    //@DataScope(userAlias = "createBy", mapperScope = {"DmDeviceTenantMergeMapper"})
    public List<DmDeviceTenantMergeDto> selectListScope(DmDeviceTenantMergeQuery dmDeviceTenantMerge) {
        return baseManager.selectList(dmDeviceTenantMerge);
    }

    @Override
    public DmDeviceTenantMergePo selectByDevId(String devId) {
        return dmDeviceTenantMergeMapper.selectByDevId(devId);
    }


    @TenantIgnore(tenantLine = true)
    @Override
    public TeSourcePo selectSourceByTenantId(Long tenantId) {
        return dmDeviceTenantMergeMapper.selectSourceByTenantId(tenantId);
    }

    @Override
    public DmDeviceTenantMergePo selectByDevSn(String devSn) {
        return dmDeviceTenantMergeMapper.selectByDevSn(devSn);
    }

    @TenantIgnore(tenantLine = true)
    @Override
    public int insert(DmDeviceTenantMergeDto dto) {
        return super.insert(dto);
    }
}