package com.ruoyi.cs.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cs.mapper.CsProjectRecordMapper;
import com.ruoyi.cs.domain.CsProjectRecord;
import com.ruoyi.cs.service.ICsProjectRecordService;

import javax.annotation.Resource;

/**
 * 项目记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-05-29
 */
@Service
public class CsProjectRecordServiceImpl implements ICsProjectRecordService
{
    @Resource
    private CsProjectRecordMapper csProjectRecordMapper;

    /**
     * 查询项目记录
     *
     * @param projectRecordId 项目记录主键
     * @return 项目记录
     */
    @Override
    public CsProjectRecord selectCsProjectRecordByProjectRecordId(String projectRecordId)
    {
        return csProjectRecordMapper.selectCsProjectRecordByProjectRecordId(projectRecordId);
    }

    /**
     * 查询项目记录列表
     *
     * @param csProjectRecord 项目记录
     * @return 项目记录
     */
    @Override
    public List<CsProjectRecord> selectCsProjectRecordList(CsProjectRecord csProjectRecord)
    {
        return csProjectRecordMapper.selectCsProjectRecordList(csProjectRecord);
    }

    /**
     * 新增项目记录
     *
     * @param csProjectRecord 项目记录
     * @return 结果
     */
    @Override
    public int insertCsProjectRecord(CsProjectRecord csProjectRecord)
    {
        csProjectRecord.setProjectRecordId(IdUtil.getSnowflakeNextIdStr());
        csProjectRecord.setCreateAt(DateUtils.getNowDate());
        csProjectRecord.setDelFlag("0");
        return csProjectRecordMapper.insertCsProjectRecord(csProjectRecord);
    }

    /**
     * 修改项目记录
     *
     * @param csProjectRecord 项目记录
     * @return 结果
     */
    @Override
    public int updateCsProjectRecord(CsProjectRecord csProjectRecord)
    {
        csProjectRecord.setUpdateAt(DateUtils.getNowDate());
        return csProjectRecordMapper.updateCsProjectRecord(csProjectRecord);
    }

    /**
     * 批量删除项目记录
     *
     * @param projectRecordIds 需要删除的项目记录主键
     * @return 结果
     */
    @Override
    public int deleteCsProjectRecordByProjectRecordIds(String[] projectRecordIds)
    {
        return csProjectRecordMapper.deleteCsProjectRecordByProjectRecordIds(projectRecordIds);
    }

    /**
     * 删除项目记录信息
     *
     * @param projectRecordId 项目记录主键
     * @return 结果
     */
    @Override
    public int deleteCsProjectRecordByProjectRecordId(String projectRecordId)
    {
        return csProjectRecordMapper.deleteCsProjectRecordByProjectRecordId(projectRecordId);
    }
}
