package com.yiqi.order.service.impl;

import java.util.List;

import com.yiqi.common.core.domain.AuthHolder;
import com.yiqi.common.enums.ClothOrderStatusType;
import com.yiqi.common.utils.EnumUtils;
import com.yiqi.common.utils.SecurityUtils;
import com.yiqi.order.domain.OrderCloth;
import com.yiqi.order.domain.dto.weapp.AppOrderClothDeliveryChangeStatusDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.order.mapper.OrderClothStatusRecordMapper;
import com.yiqi.order.domain.OrderClothStatusRecord;
import com.yiqi.order.service.IOrderClothStatusRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 洗衣订单状态变更记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-23
 */
@Service
public class OrderClothStatusRecordServiceImpl extends ServiceImpl<OrderClothStatusRecordMapper,OrderClothStatusRecord> implements IOrderClothStatusRecordService {

    @Override
    public void addRecord(AppOrderClothDeliveryChangeStatusDTO appOrderClothDeliveryChangeStatusDTO,String orderNo,String orderStatus,Long deliveryAppUserId) throws Exception {
        OrderClothStatusRecord orderClothStatusRecord = new OrderClothStatusRecord();
        orderClothStatusRecord.buildCreateData();
        orderClothStatusRecord.setOrderId(appOrderClothDeliveryChangeStatusDTO.getOrderId());
        orderClothStatusRecord.setOrderNo(orderNo);
        orderClothStatusRecord.setDeliveryAppUserId(deliveryAppUserId);
        orderClothStatusRecord.setOrderStatus(orderStatus);
        orderClothStatusRecord.setOrderStatusName(EnumUtils.getEnumByType(orderStatus, ClothOrderStatusType.class).getInfo());
        save(orderClothStatusRecord);
    }

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

    /**
     * 查询洗衣订单状态变更记录
     *
     * @param id 洗衣订单状态变更记录主键
     * @return 洗衣订单状态变更记录
     */
    @Override
    public OrderClothStatusRecord selectOrderClothStatusRecordById(Long id) {
        return baseMapper.selectOrderClothStatusRecordById(id);
    }

    /**
     * 查询洗衣订单状态变更记录列表
     *
     * @param orderClothStatusRecord 洗衣订单状态变更记录
     * @return 洗衣订单状态变更记录
     */
    @Override
    public List<OrderClothStatusRecord> selectOrderClothStatusRecordList(OrderClothStatusRecord orderClothStatusRecord) {
        return baseMapper.selectOrderClothStatusRecordList(orderClothStatusRecord);
    }

    /**
     * 新增洗衣订单状态变更记录
     *
     * @param orderClothStatusRecord 洗衣订单状态变更记录
     * @return 结果
     */
    @Override
    public int insertOrderClothStatusRecord(OrderClothStatusRecord orderClothStatusRecord) {
        return baseMapper.insertOrderClothStatusRecord(orderClothStatusRecord);
    }

    /**
     * 修改洗衣订单状态变更记录
     *
     * @param orderClothStatusRecord 洗衣订单状态变更记录
     * @return 结果
     */
    @Override
    public int updateOrderClothStatusRecord(OrderClothStatusRecord orderClothStatusRecord) {
        return baseMapper.updateOrderClothStatusRecord(orderClothStatusRecord);
    }

    /**
     * 批量删除洗衣订单状态变更记录
     *
     * @param ids 需要删除的洗衣订单状态变更记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderClothStatusRecordByIds(Long[] ids) {
        return baseMapper.deleteOrderClothStatusRecordByIds(ids);
    }

    /**
     * 删除洗衣订单状态变更记录信息
     *
     * @param id 洗衣订单状态变更记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderClothStatusRecordById(Long id) {
        return baseMapper.deleteOrderClothStatusRecordById(id);
    }


    //</editor-folder>

}
