package com.fs.watch.service.impl;

import com.fs.watch.domain.WatchAccelerometerData;
import com.fs.watch.mapper.WatchAccelerometerDataMapper;
import com.fs.watch.service.WatchAccelerometerDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【watch_accelerometer_data(设备accelerometer数据)】的数据库操作Service实现
* @createDate 2024-10-15 11:06:50
*/
@Service
@Slf4j
public class WatchAccelerometerDataServiceImpl implements WatchAccelerometerDataService {
    @Autowired
    private WatchAccelerometerDataMapper mapper;

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