package com.ruoyi.frequency.mallrefundordergoods.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.frequency.mallrefundordergoods.entity.MallRefundOrderGoods;
import com.ruoyi.frequency.mallrefundordergoods.mapper.MallRefundOrderGoodsMapper;
import com.ruoyi.frequency.mallrefundordergoods.service.MallRefundOrderGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单退款商品关联Service业务层处理
 *
 * @author liwenlong
 * @date 2024-01-25
 */
@Service
public class MallRefundOrderGoodsServiceImpl extends ServiceImpl<MallRefundOrderGoodsMapper, MallRefundOrderGoods>  implements MallRefundOrderGoodsService
{
    @Autowired
    private MallRefundOrderGoodsMapper mallRefundOrderGoodsMapper;

    /**
     * 查询订单退款商品关联
     *
     * @param id 订单退款商品关联主键
     * @return 订单退款商品关联
     */
    @Override
    public MallRefundOrderGoods selectMallRefundOrderGoodsById(Long id)
    {
        return mallRefundOrderGoodsMapper.selectMallRefundOrderGoodsById(id);
    }

    /**
     * 查询订单退款商品关联列表
     *
     * @param mallRefundOrderGoods 订单退款商品关联
     * @return 订单退款商品关联
     */
    @Override
    public List<MallRefundOrderGoods> selectMallRefundOrderGoodsList(MallRefundOrderGoods mallRefundOrderGoods)
    {
        return mallRefundOrderGoodsMapper.selectMallRefundOrderGoodsList(mallRefundOrderGoods);
    }

    /**
     * 新增订单退款商品关联
     *
     * @param mallRefundOrderGoods 订单退款商品关联
     * @return 结果
     */
    @Override
    public int insertMallRefundOrderGoods(MallRefundOrderGoods mallRefundOrderGoods)
    {
        mallRefundOrderGoods.setCreateData();
        return mallRefundOrderGoodsMapper.insert(mallRefundOrderGoods);
    }

    /**
     * 修改订单退款商品关联
     *
     * @param mallRefundOrderGoods 订单退款商品关联
     * @return 结果
     */
    @Override
    public int updateMallRefundOrderGoods(MallRefundOrderGoods mallRefundOrderGoods)
    {
        mallRefundOrderGoods.setUpdateData();
        return mallRefundOrderGoodsMapper.updateMallRefundOrderGoods(mallRefundOrderGoods);
    }

    /**
     * 批量删除订单退款商品关联
     *
     * @param ids 需要删除的订单退款商品关联主键
     * @return 结果
     */
    @Override
    public int deleteMallRefundOrderGoodsByIds(Long[] ids,Integer delFlag)
    {
        this.lambdaUpdate().set(MallRefundOrderGoods::getDelFlag,delFlag).in(MallRefundOrderGoods::getId,ids).update();
        return ids.length;
    }

}
