package com.ruoyi.mall.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.ReportDraftMapper;
import com.ruoyi.mall.domain.ReportDraft;
import com.ruoyi.mall.service.IReportDraftService;

/**
 * 志愿草稿Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-02
 */
@Service
public class ReportDraftServiceImpl implements IReportDraftService 
{
    @Autowired
    private ReportDraftMapper reportDraftMapper;

    /**
     * 查询志愿草稿
     * 
     * @param draftId 志愿草稿主键
     * @return 志愿草稿
     */
    @Override
    public ReportDraft selectReportDraftByDraftId(Long draftId)
    {
        return reportDraftMapper.selectReportDraftByDraftId(draftId);
    }

    /**
     * 查询志愿草稿列表
     * 
     * @param reportDraft 志愿草稿
     * @return 志愿草稿
     */
    @Override
    public List<ReportDraft> selectReportDraftList(ReportDraft reportDraft)
    {
        return reportDraftMapper.selectReportDraftList(reportDraft);
    }

    /**
     * 新增志愿草稿
     * 
     * @param reportDraft 志愿草稿
     * @return 结果
     */
    @Override
    public int insertReportDraft(ReportDraft reportDraft)
    {
        reportDraft.setCreateTime(DateUtils.getNowDate());
        return reportDraftMapper.insertReportDraft(reportDraft);
    }

    /**
     * 修改志愿草稿
     * 
     * @param reportDraft 志愿草稿
     * @return 结果
     */
    @Override
    public int updateReportDraft(ReportDraft reportDraft)
    {
        reportDraft.setUpdateTime(DateUtils.getNowDate());
        return reportDraftMapper.updateReportDraft(reportDraft);
    }

    /**
     * 批量删除志愿草稿
     * 
     * @param draftIds 需要删除的志愿草稿主键
     * @return 结果
     */
    @Override
    public int deleteReportDraftByDraftIds(Long[] draftIds)
    {
        return reportDraftMapper.deleteReportDraftByDraftIds(draftIds);
    }

    /**
     * 删除志愿草稿信息
     * 
     * @param draftId 志愿草稿主键
     * @return 结果
     */
    @Override
    public int deleteReportDraftByDraftId(Long draftId)
    {
        return reportDraftMapper.deleteReportDraftByDraftId(draftId);
    }


    /**
     * 根据条件批量删除
     *  根据用户+批次删除(草稿 还未生成报告) 根据报告id删除(已有报告需要再新增)
     */
    @Override
    public int batchDelete(ReportDraft reportDraft) {
        return reportDraftMapper.batchDelete(reportDraft);
    }
}
