package com.yanzhu.jh.project.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.yanzhu.jh.project.mapper.SurProjectScheduleMapper;
import com.yanzhu.jh.project.domain.SurProjectSchedule;
import com.yanzhu.jh.project.service.ISurProjectScheduleService;

/**
 * 形象进度Service业务层处理
 * 
 * @author Jiangdu
 * @date 2023-07-29
 */
@Service
public class SurProjectScheduleServiceImpl implements ISurProjectScheduleService
{
    @Autowired
    private SurProjectScheduleMapper surProjectScheduleMapper;

    /**
     * 查询形象进度
     * 
     * @param id 形象进度主键
     * @return 形象进度
     */
    @Override
    public SurProjectSchedule selectSurProjectScheduleById(Long id)
    {
        return surProjectScheduleMapper.selectSurProjectScheduleById(id);
    }

    /**
     * 查询形象进度列表
     * 
     * @param surProjectSchedule 形象进度
     * @return 形象进度
     */
    @Override
    public List<SurProjectSchedule> selectSurProjectScheduleList(SurProjectSchedule surProjectSchedule)
    {
        return surProjectScheduleMapper.selectSurProjectScheduleList(surProjectSchedule);
    }


    public SurProjectSchedule getProjectConstructionProgress(Long projectId){
        return surProjectScheduleMapper.getProjectConstructionProgress(projectId);
    }

    /**
     * 新增形象进度
     * 
     * @param surProjectSchedule 形象进度
     * @return 结果
     */
    @Override
    public int insertSurProjectSchedule(SurProjectSchedule surProjectSchedule)
    {
        surProjectSchedule.setCreateTime(DateUtils.getNowDate());
        surProjectSchedule.setIsDel(0l);
        return surProjectScheduleMapper.insertSurProjectSchedule(surProjectSchedule);
    }

    /**
     * 修改形象进度
     * 
     * @param surProjectSchedule 形象进度
     * @return 结果
     */
    @Override
    public int updateSurProjectSchedule(SurProjectSchedule surProjectSchedule)
    {
        surProjectSchedule.setUpdateTime(DateUtils.getNowDate());
        return surProjectScheduleMapper.updateSurProjectSchedule(surProjectSchedule);
    }

    /**
     * 批量删除形象进度
     * 
     * @param ids 需要删除的形象进度主键
     * @return 结果
     */
    @Override
    public int deleteSurProjectScheduleByIds(Long[] ids)
    {
        return surProjectScheduleMapper.deleteSurProjectScheduleByIds(ids);
    }

    /**
     * 删除形象进度信息
     * 
     * @param id 形象进度主键
     * @return 结果
     */
    @Override
    public int deleteSurProjectScheduleById(Long id)
    {
        return surProjectScheduleMapper.deleteSurProjectScheduleById(id);
    }

    /**
     * 按项目类型查询形象进度数据
     * @param type
     * @return
     */
    @Override
    public List<SurProjectSchedule> selectByProjectType(Long type) {
        return surProjectScheduleMapper.selectByProjectType(type);
    }
}
