package com.ruoyi.powerdistribution.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.powerdistribution.domain.dto.PdmWorkPlanDTO;
import com.ruoyi.powerdistribution.domain.vo.WorkNumByCompanyStatistics;
import com.ruoyi.powerdistribution.domain.vo.WorkRiskStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.powerdistribution.mapper.PdmWorkPlanMapper;
import com.ruoyi.powerdistribution.domain.PdmWorkPlan;
import com.ruoyi.powerdistribution.service.IPdmWorkPlanService;

/**
 * 作业计划Service业务层处理
 *
 * @author ruoyi
 * @date 2024-12-01
 */
@Service
public class PdmWorkPlanServiceImpl implements IPdmWorkPlanService
{
    @Autowired
    private PdmWorkPlanMapper pdmWorkPlanMapper;

    /**
     * 查询作业计划
     *
     * @param id 作业计划主键
     * @return 作业计划
     */
    @Override
    public PdmWorkPlan selectPdmWorkPlanById(Long id)
    {
        return pdmWorkPlanMapper.selectPdmWorkPlanById(id);
    }

    /**
     * 查询作业计划列表
     *
     * @param pdmWorkPlan 作业计划
     * @return 作业计划
     */
    @Override
    public List<PdmWorkPlan> selectPdmWorkPlanList(PdmWorkPlanDTO pdmWorkPlan)
    {
        return pdmWorkPlanMapper.selectPdmWorkPlanList(pdmWorkPlan);
    }

    /**
     * 新增作业计划
     *
     * @param pdmWorkPlan 作业计划
     * @return 结果
     */
    @Override
    public int insertPdmWorkPlan(PdmWorkPlan pdmWorkPlan)
    {
        pdmWorkPlan.setCreateTime(DateUtils.getNowDate());
        return pdmWorkPlanMapper.insertPdmWorkPlan(pdmWorkPlan);
    }

    /**
     * 修改作业计划
     *
     * @param pdmWorkPlan 作业计划
     * @return 结果
     */
    @Override
    public int updatePdmWorkPlan(PdmWorkPlan pdmWorkPlan)
    {
        pdmWorkPlan.setUpdateTime(DateUtils.getNowDate());
        return pdmWorkPlanMapper.updatePdmWorkPlan(pdmWorkPlan);
    }

    /**
     * 批量删除作业计划
     *
     * @param ids 需要删除的作业计划主键
     * @return 结果
     */
    @Override
    public int deletePdmWorkPlanByIds(Long[] ids)
    {
        return pdmWorkPlanMapper.deletePdmWorkPlanByIds(ids);
    }

    /**
     * 删除作业计划信息
     *
     * @param id 作业计划主键
     * @return 结果
     */
    @Override
    public int deletePdmWorkPlanById(Long id)
    {
        return pdmWorkPlanMapper.deletePdmWorkPlanById(id);
    }

    @Override
    public List<WorkRiskStatistics> getWorkRiskStatistics(String date) {
        return pdmWorkPlanMapper.getWorkRiskStatistics(date);
    }

    @Override
    public List<WorkNumByCompanyStatistics> getWorkNumByCompanyStatistics(WorkNumByCompanyStatistics workNumByCompany) {
        return pdmWorkPlanMapper.getWorkNumByCompanyStatistics(workNumByCompany);
    }
}
