package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.mapper.PublishImageMapper;
import com.younike.system.domain.PublishImage;
import com.younike.system.service.IPublishImageService;

/**
 * 发布需求图片Service业务层处理
 * 
 * @author elev
 * @date 2022-01-20
 */
@Service
public class PublishImageServiceImpl implements IPublishImageService {
    @Autowired
    private PublishImageMapper publishImageMapper;

    /**
     * 查询发布需求图片
     * 
     * @param imageId 发布需求图片主键
     * @return 发布需求图片
     */
    @Override
    public PublishImage selectPublishImageByImageId(Long imageId) {
        return publishImageMapper.selectPublishImageByImageId(imageId);
    }

    /**
     * 查询发布需求图片列表
     * 
     * @param publishImage 发布需求图片
     * @return 发布需求图片
     */
    @Override
    public List<PublishImage> selectPublishImageList(PublishImage publishImage) {
        return publishImageMapper.selectPublishImageList(publishImage);
    }

    /**
     * 新增发布需求图片
     * 
     * @param publishImage 发布需求图片
     * @return 结果
     */
    @Override
    public int insertPublishImage(PublishImage publishImage) {
        publishImage.setCreateTime(LocalDateTime.now());
        return publishImageMapper.insertPublishImage(publishImage);
    }

    /**
     * 修改发布需求图片
     * 
     * @param publishImage 发布需求图片
     * @return 结果
     */
    @Override
    public int updatePublishImage(PublishImage publishImage) {
        publishImage.setUpdateTime(LocalDateTime.now());
        return publishImageMapper.updatePublishImage(publishImage);
    }

    /**
     * 批量删除发布需求图片
     * 
     * @param imageIds 需要删除的发布需求图片主键
     * @return 结果
     */
    @Override
    public int deletePublishImageByImageIds(Long[] imageIds) {
        return publishImageMapper.deletePublishImageByImageIds(imageIds);
    }

    /**
     * 删除发布需求图片信息
     * 
     * @param imageId 发布需求图片主键
     * @return 结果
     */
    @Override
    public int deletePublishImageByImageId(Long imageId)
    {
        return publishImageMapper.deletePublishImageByImageId(imageId);
    }
}
