package com.zcxk.charge.web.service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcxk.charge.api.dto.*;
import com.zcxk.charge.api.vo.*;
import com.zcxk.charge.core.dao.ComdisplayMapLocationMapper;
import com.zcxk.charge.core.dao.MonitorDataReportMapper;
import com.zcxk.charge.core.dao.OnlineMonitorMapper;
import com.zcxk.charge.core.entity.ComdisplayMapLocationEntity;
import com.zcxk.charge.core.entity.MonitorDataEntity;
import com.zcxk.charge.core.entity.MonitorDataValueEntity;
import com.zcxk.charge.core.entity.SceneEntity;
import com.zcxk.charge.web.util.OrgInfoUtil;
import com.zcxk.core.common.util.BeanCopyUtils;
import com.zcxk.core.oauth2.pojo.LoginUser;
import com.zcxk.core.oauth2.util.UserUtil;
import com.zcxk.core.utils.ByteArrayUtils;
import com.zcxk.core.utils.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;

/**
 * 地图坐标Service接口
 * @author: WYY
 * @date 2021-02-24 09:58
 */
@Service
public class ComdisplayMapLocationService extends ServiceImpl<ComdisplayMapLocationMapper, ComdisplayMapLocationEntity> {

    @Resource
    private ComdisplayMapLocationMapper comdisplayMapLocationMapper;

    public List<ComdisplayMapLocationEntity> findList(ComdisplayMapLocationEntity comdisplayMapLocationEntity) {
        return comdisplayMapLocationMapper.findList(comdisplayMapLocationEntity);
    }

    @Transactional(rollbackFor = Exception.class)
    public boolean delComdisplayMapLocationByIds(Long[] ids) {
        return this.removeByIds(Arrays.asList(ids));
    }

    public boolean updateComdisplayMapLocationById(ComdisplayMapLocationEntity location) {
        return this.updateById(location);
    }

    public List<ComdisplayInfoVo> selectMapDataForSingleCompany(Integer companyOrgId) {
        return  comdisplayMapLocationMapper.selectMapDataForSingleCompany(UserUtil.getCurrentUser().getTenantId(), companyOrgId);
    }
}
