package com.fs.task.service.impl;

import java.util.Collections;
import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.task.mapper.TaskMaterialInfoMapper;
import com.fs.task.domain.TaskMaterialInfo;
import com.fs.task.service.ITaskMaterialInfoService;

/**
 * 材料信息Service业务层处理
 * 
 * @author fs
 * @date 2026-01-04
 */
@Service
public class TaskMaterialInfoServiceImpl implements ITaskMaterialInfoService 
{
    @Autowired
    private TaskMaterialInfoMapper taskMaterialInfoMapper;

    /**
     * 查询材料信息
     * 
     * @param id 材料信息主键
     * @return 材料信息
     */
    @Override
    public TaskMaterialInfo selectTaskMaterialInfoById(Long id)
    {
        return taskMaterialInfoMapper.selectTaskMaterialInfoById(id);
    }

    /**
     * 查询材料信息列表
     * 
     * @param taskMaterialInfo 材料信息
     * @return 材料信息
     */
    @Override
    public List<TaskMaterialInfo> selectTaskMaterialInfoList(TaskMaterialInfo taskMaterialInfo)
    {
        return taskMaterialInfoMapper.selectTaskMaterialInfoList(taskMaterialInfo);
    }

    /**
     * 新增材料信息
     * 
     * @param taskMaterialInfo 材料信息
     * @return 结果
     */
    @Override
    public int insertTaskMaterialInfo(TaskMaterialInfo taskMaterialInfo)
    {
        taskMaterialInfo.setCreateTime(DateUtils.getNowDate());
        return taskMaterialInfoMapper.insertTaskMaterialInfo(taskMaterialInfo);
    }

    /**
     * 修改材料信息
     * 
     * @param taskMaterialInfo 材料信息
     * @return 结果
     */
    @Override
    public int updateTaskMaterialInfo(TaskMaterialInfo taskMaterialInfo)
    {
        taskMaterialInfo.setUpdateTime(DateUtils.getNowDate());
        return taskMaterialInfoMapper.updateTaskMaterialInfo(taskMaterialInfo);
    }

    /**
     * 批量删除材料信息
     * 
     * @param ids 需要删除的材料信息主键
     * @return 结果
     */
    @Override
    public int deleteTaskMaterialInfoByIds(Long[] ids)
    {
        return taskMaterialInfoMapper.deleteTaskMaterialInfoByIds(ids);
    }

    /**
     * 删除材料信息信息
     * 
     * @param id 材料信息主键
     * @return 结果
     */
    @Override
    public int deleteTaskMaterialInfoById(Long id)
    {
        return taskMaterialInfoMapper.deleteTaskMaterialInfoById(id);
    }


    @Override
    public List<TaskMaterialInfo> selectTaskMaterialInfoByTaskId(Long taskId) {
        return taskMaterialInfoMapper.selectTaskMaterialInfoByTaskId(taskId);
    }
}
