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


import com.neusoft.smart.pos.trade.persistent.domain.TradeMchInfo;
import com.neusoft.smart.pos.trade.persistent.domain.TradeMchInfoExample;
import com.neusoft.smart.pos.trade.persistent.mapper.TradeMchInfoMapper;
import lombok.val;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


/**
 * @author zcf
 * @date 2018-12-29 09：24
 * @description 交易商户信息管理使用Repository
 */
@Component
public class TradeMchInfoRepository {

	@Resource
	private TradeMchInfoMapper tradeMchInfoMapper;
	
	/**
	 * 商户信息查询方法
	 * @param mcode：商户号
	 * @return
	 */
	public TradeMchInfo queryTradeMchInfo(String mcode){
		val example = new TradeMchInfoExample();
		example.createCriteria()
				.andMcodeEqualTo(mcode);
		val tradeMchInfos = tradeMchInfoMapper.selectByExample(example);
		return tradeMchInfos.size()>0?tradeMchInfos.get(0):null;
	}
}
