package com.yiqi.order.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.order.mapper.OrderClothRefundMapper;
import com.yiqi.order.domain.OrderClothRefund;
import com.yiqi.order.service.IOrderClothRefundService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 洗衣退款订单Service业务层处理
 *
 * @author douya
 * @date 2024-08-13
 */
@Service
public class OrderClothRefundServiceImpl extends ServiceImpl<OrderClothRefundMapper, OrderClothRefund> implements IOrderClothRefundService {

    //<editor-folder desc="基础韩素">

    /**
     * 查询洗衣退款订单
     *
     * @param id 洗衣退款订单主键
     * @return 洗衣退款订单
     */
    @Override
    public OrderClothRefund selectOrderClothRefundById(Long id) {
        return baseMapper.selectOrderClothRefundById(id);
    }

    /**
     * 查询洗衣退款订单列表
     *
     * @param orderClothRefund 洗衣退款订单
     * @return 洗衣退款订单
     */
    @Override
    public List<OrderClothRefund> selectOrderClothRefundList(OrderClothRefund orderClothRefund) {
        return baseMapper.selectOrderClothRefundList(orderClothRefund);
    }

    /**
     * 新增洗衣退款订单
     *
     * @param orderClothRefund 洗衣退款订单
     * @return 结果
     */
    @Override
    public int insertOrderClothRefund(OrderClothRefund orderClothRefund) {
        orderClothRefund.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insert(orderClothRefund);
    }

    /**
     * 修改洗衣退款订单
     *
     * @param orderClothRefund 洗衣退款订单
     * @return 结果
     */
    @Override
    public int updateOrderClothRefund(OrderClothRefund orderClothRefund) {
        orderClothRefund.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateById(orderClothRefund);
    }

    /**
     * 批量删除洗衣退款订单
     *
     * @param ids 需要删除的洗衣退款订单主键
     * @return 结果
     */
    @Override
    public int deleteOrderClothRefundByIds(Long[] ids) {
        return baseMapper.deleteOrderClothRefundByIds(ids);
    }

    /**
     * 删除洗衣退款订单信息
     *
     * @param id 洗衣退款订单主键
     * @return 结果
     */
    @Override
    public int deleteOrderClothRefundById(Long id) {
        return baseMapper.deleteOrderClothRefundById(id);
    }

    @Override
    public OrderClothRefund getOrderClothRefundByRefundNo(String refundNo) {
        return getOne(new QueryWrapper<OrderClothRefund>().lambda()
                .eq(OrderClothRefund::getRefundNo, refundNo));
    }


    //</editor-folder>

}
