package com.neusoft.smart.pos.order.repository;


import com.neusoft.smart.pos.order.persistent.domain.OrderRefundTransaction;
import com.neusoft.smart.pos.order.persistent.domain.OrderRefundTransactionExample;
import com.neusoft.smart.pos.order.persistent.mapper.OrderRefundTransactionMapper;
import lombok.val;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;


/**
 * @author zcf
 * @date 2018-03-14 10：58
 * @description 退款订单明细管理使用Repository
 */
@Component
public class OrderRefundTransactionRepository {

	@Resource
	private OrderRefundTransactionMapper orderRefundTransactionMapper;
	
	/**
	 * 订单信息保存方法
	 * @return
	 */
	public Integer saveRefundOrderDetails(OrderRefundTransaction orderRefundTransaction){
		orderRefundTransaction.setCreatedAt(new Date());
		orderRefundTransaction.setUpdatedAt(new Date());
		return orderRefundTransactionMapper.insertSelective(orderRefundTransaction);
	}

	/**
	 * 订单明细信息查询方法
	 * @return
	 */
	public List<OrderRefundTransaction> queryRefundOrderDetails(String refundNumber){
		val example = new OrderRefundTransactionExample();
		example.createCriteria().andRefundNumberEqualTo(refundNumber);
		return orderRefundTransactionMapper.selectByExample(example);
	}

}
