package com.ozs.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ozs.entity.TerminalHeartbeatLog;
import com.ozs.mapper.TerminalHeartbeatLogMapper;
import com.ozs.service.TerminalHeartbeatLogService;
import org.springframework.stereotype.Service;

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

/**
 * 心跳接口相机记录表 服务类实现类
 */
@Service
public class TerminalHeartbeatLogServiceImpl extends ServiceImpl<TerminalHeartbeatLogMapper, TerminalHeartbeatLog> implements TerminalHeartbeatLogService {
    
    
    
    @Override
    public void add(String code,String channel){
        TerminalHeartbeatLog terminalHeartbeatLog=new TerminalHeartbeatLog();
        terminalHeartbeatLog.setId((long) (baseMapper.selectCount(new QueryWrapper<>()) + 1));
        terminalHeartbeatLog.setCameraCode(code);
        terminalHeartbeatLog.setChannel(channel);
        terminalHeartbeatLog.setCreateTime(new Date());
        baseMapper.insert(terminalHeartbeatLog);
    }

    @Override
    public List<TerminalHeartbeatLog> terminalHeartbeatLogList() {
        return baseMapper.terminalHeartbeatLogList();
    }
}
