package com.shkj.wcs.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shkj.common.core.domain.Result;
import com.shkj.common.utils.DateUtils;
import com.shkj.wcs.bo.BasePunchRecordQueryBo;
import com.shkj.wcs.domain.BasePunchRecord;
import com.shkj.wcs.mapper.BasePunchRecordMapper;
import com.shkj.wcs.service.IBasePunchRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 冲孔机冲孔记录Service业务层处理
 *
 * @author zjx
 * @date 2023-04-20
 */
@Service
public class BasePunchRecordServiceImpl extends ServiceImpl<BasePunchRecordMapper, BasePunchRecord> implements IBasePunchRecordService {
    @Autowired
    private BasePunchRecordMapper basePunchRecordMapper;

    /**
     * 查询冲孔机冲孔记录
     *
     * @param id 冲孔机冲孔记录主键
     * @return 冲孔机冲孔记录
     */
    @Override
    public BasePunchRecord selectBasePunchRecordById(Long id) {
        return basePunchRecordMapper.selectBasePunchRecordById(id);
    }

    /**
     * 查询冲孔机冲孔记录列表
     *
     * @param basePunchRecord 冲孔机冲孔记录
     * @return 冲孔机冲孔记录
     */
    @Override
    public List<BasePunchRecord> selectBasePunchRecordList(BasePunchRecord basePunchRecord) {
        return basePunchRecordMapper.selectBasePunchRecordList(basePunchRecord);
    }

    @Override
    public BasePunchRecord selectBasePunchRecord(BasePunchRecordQueryBo basePunchRecord) {
        return basePunchRecordMapper.selectBasePunchRecord(basePunchRecord);
    }


    /**
     * 新增冲孔机冲孔记录
     *
     * @param basePunchRecord 冲孔机冲孔记录
     * @return 结果
     */
    @Override
    public Result<Boolean> insertBasePunchRecord(BasePunchRecord basePunchRecord) {
        basePunchRecord.setCreateTime(DateUtils.getNowDate());
        this.baseMapper.insert(basePunchRecord);
        return Result.ok();
    }

    /**
     * 修改冲孔机冲孔记录
     *
     * @param basePunchRecord 冲孔机冲孔记录
     * @return 结果
     */
    @Override
    public Result<Boolean> updateBasePunchRecord(BasePunchRecord basePunchRecord) {
        basePunchRecord.setUpdateTime(DateUtils.getNowDate());
        this.baseMapper.updateById(basePunchRecord);
        return Result.ok();
    }

}
