package com.cirs.biz.service.impl;

import java.util.HashMap;
import java.util.List;

import com.cirs.biz.domain.avgEvaluation;
import com.cirs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cirs.biz.mapper.TEvaluationMapper;
import com.cirs.biz.domain.TEvaluation;
import com.cirs.biz.service.ITEvaluationService;

/**
 * 评价Service业务层处理
 * 
 * @author allen
 * @date 2023-11-03
 */
@Service
public class TEvaluationServiceImpl implements ITEvaluationService 
{
    @Autowired
    private TEvaluationMapper tEvaluationMapper;

    /**
     * 查询评价
     * 
     * @param id 评价主键
     * @return 评价
     */
    @Override
    public TEvaluation selectTEvaluationById(Long id)
    {
        return tEvaluationMapper.selectTEvaluationById(id);
    }

    /**
     * 查询评价列表
     * 
     * @param tEvaluation 评价
     * @return 评价
     */
    @Override
    public List<TEvaluation> selectTEvaluationList(TEvaluation tEvaluation)
    {
        return tEvaluationMapper.selectTEvaluationList(tEvaluation);
    }

    /**
     * 新增评价
     * 
     * @param tEvaluation 评价
     * @return 结果
     */
    @Override
    public int insertTEvaluation(TEvaluation tEvaluation)
    {
        tEvaluation.setCreateTime(DateUtils.getNowDate());
        return tEvaluationMapper.insertTEvaluation(tEvaluation);
    }

    /**
     * 修改评价
     * 
     * @param tEvaluation 评价
     * @return 结果
     */
    @Override
    public int updateTEvaluation(TEvaluation tEvaluation)
    {
        tEvaluation.setUpdateTime(DateUtils.getNowDate());
        return tEvaluationMapper.updateTEvaluation(tEvaluation);
    }

    /**
     * 批量删除评价
     * 
     * @param ids 需要删除的评价主键
     * @return 结果
     */
    @Override
    public int deleteTEvaluationByIds(Long[] ids)
    {
        return tEvaluationMapper.deleteTEvaluationByIds(ids);
    }

    /**
     * 删除评价信息
     * 
     * @param id 评价主键
     * @return 结果
     */
    @Override
    public int deleteTEvaluationById(Long id)
    {
        return tEvaluationMapper.deleteTEvaluationById(id);
    }

    @Override
    public Float getscore(String componentid) {

        return tEvaluationMapper.getscore(componentid);
    }

    @Override
    public List<avgEvaluation> get_top10() {
        return tEvaluationMapper.get_top10();
    }
}
