package com.xinelu.manage.service.propagandamaterials.impl;

import com.xinelu.manage.domain.propagandamaterials.PropagandaMaterials;
import com.xinelu.manage.mapper.propagandamaterials.PropagandaMaterialsMapper;
import com.xinelu.manage.service.propagandamaterials.IPropagandaMaterialsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 宣教素材关系Service业务层处理
 *
 * @author xinelu
 * @date 2024-02-27
 */
@Service
public class PropagandaMaterialsServiceImpl implements IPropagandaMaterialsService {
    @Resource
    private PropagandaMaterialsMapper propagandaMaterialsMapper;

    /**
     * 查询宣教素材关系
     *
     * @param id 宣教素材关系主键
     * @return 宣教素材关系
     */
    @Override
    public PropagandaMaterials selectPropagandaMaterialsById(Long id) {
        return propagandaMaterialsMapper.selectPropagandaMaterialsById(id);
    }

    /**
     * 查询宣教素材关系列表
     *
     * @param propagandaMaterials 宣教素材关系
     * @return 宣教素材关系
     */
    @Override
    public List<PropagandaMaterials> selectPropagandaMaterialsList(PropagandaMaterials propagandaMaterials) {
        return propagandaMaterialsMapper.selectPropagandaMaterialsList(propagandaMaterials);
    }

    /**
     * 新增宣教素材关系
     *
     * @param propagandaMaterials 宣教素材关系
     * @return 结果
     */
    @Override
    public int insertPropagandaMaterials(PropagandaMaterials propagandaMaterials) {
        propagandaMaterials.setCreateTime(LocalDateTime.now());
        return propagandaMaterialsMapper.insertPropagandaMaterials(propagandaMaterials);
    }

    /**
     * 修改宣教素材关系
     *
     * @param propagandaMaterials 宣教素材关系
     * @return 结果
     */
    @Override
    public int updatePropagandaMaterials(PropagandaMaterials propagandaMaterials) {
        propagandaMaterials.setUpdateTime(LocalDateTime.now());
        return propagandaMaterialsMapper.updatePropagandaMaterials(propagandaMaterials);
    }

    /**
     * 批量删除宣教素材关系
     *
     * @param ids 需要删除的宣教素材关系主键
     * @return 结果
     */
    @Override
    public int deletePropagandaMaterialsByIds(Long[] ids) {
        return propagandaMaterialsMapper.deletePropagandaMaterialsByIds(ids);
    }

    /**
     * 删除宣教素材关系信息
     *
     * @param id 宣教素材关系主键
     * @return 结果
     */
    @Override
    public int deletePropagandaMaterialsById(Long id) {
        return propagandaMaterialsMapper.deletePropagandaMaterialsById(id);
    }
}
