package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.partyNews.PartyNews;
import com.ruoyi.system.mapper.PartyNewsMapper;
import com.ruoyi.system.service.IPartyNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 党建资讯Service业务层处理
 * 
 * @author boman
 * @date 2025-02-14
 */
@Service
public class PartyNewsServiceImpl implements IPartyNewsService 
{
    @Autowired
    private PartyNewsMapper partyNewsMapper;

    /**
     * 查询党建资讯
     * 
     * @param partyId 党建资讯主键
     * @return 党建资讯
     */
    @Override
    public PartyNews selectPartyNewsByPartyId(Long partyId)
    {
        return partyNewsMapper.selectPartyNewsByPartyId(partyId);
    }

    /**
     * 查询党建资讯列表
     * 
     * @param partyNews 党建资讯
     * @return 党建资讯
     */
    @Override
    public List<PartyNews> selectPartyNewsList(PartyNews partyNews)
    {
        return partyNewsMapper.selectPartyNewsList(partyNews);
    }

    /**
     * 新增党建资讯
     * 
     * @param partyNews 党建资讯
     * @return 结果
     */
    @Override
    public int insertPartyNews(PartyNews partyNews)
    {
        partyNews.setCreateTime(DateUtils.getNowDate());
        return partyNewsMapper.insertPartyNews(partyNews);
    }

    /**
     * 修改党建资讯
     * 
     * @param partyNews 党建资讯
     * @return 结果
     */
    @Override
    public int updatePartyNews(PartyNews partyNews)
    {
        partyNews.setUpdateTime(DateUtils.getNowDate());
        return partyNewsMapper.updatePartyNews(partyNews);
    }

    /**
     * 批量删除党建资讯
     * 
     * @param partyIds 需要删除的党建资讯主键
     * @return 结果
     */
    @Override
    public int deletePartyNewsByPartyIds(Long[] partyIds)
    {
        return partyNewsMapper.deletePartyNewsByPartyIds(partyIds);
    }

    /**
     * 删除党建资讯信息
     * 
     * @param partyId 党建资讯主键
     * @return 结果
     */
    @Override
    public int deletePartyNewsByPartyId(Long partyId)
    {
        return partyNewsMapper.deletePartyNewsByPartyId(partyId);
    }
}
