package com.ruoyi.model.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.model.domain.AppletOrder;
import com.ruoyi.model.domain.AppletOrderItem;
import com.ruoyi.model.mapper.AppletOrderItemMapper;
import com.ruoyi.model.mapper.AppletOrderMapper;
import com.ruoyi.model.service.IAppletOrderItemService;
import com.ruoyi.model.service.IAppletOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-28
 */
@Service
public class AppletOrderItemServiceImpl extends ServiceImpl<AppletOrderItemMapper, AppletOrderItem>
        implements IAppletOrderItemService
{
    @Autowired
    private AppletOrderItemMapper appletOrderItemMapper;

    /**
     * 查询订单信息
     *
     * @param id 订单信息主键
     * @return 订单信息
     */
    @Override
    public AppletOrderItem selectAppletOrderItemById(Long id)
    {
        return appletOrderItemMapper.selectAppletOrderItemById(id);
    }
    @Override
    public AppletOrderItem selectAppletOrderItemByOrderIdUserId(AppletOrderItem appletOrderItem){
        return appletOrderItemMapper.selectAppletOrderItemByOrderIdUserId(appletOrderItem.getOrderId(),appletOrderItem.getUserId());
    }

    @Override
    public AppletOrderItem selectAppletOrderItemByOrderId(AppletOrderItem appletOrderItem){
        return appletOrderItemMapper.selectAppletOrderItemByOrderId(appletOrderItem.getOrderId());
    }

    /**
     * 查询订单信息列表
     *
     * @param appletOrder 订单信息
     * @return 订单信息
     */
    @Override
    public List<AppletOrderItem> selectAppletOrderItemList(AppletOrderItem appletOrder)
    {
        return appletOrderItemMapper.selectAppletOrderItemList(appletOrder);
    }


    @Override
    public List<AppletOrderItem> selectAppletOrderItemListLikeUserIdJson(AppletOrderItem appletOrder){
        return appletOrderItemMapper.selectAppletOrderItemListLikeUserIdJson(appletOrder);
    }
    /**
     * 新增订单信息
     *
     * @param appletOrder 订单信息
     * @return 结果
     */
    @Override
    public int insertAppletOrderItem(AppletOrderItem appletOrder)
    {
//        appletOrder.setCreateTime(new Date());
        return appletOrderItemMapper.insertAppletOrderItem(appletOrder);
    }

    /**
     * 修改订单信息
     *
     * @param appletOrder 订单信息
     * @return 结果
     */
    @Override
    public int updateAppletOrderItem(AppletOrderItem appletOrder)
    {
//        appletOrder.setUpdateTime(DateUtils.getNowDate());
        return appletOrderItemMapper.updateAppletOrderItem(appletOrder);
    }

    /**
     * 批量删除订单信息
     *
     * @param ids 需要删除的订单信息主键
     * @return 结果
     */
    @Override
    public int deleteAppletOrderItemByIds(Long[] ids)
    {
        return appletOrderItemMapper.deleteAppletOrderItemByIds(ids);
    }

    /**
     * 删除订单信息信息
     *
     * @param id 订单信息主键
     * @return 结果
     */
    @Override
    public int deleteAppletOrderItemById(Long id)
    {
        return appletOrderItemMapper.deleteAppletOrderItemById(id);
    }
}
