package com.op.mes.service.impl;

import java.util.List;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.ProOrderMapper;
import com.op.mes.domain.ProOrder;
import com.op.mes.service.IProOrderService;

/**
 * 订单Service业务层处理
 *
 * @author Open Platform
 * @date 2023-07-13
 */
@Service
public class ProOrderServiceImpl implements IProOrderService {
	@Autowired
	private ProOrderMapper proOrderMapper;

	/**
	 * 查询订单
	 *
	 * @param id 订单主键
	 * @return 订单
	 */
	@Override
	@DS("#header.poolName")
	public ProOrder selectProOrderById(String id) {
		return proOrderMapper.selectProOrderById(id);
	}

	/**
	 * 查询订单列表
	 *
	 * @param proOrder 订单
	 * @return 订单
	 */
	@Override
	@DS("#header.poolName")
	public List<ProOrder> selectProOrderList(ProOrder proOrder) {
		return proOrderMapper.selectProOrderList(proOrder);
	}

	/**
	 * 新增订单
	 *
	 * @param proOrder 订单
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertProOrder(ProOrder proOrder) {
		proOrder.setId(IdUtils.fastSimpleUUID());
		proOrder.setCreateTime(DateUtils.getNowDate());
		return proOrderMapper.insertProOrder(proOrder);
	}

	/**
	 * 修改订单
	 *
	 * @param proOrder 订单
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateProOrder(ProOrder proOrder) {
		proOrder.setUpdateTime(DateUtils.getNowDate());
		return proOrderMapper.updateProOrder(proOrder);
	}

	/**
	 * 批量删除订单
	 *
	 * @param ids 需要删除的订单主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteProOrderByIds(String[] ids) {
		return proOrderMapper.deleteProOrderByIds(ids);
	}

	/**
	 * 删除订单信息
	 *
	 * @param id 订单主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteProOrderById(String id) {
		return proOrderMapper.deleteProOrderById(id);
	}
}
