package com.ruoyi.project.service.impl;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mapper.TrsSensitiveResultsMapper;
import com.ruoyi.project.domain.TrsSensitiveResults;
import com.ruoyi.project.service.ITrsSensitiveResultsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 常见错误监测Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-19
 */
@Service
public class TrsSensitiveResultsServiceImpl implements ITrsSensitiveResultsService 
{
    @Autowired
    private TrsSensitiveResultsMapper trsSensitiveResultsMapper;

    /**
     * 查询常见错误监测
     * 
     * @param id 常见错误监测主键
     * @return 常见错误监测
     */
    @Override
    public TrsSensitiveResults selectTrsSensitiveResultsById(Long id)
    {
        return trsSensitiveResultsMapper.selectTrsSensitiveResultsById(id);
    }

    public TrsSensitiveResults selectTrsSensitiveResultsByIdV2(Long id)
    {
        return trsSensitiveResultsMapper.selectTrsSensitiveResultsByIdV2(id);
    }

    /**
     * 查询常见错误监测列表
     * 
     * @param trsSensitiveResults 常见错误监测
     * @return 常见错误监测
     */
    @Override
    public List<TrsSensitiveResults> selectTrsSensitiveResultsList(TrsSensitiveResults trsSensitiveResults)
    {
        return trsSensitiveResultsMapper.selectTrsSensitiveResultsList(trsSensitiveResults);
    }

    /**
     * 新增常见错误监测
     * 
     * @param trsSensitiveResults 常见错误监测
     * @return 结果
     */
    @Override
    public int insertTrsSensitiveResults(TrsSensitiveResults trsSensitiveResults)
    {
        return trsSensitiveResultsMapper.insertTrsSensitiveResults(trsSensitiveResults);
    }

    /**
     * 修改常见错误监测
     * 
     * @param trsSensitiveResults 常见错误监测
     * @return 结果
     */
    @Override
    public int updateTrsSensitiveResults(TrsSensitiveResults trsSensitiveResults)
    {
        /*TrsSensitiveResults results = new TrsSensitiveResults();
        results.setPage(trsSensitiveResults.getPage());
        results.setWrongWord(trsSensitiveResults.getWrongWord());
        List<TrsSensitiveResults> trsSensitiveResults1 = trsSensitiveResultsMapper.selectTrsSensitiveResultsListAll(results);
        for (TrsSensitiveResults trsSensitiveResult : trsSensitiveResults1) {
            trsSensitiveResults.setId(trsSensitiveResult.getId());
            trsSensitiveResultsMapper.updateTrsSensitiveResults(trsSensitiveResults);
        }*/
        return trsSensitiveResultsMapper.updateTrsSensitiveResults(trsSensitiveResults);
    }

    /**
     * 批量删除常见错误监测
     * 
     * @param ids 需要删除的常见错误监测主键
     * @return 结果
     */
    @Override
    public int deleteTrsSensitiveResultsByIds(String ids)
    {
        return trsSensitiveResultsMapper.deleteTrsSensitiveResultsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除常见错误监测信息
     * 
     * @param id 常见错误监测主键
     * @return 结果
     */
    @Override
    public int deleteTrsSensitiveResultsById(Long id)
    {
        return trsSensitiveResultsMapper.deleteTrsSensitiveResultsById(id);
    }

    @Override
    public Map<String, Integer> getStatistics(TrsSensitiveResults trsSensitiveResults) {
        return trsSensitiveResultsMapper.getStatistics(trsSensitiveResults);
    }
}
