package com.ruoyi.szxc.service.impl;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.szxc.domain.SzxcWorkRecard;
import com.ruoyi.szxc.mapper.SzxcWorkRecardMapper;
import com.ruoyi.szxc.service.ISzxcWorkRecardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工作记录Service业务层处理
 * 
 * @author hs
 * @date 2024-03-20
 */
@Service
public class SzxcWorkRecardServiceImpl implements ISzxcWorkRecardService 
{
    @Autowired
    private SzxcWorkRecardMapper szxcWorkRecardMapper;

    /**
     * 查询工作记录
     * 
     * @param id 工作记录主键
     * @return 工作记录
     */
    @Override
    public SzxcWorkRecard selectSzxcWorkRecardById(Long id)
    {
        return szxcWorkRecardMapper.selectSzxcWorkRecardById(id);
    }

    /**
     * 查询工作记录列表
     * 
     * @param szxcWorkRecard 工作记录
     * @return 工作记录
     */
    @Override
    @DataScope(deptAlias = "w")
    public List<SzxcWorkRecard> selectSzxcWorkRecardList(SzxcWorkRecard szxcWorkRecard)
    {
        return szxcWorkRecardMapper.selectSzxcWorkRecardList(szxcWorkRecard);
    }

    /**
     * 新增工作记录
     * 
     * @param szxcWorkRecard 工作记录
     * @return 结果
     */
    @Override
    public int insertSzxcWorkRecard(SzxcWorkRecard szxcWorkRecard)
    {
        szxcWorkRecard.setCreateTime(DateUtils.getNowDate());
        return szxcWorkRecardMapper.insertSzxcWorkRecard(szxcWorkRecard);
    }

    /**
     * 修改工作记录
     * 
     * @param szxcWorkRecard 工作记录
     * @return 结果
     */
    @Override
    public int updateSzxcWorkRecard(SzxcWorkRecard szxcWorkRecard)
    {
        szxcWorkRecard.setUpdateTime(DateUtils.getNowDate());
        return szxcWorkRecardMapper.updateSzxcWorkRecard(szxcWorkRecard);
    }

    /**
     * 批量删除工作记录
     * 
     * @param ids 需要删除的工作记录主键
     * @return 结果
     */
    @Override
    public int deleteSzxcWorkRecardByIds(Long[] ids)
    {
        return szxcWorkRecardMapper.deleteSzxcWorkRecardByIds(ids);
    }

    /**
     * 删除工作记录信息
     * 
     * @param id 工作记录主键
     * @return 结果
     */
    @Override
    public int deleteSzxcWorkRecardById(Long id)
    {
        return szxcWorkRecardMapper.deleteSzxcWorkRecardById(id);
    }
}
