package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;

import com.younike.system.mapper.GoodsCommentResourceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.domain.GoodsCommentResource;
import com.younike.system.service.IGoodsCommentResourceService;

/**
 * 评价资源Service业务层处理
 *
 * @author elev
 * @date 2022-01-05
 */
@Service
public class GoodsCommentResourceServiceImpl implements IGoodsCommentResourceService {
    @Autowired
    private GoodsCommentResourceMapper goodsCommentResourceMapper;

    /**
     * 查询评价资源
     *
     * @param recourceId 评价资源主键
     * @return 评价资源
     */
    @Override
    public GoodsCommentResource selectGoodsCommentResourceByRecourceId(Long recourceId) {
        return goodsCommentResourceMapper.selectGoodsCommentResourceByRecourceId(recourceId);
    }

    /**
     * 查询评价资源列表
     *
     * @param goodsCommentResource 评价资源
     * @return 评价资源
     */
    @Override
    public List<GoodsCommentResource> selectGoodsCommentResourceList(GoodsCommentResource goodsCommentResource) {
        return goodsCommentResourceMapper.selectGoodsCommentResourceList(goodsCommentResource);
    }

    /**
     * 新增评价资源
     *
     * @param goodsCommentResource 评价资源
     * @return 结果
     */
    @Override
    public int insertGoodsCommentResource(GoodsCommentResource goodsCommentResource) {
        goodsCommentResource.setCreateTime(LocalDateTime.now());
        return goodsCommentResourceMapper.insertGoodsCommentResource(goodsCommentResource);
    }

    /**
     * 修改评价资源
     *
     * @param goodsCommentResource 评价资源
     * @return 结果
     */
    @Override
    public int updateGoodsCommentResource(GoodsCommentResource goodsCommentResource) {
        goodsCommentResource.setUpdateTime(LocalDateTime.now());
        return goodsCommentResourceMapper.updateGoodsCommentResource(goodsCommentResource);
    }

    /**
     * 批量删除评价资源
     *
     * @param recourceIds 需要删除的评价资源主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCommentResourceByRecourceIds(Long[] recourceIds) {
        return goodsCommentResourceMapper.deleteGoodsCommentResourceByRecourceIds(recourceIds);
    }

    /**
     * 删除评价资源信息
     *
     * @param recourceId 评价资源主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCommentResourceByRecourceId(Long recourceId)
    {
        return goodsCommentResourceMapper.deleteGoodsCommentResourceByRecourceId(recourceId);
    }
}

