package com.zksy.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zksy.api.domain.AlarmData;
import com.zksy.api.mapper.AlarmDataMapper;
import com.zksy.api.service.AlarmDataService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData> 
    implements AlarmDataService {
    @Override
    public boolean saveAlarmData(AlarmData alarmData) {
        if (alarmData.getAlarmTime() == null) {
            alarmData.setAlarmTime(LocalDateTime.now());
        }
        if (alarmData.getCreateTime() == null) {
            alarmData.setCreateTime(LocalDateTime.now());
        }
        if (alarmData.getAlarmStatus() == null) {
            alarmData.setAlarmStatus(0);
        }
        return this.save(alarmData);
    }
}
