package com.playlet.system.service.impl;

import java.util.List;
import com.playlet.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.playlet.system.mapper.PlayletConfigMapper;
import com.playlet.system.domain.PlayletConfig;
import com.playlet.system.service.IPlayletConfigService;
import com.playlet.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 全局配置Service业务层处理
 *
 * @author ruoyi
 * @date 2024-06-04
 */
@Service
public class PlayletConfigServiceImpl extends ServiceImpl<PlayletConfigMapper, PlayletConfig> implements IPlayletConfigService
{
    @Autowired
    private PlayletConfigMapper playletConfigMapper;

    /**
     * 查询全局配置
     *
     * @param id 全局配置主键
     * @return 全局配置
     */
    @Override
    public PlayletConfig selectPlayletConfigById(Long id)
    {
        return playletConfigMapper.selectPlayletConfigById(id);
    }

    /**
     * 查询全局配置列表
     *
     * @param playletConfig 全局配置
     * @return 全局配置
     */
    @Override
    public List<PlayletConfig> selectPlayletConfigList(PlayletConfig playletConfig)
    {
        return playletConfigMapper.selectPlayletConfigList(playletConfig);
    }

    /**
     * 新增全局配置
     *
     * @param playletConfig 全局配置
     * @return 结果
     */
    @Override
    public int insertPlayletConfig(PlayletConfig playletConfig)
    {
        playletConfig.setCreateTime(DateUtils.getNowDate());
        return playletConfigMapper.insertPlayletConfig(playletConfig);
    }

    /**
     * 修改全局配置
     *
     * @param playletConfig 全局配置
     * @return 结果
     */
    @Override
    public int updatePlayletConfig(PlayletConfig playletConfig)
    {
        playletConfig.setUpdateTime(DateUtils.getNowDate());
        return playletConfigMapper.updatePlayletConfig(playletConfig);
    }

    /**
     * 批量删除全局配置
     *
     * @param ids 需要删除的全局配置主键
     * @return 结果
     */
    @Override
    public int deletePlayletConfigByIds(String ids)
    {
        return playletConfigMapper.deletePlayletConfigByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除全局配置信息
     *
     * @param id 全局配置主键
     * @return 结果
     */
    @Override
    public int deletePlayletConfigById(Long id)
    {
        return playletConfigMapper.deletePlayletConfigById(id);
    }
}
