package beilv.order.service.impl;

import java.util.List;

import beilv.common.utils.DateUtils;
import beilv.order.domain.StoreOrder;
import beilv.order.mapper.StoreOrderMapper;
import beilv.order.service.IStoreOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import beilv.common.core.text.Convert;

/**
 * 订单Service业务层处理
 *
 * @author ruoyi
 * @date 2025-11-12
 */
@Service
public class StoreOrderServiceImpl implements IStoreOrderService {
    @Autowired
    private StoreOrderMapper storeOrderMapper;

    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public StoreOrder selectStoreOrderById(Long id) {
        return storeOrderMapper.selectStoreOrderById(id);
    }

    /**
     * 查询订单列表
     *
     * @param storeOrder 订单
     * @return 订单
     */
    @Override
    public List<StoreOrder> selectStoreOrderList(StoreOrder storeOrder) {
        return storeOrderMapper.selectStoreOrderList(storeOrder);
    }

    /**
     * 新增订单
     *
     * @param storeOrder 订单
     * @return 结果
     */
    @Override
    public int insertStoreOrder(StoreOrder storeOrder) {
        storeOrder.setCreateTime(DateUtils.getNowDate());
        return storeOrderMapper.insertStoreOrder(storeOrder);
    }

    /**
     * 修改订单
     *
     * @param storeOrder 订单
     * @return 结果
     */
    @Override
    public int updateStoreOrder(StoreOrder storeOrder) {
        storeOrder.setUpdateTime(DateUtils.getNowDate());
        return storeOrderMapper.updateStoreOrder(storeOrder);
    }

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteStoreOrderByIds(String ids) {
        return storeOrderMapper.deleteStoreOrderByIds(Convert.toStrArray(ids));
    }

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