package com.ruoyi.invest.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.invest.domain.TProjectCirculation;
import com.ruoyi.invest.mapper.TProjectCirculationMapper;
import com.ruoyi.invest.service.ITProjectCirculationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 项目流转记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-04
 */
@Service
public class TProjectCirculationServiceImpl implements ITProjectCirculationService
{
    @Autowired
    private TProjectCirculationMapper tProjectCirculationMapper;

    /**
     * 查询项目流转记录
     * 
     * @param id 项目流转记录主键
     * @return 项目流转记录
     */
    @Override
    public TProjectCirculation selectTProjectCirculationById(String id)
    {
        return tProjectCirculationMapper.selectTProjectCirculationById(id);
    }

    /**
     * 查询项目流转记录列表
     * 
     * @param tProjectCirculation 项目流转记录
     * @return 项目流转记录
     */
    @Override
    public List<TProjectCirculation> selectTProjectCirculationList(TProjectCirculation tProjectCirculation)
    {
        return tProjectCirculationMapper.selectTProjectCirculationList(tProjectCirculation);
    }

    /**
     * 新增项目流转记录
     * 
     * @param tProjectCirculation 项目流转记录
     * @return 结果
     */
    @Override
    public int insertTProjectCirculation(TProjectCirculation tProjectCirculation)
    {
        tProjectCirculation.setCreateTime(DateUtils.getNowDate());
        tProjectCirculation.setId(IdUtils.fastSimpleUUID());
        return tProjectCirculationMapper.insertTProjectCirculation(tProjectCirculation);
    }

    @Override
    public int insertTProjectCirculation(String projectPoolId, String stageName, String createBy) {
        TProjectCirculation tProjectCirculation = new TProjectCirculation();
        tProjectCirculation.setProjectPoolId(projectPoolId);
        tProjectCirculation.setStageName(stageName);
        tProjectCirculation.setCreateBy(createBy);
        tProjectCirculation.setCreateTime(DateUtils.getNowDate());
        tProjectCirculation.setId(IdUtils.fastSimpleUUID());
        return tProjectCirculationMapper.insertTProjectCirculation(tProjectCirculation);
    }

    /**
     * 修改项目流转记录
     * 
     * @param tProjectCirculation 项目流转记录
     * @return 结果
     */
    @Override
    public int updateTProjectCirculation(TProjectCirculation tProjectCirculation)
    {
        return tProjectCirculationMapper.updateTProjectCirculation(tProjectCirculation);
    }

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

    /**
     * 删除项目流转记录信息
     * 
     * @param id 项目流转记录主键
     * @return 结果
     */
    @Override
    public int deleteTProjectCirculationById(String id)
    {
        return tProjectCirculationMapper.deleteTProjectCirculationById(id);
    }

    /**
     * 根据项目ID获取项目流转记录
     * @param projectPoolId
     * @return
     */
    @Override
    public List<TProjectCirculation> listProjectPoolId(String projectPoolId) {
        return tProjectCirculationMapper.listProjectPoolId(projectPoolId);
    }
}
