package com.ruoyi.powerdistribution.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.powerdistribution.mapper.PdmExamineRoleTargetMapper;
import com.ruoyi.powerdistribution.domain.PdmExamineRoleTarget;
import com.ruoyi.powerdistribution.service.IPdmExamineRoleTargetService;

/**
 * 时户数考核规则分级Service业务层处理
 *
 * @author ruoyi
 * @date 2024-12-30
 */
@Service
public class PdmExamineRoleTargetServiceImpl implements IPdmExamineRoleTargetService
{
    @Autowired
    private PdmExamineRoleTargetMapper pdmExamineRoleTargetMapper;

    /**
     * 查询时户数考核规则分级
     *
     * @param id 时户数考核规则分级主键
     * @return 时户数考核规则分级
     */
    @Override
    public PdmExamineRoleTarget selectPdmExamineRoleTargetById(Long id)
    {
        return pdmExamineRoleTargetMapper.selectPdmExamineRoleTargetById(id);
    }

    /**
     * 查询时户数考核规则分级列表
     *
     * @param pdmExamineRoleTarget 时户数考核规则分级
     * @return 时户数考核规则分级
     */
    @Override
    public List<PdmExamineRoleTarget> selectPdmExamineRoleTargetList(PdmExamineRoleTarget pdmExamineRoleTarget)
    {
        return pdmExamineRoleTargetMapper.selectPdmExamineRoleTargetList(pdmExamineRoleTarget);
    }

    /**
     * 新增时户数考核规则分级
     *
     * @param pdmExamineRoleTarget 时户数考核规则分级
     * @return 结果
     */
    @Override
    public int insertPdmExamineRoleTarget(PdmExamineRoleTarget pdmExamineRoleTarget)
    {
        pdmExamineRoleTarget.setCreateTime(DateUtils.getNowDate());
        pdmExamineRoleTarget.setTargetName(pdmExamineRoleTarget.getMinNum()+"<= N <"+pdmExamineRoleTarget.getMaxNum());
        return pdmExamineRoleTargetMapper.insertPdmExamineRoleTarget(pdmExamineRoleTarget);
    }

    /**
     * 修改时户数考核规则分级
     *
     * @param pdmExamineRoleTarget 时户数考核规则分级
     * @return 结果
     */
    @Override
    public int updatePdmExamineRoleTarget(PdmExamineRoleTarget pdmExamineRoleTarget)
    {
        pdmExamineRoleTarget.setUpdateTime(DateUtils.getNowDate());
        pdmExamineRoleTarget.setTargetName(pdmExamineRoleTarget.getMinNum()+"<= N <"+pdmExamineRoleTarget.getMaxNum());
        return pdmExamineRoleTargetMapper.updatePdmExamineRoleTarget(pdmExamineRoleTarget);
    }

    /**
     * 批量删除时户数考核规则分级
     *
     * @param ids 需要删除的时户数考核规则分级主键
     * @return 结果
     */
    @Override
    public int deletePdmExamineRoleTargetByIds(Long[] ids)
    {
        return pdmExamineRoleTargetMapper.deletePdmExamineRoleTargetByIds(ids);
    }

    /**
     * 删除时户数考核规则分级信息
     *
     * @param id 时户数考核规则分级主键
     * @return 结果
     */
    @Override
    public int deletePdmExamineRoleTargetById(Long id)
    {
        return pdmExamineRoleTargetMapper.deletePdmExamineRoleTargetById(id);
    }
}
