package com.ruoyi.generator.service;

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.generator.mapper.SysCodeSnippetMapper;
import com.ruoyi.generator.domain.SysCodeSnippet;
import com.ruoyi.generator.service.ISysCodeSnippetService;

/**
 * 代码片段管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-09
 */
@Service
public class SysCodeSnippetServiceImpl implements ISysCodeSnippetService 
{
    @Autowired
    private SysCodeSnippetMapper sysCodeSnippetMapper;

    /**
     * 查询代码片段管理
     * 
     * @param snippetId 代码片段管理主键
     * @return 代码片段管理
     */
    @Override
    public SysCodeSnippet selectSysCodeSnippetBySnippetId(Long snippetId)
    {
        return sysCodeSnippetMapper.selectSysCodeSnippetBySnippetId(snippetId);
    }

    /**
     * 查询代码片段管理列表
     * 
     * @param sysCodeSnippet 代码片段管理
     * @return 代码片段管理
     */
    @Override
    public List<SysCodeSnippet> selectSysCodeSnippetList(SysCodeSnippet sysCodeSnippet)
    {
        return sysCodeSnippetMapper.selectSysCodeSnippetList(sysCodeSnippet);
    }

    /**
     * 新增代码片段管理
     * 
     * @param sysCodeSnippet 代码片段管理
     * @return 结果
     */
    @Override
    public int insertSysCodeSnippet(SysCodeSnippet sysCodeSnippet)
    {
        sysCodeSnippet.setCreateTime(DateUtils.getNowDate());
        return sysCodeSnippetMapper.insertSysCodeSnippet(sysCodeSnippet);
    }

    /**
     * 修改代码片段管理
     * 
     * @param sysCodeSnippet 代码片段管理
     * @return 结果
     */
    @Override
    public int updateSysCodeSnippet(SysCodeSnippet sysCodeSnippet)
    {
        sysCodeSnippet.setUpdateTime(DateUtils.getNowDate());
        return sysCodeSnippetMapper.updateSysCodeSnippet(sysCodeSnippet);
    }

    /**
     * 批量删除代码片段管理
     * 
     * @param snippetIds 需要删除的代码片段管理主键
     * @return 结果
     */
    @Override
    public int deleteSysCodeSnippetBySnippetIds(Long[] snippetIds)
    {
        return sysCodeSnippetMapper.deleteSysCodeSnippetBySnippetIds(snippetIds);
    }

    /**
     * 删除代码片段管理信息
     * 
     * @param snippetId 代码片段管理主键
     * @return 结果
     */
    @Override
    public int deleteSysCodeSnippetBySnippetId(Long snippetId)
    {
        return sysCodeSnippetMapper.deleteSysCodeSnippetBySnippetId(snippetId);
    }
}
