package com.younike.system.service.impl;
import com.younike.system.domain.vo.GoodsCommentResourceVo;
import com.younike.system.mapper.MerchantGoodsCommentResourceMapper;
import com.younike.system.service.IMerchantGoodsCommentResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 评价资源Service业务层处理
 *
 * @author jubs
 * @date 2022-01-12
 */
@Service
public class MerchantGoodsCommentResourceServiceImpl implements IMerchantGoodsCommentResourceService {
    @Autowired
    private MerchantGoodsCommentResourceMapper goodsCommentResourceMapper;

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

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

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

    /**
     * 修改评价资源
     *
     * @param goodsCommentResource 评价资源
     * @return 结果
     */
    @Override
    public int updateGoodsCommentResource(GoodsCommentResourceVo 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);
    }
}
