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


import com.neusoft.smart.pos.trade.persistent.domain.GrantOrderTransaction;
import com.neusoft.smart.pos.trade.persistent.domain.GrantOrderTransactionExample;
import com.neusoft.smart.pos.trade.persistent.mapper.GrantOrderTransactionMapper;
import lombok.val;
import org.springframework.stereotype.Component;

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


/**
 * @author zcf
 * @date 2018-11-28 10：43
 * @description 预授权操作明细管理使用Repository
 */
@Component
public class GrantOrderTransactionRepository {

	@Resource
	private GrantOrderTransactionMapper grantOrderTransactionMapper;
	
	/**
	 * 预授权订单操作信息保存方法
	 * @return
	 */
	public Integer saveOrderTransaction(GrantOrderTransaction grantOrderTransaction){
		return grantOrderTransactionMapper.insertSelective(grantOrderTransaction);
	}

	/**
	 * 订单明细信息查询方法
	 * @return
	 */
	public List<GrantOrderTransaction> queryOrderDetails(String grantOrderNumber){
		val example = new GrantOrderTransactionExample();
		example.createCriteria().andGrantOrderNumberEqualTo(grantOrderNumber);
		example.setOrderByClause("created_at desc");
		return grantOrderTransactionMapper.selectByExample(example);
	}
}
