package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.TbOrderMapper;
import com.ruoyi.business.domain.TbOrder;
import com.ruoyi.business.service.ITbOrderService;
import com.ruoyi.common.core.text.Convert;

/**
 * 订单Service业务层处理
 * 
 * @author xiatao
 * @date 2022-01-18
 */
@Service
public class TbOrderServiceImpl implements ITbOrderService 
{
    @Autowired
    private TbOrderMapper tbOrderMapper;

    /**
     * 查询订单
     * 
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public TbOrder selectTbOrderById(Long id)
    {
        return tbOrderMapper.selectTbOrderById(id);
    }

    /**
     * 查询订单列表
     * 
     * @param tbOrder 订单
     * @return 订单
     */
    @Override
    public List<TbOrder> selectTbOrderList(TbOrder tbOrder)
    {
        return tbOrderMapper.selectTbOrderList(tbOrder);
    }

    /**
     * 新增订单
     * 
     * @param tbOrder 订单
     * @return 结果
     */
    @Override
    public int insertTbOrder(TbOrder tbOrder)
    {
        tbOrder.setCreateTime(DateUtils.getNowDate());
        return tbOrderMapper.insertTbOrder(tbOrder);
    }

    /**
     * 修改订单
     * 
     * @param tbOrder 订单
     * @return 结果
     */
    @Override
    public int updateTbOrder(TbOrder tbOrder)
    {
        tbOrder.setUpdateTime(DateUtils.getNowDate());
        return tbOrderMapper.updateTbOrder(tbOrder);
    }

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

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