package com.srs.comprehensive.service.impl;

import java.util.List;
import com.srs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.srs.comprehensive.mapper.StsBonusRulesMapper;
import com.srs.comprehensive.domain.SrsBonusRules;
import com.srs.comprehensive.service.IStsBonusRulesService;

import static org.apache.commons.lang3.SystemUtils.getUserName;

/**
 * 加分规则Service业务层处理
 * 
 * @author srs
 * @date 2023-06-19
 */
@Service
public class StsBonusRulesServiceImpl implements IStsBonusRulesService 
{
    @Autowired
    private StsBonusRulesMapper stsBonusRulesMapper;

    /**
     * 查询加分规则
     * 
     * @param id 加分规则主键
     * @return 加分规则
     */
    @Override
    public SrsBonusRules selectStsBonusRulesById(Long id)
    {
        return stsBonusRulesMapper.selectStsBonusRulesById(id);
    }

    /**
     * 查询加分规则列表
     * 
     * @param srsBonusRules 加分规则
     * @return 加分规则
     */
    @Override
    public List<SrsBonusRules> selectStsBonusRulesList(SrsBonusRules srsBonusRules)
    {
        return stsBonusRulesMapper.selectStsBonusRulesList(srsBonusRules);
    }

    /**
     * 新增加分规则
     * 
     * @param srsBonusRules 加分规则
     * @return 结果
     */
    @Override
    public int insertStsBonusRules(SrsBonusRules srsBonusRules)
    {
        srsBonusRules.setCreateBy(getUserName());
        srsBonusRules.setCreateTime(DateUtils.getNowDate());
        return stsBonusRulesMapper.insertStsBonusRules(srsBonusRules);
    }

    /**
     * 修改加分规则
     * 
     * @param srsBonusRules 加分规则
     * @return 结果
     */
    @Override
    public int updateStsBonusRules(SrsBonusRules srsBonusRules)
    {
        srsBonusRules.setUpdateBy(getUserName());
        srsBonusRules.setUpdateTime(DateUtils.getNowDate());
        return stsBonusRulesMapper.updateStsBonusRules(srsBonusRules);
    }

    /**
     * 批量删除加分规则
     * 
     * @param ids 需要删除的加分规则主键
     * @return 结果
     */
    @Override
    public int deleteStsBonusRulesByIds(Long[] ids)
    {
        return stsBonusRulesMapper.deleteStsBonusRulesByIds(ids);
    }

    /**
     * 删除加分规则信息
     * 
     * @param id 加分规则主键
     * @return 结果
     */
    @Override
    public int deleteStsBonusRulesById(Long id)
    {
        return stsBonusRulesMapper.deleteStsBonusRulesById(id);
    }
}
