package com.ygtx.gxt.service.impl;

import java.util.List;

import com.ygtx.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ygtx.gxt.mapper.GxtUserRepairProjectScoreMapper;
import com.ygtx.gxt.domain.GxtUserRepairProjectScore;
import com.ygtx.gxt.service.IGxtUserRepairProjectScoreService;

/**
 * 维修项目得分Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-06
 */
@Service
public class GxtUserRepairProjectScoreServiceImpl implements IGxtUserRepairProjectScoreService 
{
    @Autowired
    private GxtUserRepairProjectScoreMapper gxtUserRepairProjectScoreMapper;

    /**
     * 查询维修项目得分
     * 
     * @param id 维修项目得分主键
     * @return 维修项目得分
     */
    @Override
    public GxtUserRepairProjectScore selectGxtUserRepairProjectScoreById(Long id)
    {
        return gxtUserRepairProjectScoreMapper.selectGxtUserRepairProjectScoreById(id);
    }

    /**
     * 查询维修项目得分列表
     * 
     * @param gxtUserRepairProjectScore 维修项目得分
     * @return 维修项目得分
     */
    @Override
    public List<GxtUserRepairProjectScore> selectGxtUserRepairProjectScoreList(GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        return gxtUserRepairProjectScoreMapper.selectGxtUserRepairProjectScoreList(gxtUserRepairProjectScore);
    }
    @Override
    public List<GxtUserRepairProjectScore> selectUserRepairProjectScoreStatistics(GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        return gxtUserRepairProjectScoreMapper.selectUserRepairProjectScoreStatistics(gxtUserRepairProjectScore);
    }

    /**
     * 新增维修项目得分
     * 
     * @param gxtUserRepairProjectScore 维修项目得分
     * @return 结果
     */
    @Override
    public int insertGxtUserRepairProjectScore(GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        return gxtUserRepairProjectScoreMapper.insertGxtUserRepairProjectScore(gxtUserRepairProjectScore);
    }

    /**
     * 修改维修项目得分
     * 
     * @param gxtUserRepairProjectScore 维修项目得分
     * @return 结果
     */
    @Override
    public int updateGxtUserRepairProjectScore(GxtUserRepairProjectScore gxtUserRepairProjectScore)
    {
        return gxtUserRepairProjectScoreMapper.updateGxtUserRepairProjectScore(gxtUserRepairProjectScore);
    }

    /**
     * 批量删除维修项目得分
     * 
     * @param ids 需要删除的维修项目得分主键
     * @return 结果
     */
    @Override
    public int deleteGxtUserRepairProjectScoreByIds(Long[] ids)
    {
        return gxtUserRepairProjectScoreMapper.deleteGxtUserRepairProjectScoreByIds(ids);
    }

    /**
     * 删除维修项目得分信息
     * 
     * @param id 维修项目得分主键
     * @return 结果
     */
    @Override
    public int deleteGxtUserRepairProjectScoreById(Long id)
    {
        return gxtUserRepairProjectScoreMapper.deleteGxtUserRepairProjectScoreById(id);
    }

    @Override
    public List<GxtUserRepairProjectScore> selectUserRepairProjectScoreByCondition(Integer rtType, String monthPeriod, Long userId, Long deptId, String permission) {
        if (rtType==null) {
            rtType=0;
        }
        GxtUserRepairProjectScore projectScore = new GxtUserRepairProjectScore();
        projectScore.setMonthPeriod(monthPeriod);
        projectScore.setPermission(permission);
        if (rtType == 2) {
            projectScore.setDeptId(deptId);
            return selectUserRepairProjectScoreStatistics(projectScore);
        } else if (rtType == 1) {
            projectScore.setDeptId(deptId);
        } else {
            projectScore.setUserId(userId);
        }
        return selectGxtUserRepairProjectScoreList(projectScore);
    }

    @Override
    public List<GxtUserRepairProjectScore> selectRepairProjectScoreByDeptId(Integer rtType, String monthPeriod, Long userId, Long deptId, String permission) {
        GxtUserRepairProjectScore projectScore = new GxtUserRepairProjectScore();
        projectScore.setMonthPeriod(monthPeriod);
        projectScore.setPermission(permission);
        projectScore.setDeptId(deptId);
        return gxtUserRepairProjectScoreMapper.selectRepairProjectScoreByDeptId(projectScore);
    }
}