package com.ruoyi.invest.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.invest.mapper.TProjectScoringMapper;
import com.ruoyi.invest.domain.TProjectScoring;
import com.ruoyi.invest.service.ITProjectScoringService;

/**
 * 打分Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-23
 */
@Service
public class TProjectScoringServiceImpl implements ITProjectScoringService 
{
    @Autowired
    private TProjectScoringMapper tProjectScoringMapper;

    /**
     * 查询打分
     * 
     * @param id 打分主键
     * @return 打分
     */
    @Override
    public TProjectScoring selectTProjectScoringById(String id)
    {
        return tProjectScoringMapper.selectTProjectScoringById(id);
    }

    /**
     * 查询打分列表
     * 
     * @param tProjectScoring 打分
     * @return 打分
     */
    @Override
    public List<TProjectScoring> selectTProjectScoringList(TProjectScoring tProjectScoring)
    {
        return tProjectScoringMapper.selectTProjectScoringList(tProjectScoring);
    }

    /**
     * 新增打分
     * 
     * @param tProjectScoring 打分
     * @return 结果
     */
    @Override
    public int insertTProjectScoring(TProjectScoring tProjectScoring)
    {
        tProjectScoring.setCreateTime(DateUtils.getNowDate());
        tProjectScoring.setId(IdUtils.fastSimpleUUID());
        return tProjectScoringMapper.insertTProjectScoring(tProjectScoring);
    }

    /**
     * 修改打分
     * 
     * @param tProjectScoring 打分
     * @return 结果
     */
    @Override
    public int updateTProjectScoring(TProjectScoring tProjectScoring)
    {
        tProjectScoring.setUpdateTime(DateUtils.getNowDate());
        return tProjectScoringMapper.updateTProjectScoring(tProjectScoring);
    }

    /**
     * 批量删除打分
     * 
     * @param ids 需要删除的打分主键
     * @return 结果
     */
    @Override
    public int deleteTProjectScoringByIds(String[] ids)
    {
        return tProjectScoringMapper.deleteTProjectScoringByIds(ids);
    }

    /**
     * 删除打分信息
     * 
     * @param id 打分主键
     * @return 结果
     */
    @Override
    public int deleteTProjectScoringById(String id)
    {
        return tProjectScoringMapper.deleteTProjectScoringById(id);
    }

    /**
     * 批量删除打分
     *
     * @param ids 需要删除的打分主键
     * @return 结果
     */
    @Override
    public int updateTProjectScoringByIds(String[] ids) {
        return tProjectScoringMapper.updateTProjectScoringByIds(ids);
    }

    /**
     * 根据会议ID查询汇总分数和平均分数
     * @param meetingId
     * @return
     */
    @Override
    public Map<String, String> selectMeetingId(String meetingId) {
        return tProjectScoringMapper.selectMeetingId(meetingId);
    }

    /**
     * 根据会议ID和用户ID 查询打分数据
     * @param meetingId
     * @param userId
     * @return
     */
    @Override
    public TProjectScoring getCanScoringMeetingId(String meetingId, Long userId) {
        return tProjectScoringMapper.getCanScoringMeetingId(meetingId,userId);
    }
}
