package cn.iocoder.yudao.module.system.service.equipment;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord.DataSynchronousRecordPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord.DataSynchronousRecordSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.equipment.DataSynchronousRecordDO;
import cn.iocoder.yudao.module.system.dal.mysql.equipment.DataSynchronousRecordMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 考勤机数据同步记录 Service 实现类
 *
 * @author 符溶馨
 */
@Service
@Validated
public class DataSynchronousRecordServiceImpl implements DataSynchronousRecordService {

    @Resource
    private DataSynchronousRecordMapper dataSynchronousRecordMapper;

    @Override
    public Long createDataSynchronousRecord(DataSynchronousRecordSaveReqVO createReqVO) {
        // 插入
        DataSynchronousRecordDO dataSynchronousRecord = BeanUtils.toBean(createReqVO, DataSynchronousRecordDO.class);
        dataSynchronousRecordMapper.insert(dataSynchronousRecord);
        // 返回
        return dataSynchronousRecord.getId();
    }

    @Override
    public DataSynchronousRecordDO getDataSynchronousRecord(Long id) {
        return dataSynchronousRecordMapper.selectById(id);
    }

    @Override
    public PageResult<DataSynchronousRecordDO> getDataSynchronousRecordPage(DataSynchronousRecordPageReqVO pageReqVO) {
        return dataSynchronousRecordMapper.selectPage(pageReqVO);
    }

}