package com.yiqi.app.service.impl;

import java.util.List;

import com.yiqi.common.core.domain.AuthHolder;
import com.yiqi.common.core.domain.PageVO;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.SecurityUtils;
import com.yiqi.core.domain.vo.weapp.WeAppGoodsInfoQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.app.mapper.AppGoodsCollectMapper;
import com.yiqi.app.domain.AppGoodsCollect;
import com.yiqi.app.service.IAppGoodsCollectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 商品收藏记录Service业务层处理
 *
 * @author ruoyi
 * @date 2023-11-02
 */
@Service
public class AppGoodsCollectServiceImpl extends ServiceImpl<AppGoodsCollectMapper,AppGoodsCollect> implements IAppGoodsCollectService {

    /**
     * 查询商品收藏记录
     *
     * @param id 商品收藏记录主键
     * @return 商品收藏记录
     */
    @Override
    public AppGoodsCollect selectAppGoodsCollectById(Long id) {
        return baseMapper.selectAppGoodsCollectById(id);
    }

    /**
     * 查询商品收藏记录列表
     *
     * @param appGoodsCollect 商品收藏记录
     * @return 商品收藏记录
     */
    @Override
    public List<WeAppGoodsInfoQueryVO> selectAppGoodsCollectList(PageVO pageVO) {
        return baseMapper.selectAppGoodsCollectList(pageVO,AuthHolder.userId());
    }

    /**
     * 新增商品收藏记录
     *
     * @param appGoodsCollect 商品收藏记录
     * @return 结果
     */
    @Override
    public int insertAppGoodsCollect(AppGoodsCollect appGoodsCollect) {
        appGoodsCollect.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertAppGoodsCollect(appGoodsCollect);
    }

    /**
     * 修改商品收藏记录
     *
     * @param appGoodsCollect 商品收藏记录
     * @return 结果
     */
    @Override
    public int updateAppGoodsCollect(AppGoodsCollect appGoodsCollect) {
        return baseMapper.updateAppGoodsCollect(appGoodsCollect);
    }

    /**
     * 批量删除商品收藏记录
     *
     * @param ids 需要删除的商品收藏记录主键
     * @return 结果
     */
    @Override
    public int deleteAppGoodsCollectByIds(String[] ids) {
        return baseMapper.deleteAppGoodsCollectByIds(ids, AuthHolder.userId());
    }

    /**
     * 删除商品收藏记录信息
     *
     * @param id 商品收藏记录主键
     * @return 结果
     */
    @Override
    public int deleteAppGoodsCollectById(Long id) {
        return baseMapper.deleteAppGoodsCollectById(id);
    }



}
