package com.fs.watch.service.impl;

import com.fs.watch.domain.WatchPpgData;
import com.fs.watch.mapper.WatchPpgDataMapper;
import com.fs.watch.service.WatchPpgDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【watch_ppg_data(设备血糖数据)】的数据库操作Service实现
* @createDate 2024-10-15 11:06:51
*/
@Service
@Slf4j
public class WatchPpgDataServiceImpl implements WatchPpgDataService {
    @Autowired
    private WatchPpgDataMapper mapper;

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

        return true;
    }
}
