package com.ruoyi.frequency.platformrulestype.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.PublicCommon;
import com.ruoyi.frequency.platformrulestype.mapper.PlatformRulesTypeMapper;
import com.ruoyi.frequency.platformrulestype.entity.PlatformRulesType;
import com.ruoyi.frequency.platformrulestype.service.PlatformRulesTypeService;

/**
 * 平台规则类型Service业务层处理
 *
 * @author liwenlong
 * @date 2024-02-23
 */
@Service
public class PlatformRulesTypeServiceImpl extends ServiceImpl<PlatformRulesTypeMapper, PlatformRulesType>  implements PlatformRulesTypeService
{
    @Autowired
    private PlatformRulesTypeMapper platformRulesTypeMapper;

    /**
     * 查询平台规则类型
     *
     * @param id 平台规则类型主键
     * @return 平台规则类型
     */
    @Override
    public PlatformRulesType selectPlatformRulesTypeById(Long id)
    {
        return platformRulesTypeMapper.selectPlatformRulesTypeById(id);
    }

    /**
     * 查询平台规则类型列表
     *
     * @param platformRulesType 平台规则类型
     * @return 平台规则类型
     */
    @Override
    public List<PlatformRulesType> selectPlatformRulesTypeList(PlatformRulesType platformRulesType)
    {
        return platformRulesTypeMapper.selectPlatformRulesTypeList(platformRulesType);
    }

    /**
     * 新增平台规则类型
     *
     * @param platformRulesType 平台规则类型
     * @return 结果
     */
    @Override
    public int insertPlatformRulesType(PlatformRulesType platformRulesType)
    {
        platformRulesType.setCreateData();
        platformRulesType.setUpdateData();
        return platformRulesTypeMapper.insert(platformRulesType);
    }

    /**
     * 修改平台规则类型
     *
     * @param platformRulesType 平台规则类型
     * @return 结果
     */
    @Override
    public int updatePlatformRulesType(PlatformRulesType platformRulesType)
    {
        platformRulesType.setUpdateData();
        return platformRulesTypeMapper.updatePlatformRulesType(platformRulesType);
    }

    /**
     * 批量删除平台规则类型
     *
     * @param ids 需要删除的平台规则类型主键
     * @return 结果
     */
    @Override
    public int deletePlatformRulesTypeByIds(Long[] ids,Integer delFlag)
    {
        this.lambdaUpdate().set(PlatformRulesType::getDelFlag,delFlag).in(PlatformRulesType::getId,ids).update();
        return ids.length;
    }

}
