package com.sundot.airport.attendance.service.impl;

import com.sundot.airport.attendance.domain.AttendanceCheckRecord;
import com.sundot.airport.attendance.mapper.AttendanceCheckRecordMapper;
import com.sundot.airport.attendance.service.IAttendanceCheckRecordService;
import com.sundot.airport.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 打卡记录Service业务层处理
 *
 * @author wangchong
 * @date 2025-07-10
 */
@Service
public class AttendanceCheckRecordServiceImpl implements IAttendanceCheckRecordService {
    @Autowired
    private AttendanceCheckRecordMapper attendanceCheckRecordMapper;

    /**
     * 查询打卡记录
     *
     * @param id 打卡记录主键
     * @return 打卡记录
     */
    @Override
    public AttendanceCheckRecord selectAttendanceCheckRecordById(Long id) {
        return attendanceCheckRecordMapper.selectAttendanceCheckRecordById(id);
    }

    /**
     * 查询打卡记录列表
     *
     * @param attendanceCheckRecord 打卡记录
     * @return 打卡记录
     */
    @Override
    public List<AttendanceCheckRecord> selectAttendanceCheckRecordList(AttendanceCheckRecord attendanceCheckRecord) {
        return attendanceCheckRecordMapper.selectAttendanceCheckRecordList(attendanceCheckRecord);
    }

    /**
     * 新增打卡记录
     *
     * @param attendanceCheckRecord 打卡记录
     * @return 结果
     */
    @Override
    public int insertAttendanceCheckRecord(AttendanceCheckRecord attendanceCheckRecord) {
        attendanceCheckRecord.setCreateTime(DateUtils.getNowDate());
        return attendanceCheckRecordMapper.insertAttendanceCheckRecord(attendanceCheckRecord);
    }

    /**
     * 修改打卡记录
     *
     * @param attendanceCheckRecord 打卡记录
     * @return 结果
     */
    @Override
    public int updateAttendanceCheckRecord(AttendanceCheckRecord attendanceCheckRecord) {
        attendanceCheckRecord.setUpdateTime(DateUtils.getNowDate());
        return attendanceCheckRecordMapper.updateAttendanceCheckRecord(attendanceCheckRecord);
    }

    /**
     * 批量删除打卡记录
     *
     * @param ids 需要删除的打卡记录主键
     * @return 结果
     */
    @Override
    public int deleteAttendanceCheckRecordByIds(Long[] ids) {
        return attendanceCheckRecordMapper.deleteAttendanceCheckRecordByIds(ids);
    }

    /**
     * 删除打卡记录信息
     *
     * @param id 打卡记录主键
     * @return 结果
     */
    @Override
    public int deleteAttendanceCheckRecordById(Long id) {
        return attendanceCheckRecordMapper.deleteAttendanceCheckRecordById(id);
    }
}
