/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.wechat.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wechat.dao.MdeOrdersDao;
import com.wechat.model.dbEntity.MdeOrders;

/**
 * 单表生成Service
 * 
 * @author tangwc
 * @version 2018-06-08
 */
@Service
public class MdeOrdersService {
	
	@Autowired
	MdeOrdersDao mdeOrdersDao;

	public MdeOrders findOneByTradeCode(String out_trade_no) {
		return mdeOrdersDao.findOneByTradeCode(out_trade_no);
	}

	/**
	 * 获取用户的有效会员订单 会员到期日最晚的那条订单
	 * @param userCode
	 * @return
	 */
	public MdeOrders getValidOrdersByUserCode(String userCode) {
		return mdeOrdersDao.getValidOrdersByUserCode(userCode);
	}


	public int insertNewOrder(MdeOrders order) {
		return mdeOrdersDao.insertNewOrder(order);
	}
}