package com.fs.watch.service.impl;

import com.fs.watch.domain.WatchFatigueData;
import com.fs.watch.mapper.WatchFatigueDataMapper;
import com.fs.watch.service.WatchFatigueDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【watch_fatigue_data(设备疲劳度)】的数据库操作Service实现
* @createDate 2024-10-15 11:06:50
*/
@Service
@Slf4j
public class WatchFatigueDataServiceImpl implements WatchFatigueDataService {
    @Autowired
    private WatchFatigueDataMapper mapper;

    @Override
    public Boolean insert(WatchFatigueData watchFatigueData) {
        //判断创建时间是否唯一
        Integer num = mapper.queryByCreateTime(watchFatigueData.getCreateTime());
        if (num != null && num > 0) {
            return false;
        }
        try {
            mapper.insert(watchFatigueData);
        } catch (Exception e) {
            log.error("===============watchFatigueData:insert=========================={}", e.getMessage());
            return false;
        }
        return true;
    }
}
