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.PdmExamineRoleDetailMapper;
import com.ruoyi.powerdistribution.domain.PdmExamineRoleDetail;
import com.ruoyi.powerdistribution.service.IPdmExamineRoleDetailService;

/**
 * 时户数考核规则明细Service业务层处理
 *
 * @author ruoyi
 * @date 2024-12-30
 */
@Service
public class PdmExamineRoleDetailServiceImpl implements IPdmExamineRoleDetailService
{
    @Autowired
    private PdmExamineRoleDetailMapper pdmExamineRoleDetailMapper;

    /**
     * 查询时户数考核规则明细
     *
     * @param id 时户数考核规则明细主键
     * @return 时户数考核规则明细
     */
    @Override
    public PdmExamineRoleDetail selectPdmExamineRoleDetailById(Long id)
    {
        return pdmExamineRoleDetailMapper.selectPdmExamineRoleDetailById(id);
    }

    /**
     * 查询时户数考核规则明细列表
     *
     * @param pdmExamineRoleDetail 时户数考核规则明细
     * @return 时户数考核规则明细
     */
    @Override
    public List<PdmExamineRoleDetail> selectPdmExamineRoleDetailList(PdmExamineRoleDetail pdmExamineRoleDetail)
    {
        return pdmExamineRoleDetailMapper.selectPdmExamineRoleDetailList(pdmExamineRoleDetail);
    }

    /**
     * 新增时户数考核规则明细
     *
     * @param pdmExamineRoleDetail 时户数考核规则明细
     * @return 结果
     */
    @Override
    public int insertPdmExamineRoleDetail(PdmExamineRoleDetail pdmExamineRoleDetail)
    {
        pdmExamineRoleDetail.setCreateTime(DateUtils.getNowDate());
        pdmExamineRoleDetail.setDetailName(pdmExamineRoleDetail.getMinNum()+"<= X <"+pdmExamineRoleDetail.getMaxNum());
        return pdmExamineRoleDetailMapper.insertPdmExamineRoleDetail(pdmExamineRoleDetail);
    }

    /**
     * 修改时户数考核规则明细
     *
     * @param pdmExamineRoleDetail 时户数考核规则明细
     * @return 结果
     */
    @Override
    public int updatePdmExamineRoleDetail(PdmExamineRoleDetail pdmExamineRoleDetail)
    {
        pdmExamineRoleDetail.setUpdateTime(DateUtils.getNowDate());
        pdmExamineRoleDetail.setDetailName(pdmExamineRoleDetail.getMinNum()+"<= X <"+pdmExamineRoleDetail.getMaxNum());
        return pdmExamineRoleDetailMapper.updatePdmExamineRoleDetail(pdmExamineRoleDetail);
    }

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

    /**
     * 删除时户数考核规则明细信息
     *
     * @param id 时户数考核规则明细主键
     * @return 结果
     */
    @Override
    public int deletePdmExamineRoleDetailById(Long id)
    {
        return pdmExamineRoleDetailMapper.deletePdmExamineRoleDetailById(id);
    }
}
